販売のポップコーン陳列を実装

This commit is contained in:
kimura 2021-08-19 14:30:49 +09:00
parent ddc23e8701
commit cf9022e6e6
8 changed files with 2139 additions and 101 deletions

View File

@ -0,0 +1,149 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6654275607504121913
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 648528851945481441}
- component: {fileID: 2301097158442999248}
- component: {fileID: 856520055824150402}
m_Layer: 0
m_Name: package_a_salt
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &648528851945481441
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6654275607504121913}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7689040401039027174}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &2301097158442999248
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6654275607504121913}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 7
m_Sprite: {fileID: 21300000, guid: 99d426990eeb08d4d85ae03f04609196, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.92, y: 1.36}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!95 &856520055824150402
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6654275607504121913}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: b9e306c9dd9a867409caee4d882fd445, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &7689040401039027175
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7689040401039027174}
- component: {fileID: 3788453926216569065}
m_Layer: 0
m_Name: popcorn
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7689040401039027174
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7689040401039027175}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 648528851945481441}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3788453926216569065
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7689040401039027175}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: db6c3e3cc4bd48f480264f676924cb14, type: 3}
m_Name:
m_EditorClassIdentifier:
popcornRenderer: {fileID: 2301097158442999248}
caramelSprite: {fileID: 21300000, guid: 469b78432f101024aa1a2060a57231d8, type: 3}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6ecdd4b8fb7ad486fba3b4949386d6c9
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -10,6 +10,8 @@ public class Market : MonoBehaviour
public static readonly int ShopStockCount = 21;
[SerializeField] private ShopStockView stockView;
[SerializeField] private MarketCartView cartView;
// Start is called before the first frame update
void Start()
{
@ -23,6 +25,8 @@ public class Market : MonoBehaviour
StockFlavorLog();
cartView.SetStock(GameDataManager.GameData.ShopStock);
// お客さんの出現タイミング(10秒間に回)
Observable.Timer(TimeSpan.FromSeconds(2f), TimeSpan.FromSeconds(10f))
.Subscribe(_ =>
@ -41,9 +45,11 @@ public class Market : MonoBehaviour
// 売上反映
GameDataManager.GameData.coin = CoinManager.Instance.OwnCoin;
GameDataManager.SaveGameData();
cartView.SellStock();
// 自動補充 refill
RefillProduct();
stockView.SetStock(gameData.StorageTanks);
stockView.SetStock(GameDataManager.GameData.StorageTanks);
cartView.SetStock(GameDataManager.GameData.ShopStock);
StockFlavorLog();
}).AddTo(this);
}

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public class MarketCartView : MonoBehaviour
{
[SerializeField] private List<MarketPopcornView> popcornPositions;
private void ResetDisplay()
{
foreach (var popcorn in popcornPositions)
{
popcorn.gameObject.SetActive(false);
}
}
public void SetStock(List<int> shopStock)
{
ResetDisplay();
// 陳列
var i = 0;
foreach (var flavor in shopStock)
{
var popcorn = popcornPositions[i];
popcorn.ChangeSkin(flavor);
this.CallWaitForSeconds(.05f * i, () =>
{
popcorn.gameObject.SetActive(true);
});
i++;
}
}
public void SellStock()
{
popcornPositions[0].gameObject.SetActive(false);
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 81d6313dccd940ccaaeaeb71fffca557
timeCreated: 1629346514

View File

@ -0,0 +1,15 @@
using UnityEngine;
public class MarketPopcornView : MonoBehaviour
{
[SerializeField] private SpriteRenderer popcornRenderer;
[SerializeField] private Sprite caramelSprite;
public void ChangeSkin(int flavor)
{
if (flavor == 2)
{
popcornRenderer.sprite = caramelSprite;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: db6c3e3cc4bd48f480264f676924cb14
timeCreated: 1629350571

File diff suppressed because it is too large Load Diff