ピンクのアニメーションバックグラウンド対応
This commit is contained in:
parent
f8f00336ac
commit
0df8a61f0f
|
|
@ -1,5 +1,86 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &746832000
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 746832001}
|
||||
- component: {fileID: 746832002}
|
||||
m_Layer: 0
|
||||
m_Name: MarketBrotherPink
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &746832001
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 746832000}
|
||||
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: 5749156821563996369}
|
||||
m_Father: {fileID: 3667080857874733261}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &746832002
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 746832000}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6bf6e7fee6cf41a6bad181319bb8b8ed, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
animatorPrefab: {fileID: 7854448232971748898, guid: febae22cb9bba384992e30ac63891778,
|
||||
type: 3}
|
||||
pinkTransform: {fileID: 5749156821563996369}
|
||||
walkSideBottomPos: -8
|
||||
pinkWalkSpeed: 4
|
||||
coolTime: 20
|
||||
fewerBorder: 5
|
||||
--- !u!1 &2089667968034057798
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5749156821563996369}
|
||||
m_Layer: 0
|
||||
m_Name: Target
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5749156821563996369
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2089667968034057798}
|
||||
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: 746832001}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &3459593390050872226
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -9,10 +90,10 @@ GameObject:
|
|||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3667080857874733261}
|
||||
- component: {fileID: 1623805592074586917}
|
||||
- component: {fileID: 7740671670896384492}
|
||||
- component: {fileID: 3756929251745663541}
|
||||
- component: {fileID: 5400893423074421525}
|
||||
- component: {fileID: 1623805592074586917}
|
||||
m_Layer: 0
|
||||
m_Name: DontDestroyObject
|
||||
m_TagString: Untagged
|
||||
|
|
@ -32,9 +113,22 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 3320409656134683753}
|
||||
- {fileID: 746832001}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1623805592074586917
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3459593390050872226}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 992ca0f9e68a447b8f3d9ea096088ae4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &7740671670896384492
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -81,18 +175,6 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 77ded0026daa40d4b872efbaf2c1195c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &1623805592074586917
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3459593390050872226}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 992ca0f9e68a447b8f3d9ea096088ae4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &8739647597683206087
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -498,7 +498,6 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 7854448232971748899}
|
||||
- component: {fileID: 7854448232971748898}
|
||||
- component: {fileID: 7854448232971748957}
|
||||
- component: {fileID: 7854448232971748956}
|
||||
m_Layer: 0
|
||||
m_Name: Brother_pink
|
||||
|
|
@ -515,7 +514,7 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7854448232971748896}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 4.96, y: -0.26, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 7854448232785489951}
|
||||
|
|
@ -545,24 +544,6 @@ Animator:
|
|||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorControllerStateOnDisable: 0
|
||||
--- !u!114 &7854448232971748957
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7854448232971748896}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6bf6e7fee6cf41a6bad181319bb8b8ed, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
animator: {fileID: 7854448232971748898}
|
||||
pinkTransform: {fileID: 7854448232971748899}
|
||||
walkSideBottomPos: -8
|
||||
pinkWalkSpeed: 4
|
||||
coolTime: 20
|
||||
fewerBorder: 5
|
||||
--- !u!210 &7854448232971748956
|
||||
SortingGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using UniRx;
|
||||
using UniRx.Triggers;
|
||||
using UnityEngine;
|
||||
|
||||
public class BrotherPinkView : MonoBehaviour
|
||||
public class BrotherPinkView : SingletonMonoBehaviour<BrotherPinkView>
|
||||
{
|
||||
private static readonly int Normal = Animator.StringToHash("Normal");
|
||||
private static readonly int Promotion = Animator.StringToHash("Promotion");
|
||||
|
|
@ -11,7 +12,7 @@ public class BrotherPinkView : MonoBehaviour
|
|||
private static readonly Vector2 RightPos = new Vector2(4.96f, -0.26f);
|
||||
private static readonly Vector2 LeftPos = new Vector2(-4.96f, -0.26f);
|
||||
|
||||
[SerializeField] private Animator animator;
|
||||
[SerializeField] private Animator animatorPrefab;
|
||||
[SerializeField] private Transform pinkTransform;
|
||||
[SerializeField] private float walkSideBottomPos;
|
||||
[SerializeField] private float pinkWalkSpeed = 4f;
|
||||
|
|
@ -20,6 +21,7 @@ public class BrotherPinkView : MonoBehaviour
|
|||
|
||||
public int FewerBorder => fewerBorder;
|
||||
|
||||
private Animator animator;
|
||||
private bool isManyCustomer;
|
||||
private bool isLocked;
|
||||
private int nextId;
|
||||
|
|
@ -34,8 +36,17 @@ public class BrotherPinkView : MonoBehaviour
|
|||
private Vector2 wayPoint;
|
||||
private float durationDelta;
|
||||
private float completedDuration;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
nextId = Normal;
|
||||
isManyCustomer = true;
|
||||
Debug.Log($"normal");
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
pinkTransform.localPosition = RightPos;
|
||||
this.UpdateAsObservable().Subscribe(_ =>
|
||||
{
|
||||
if (isManyCustomer || isLocked)
|
||||
|
|
@ -60,7 +71,7 @@ public class BrotherPinkView : MonoBehaviour
|
|||
moveIndex = 0;
|
||||
isLocked = true;
|
||||
isManyCustomer = true;
|
||||
animator.SetTrigger(nextId);
|
||||
if (animator != null) animator.SetTrigger(nextId);
|
||||
this.CallWaitForSeconds(coolTime, () =>
|
||||
{
|
||||
isLocked = false;
|
||||
|
|
@ -72,10 +83,19 @@ public class BrotherPinkView : MonoBehaviour
|
|||
}).AddTo(this);
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
public void SetBrotherView(Transform target)
|
||||
{
|
||||
nextId = Normal;
|
||||
isManyCustomer = true;
|
||||
target.DestroyAllChildrens();
|
||||
animator = Instantiate(animatorPrefab, target);
|
||||
this.UpdateAsObservable().Subscribe(_ =>
|
||||
{
|
||||
target.localPosition = pinkTransform.localPosition;
|
||||
target.localRotation = pinkTransform.localRotation;
|
||||
}).AddTo(animator);
|
||||
if (!isManyCustomer)
|
||||
{
|
||||
SetPinkMove();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetPinkMove()
|
||||
|
|
@ -83,7 +103,7 @@ public class BrotherPinkView : MonoBehaviour
|
|||
var move = pinkMoves[moveIndex];
|
||||
wayPoint = move.wayPoint;
|
||||
completedDuration = move.wait;
|
||||
animator.SetTrigger(move.trigger);
|
||||
if (animator != null) animator.SetTrigger(move.trigger);
|
||||
if (Vector2.Distance(wayPoint, pinkTransform.localPosition.ToVector2()) < .01f)
|
||||
{
|
||||
// nop
|
||||
|
|
@ -99,14 +119,9 @@ public class BrotherPinkView : MonoBehaviour
|
|||
|
||||
private void SetTrigger(int id)
|
||||
{
|
||||
if (nextId == id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
nextId = id;
|
||||
if (isManyCustomer)
|
||||
{
|
||||
Debug.Log($"triggered");
|
||||
animator.SetTrigger(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,6 +322,20 @@ public class Market : SingletonMonoBehaviour<Market>
|
|||
}).AddTo(customerController);
|
||||
}
|
||||
}).AddTo(this);
|
||||
|
||||
// お客さんが少なくなったら弟が走る
|
||||
CustomerList.ObserveCountChanged(true).AsUnitObservable()
|
||||
.Merge(Observable.Interval(TimeSpan.FromSeconds(1f)).AsUnitObservable())
|
||||
.Where(_ => CurrentShopState.Value != ShopState.Close)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
var count = CustomerList.Count(c => c.State.Value == CustomerState.Wait || c.State.Value == CustomerState.Order);
|
||||
if (count < BrotherPinkView.Instance.FewerBorder)
|
||||
{
|
||||
Debug.Log($"market set walk");
|
||||
BrotherPinkView.Instance.SetWalk();
|
||||
}
|
||||
}).AddTo(this);
|
||||
}
|
||||
|
||||
// お客さん出現パターン確率計算と行動パターン計算
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class MarketManager : MonoBehaviour
|
|||
[SerializeField] private ShopStockView stockView;
|
||||
[SerializeField] private MarketCartView cartView;
|
||||
[SerializeField] private BrotherBlueView blueView;
|
||||
[SerializeField] private BrotherPinkView pinkView;
|
||||
[SerializeField] private Transform pinkTarget;
|
||||
[SerializeField] private Transform coinPrefab;
|
||||
[SerializeField] private Transform rootTransform;
|
||||
private Market market;
|
||||
|
|
@ -39,7 +39,7 @@ public class MarketManager : MonoBehaviour
|
|||
.ToList();
|
||||
cartView.Initialize();
|
||||
cartView.SetStock(startStocks, false);
|
||||
pinkView.Initialize();
|
||||
BrotherPinkView.Instance.SetBrotherView(pinkTarget);
|
||||
|
||||
// Customerの各アニメーション設定
|
||||
foreach (var controller in market.CustomerControllerList)
|
||||
|
|
@ -114,7 +114,7 @@ public class MarketManager : MonoBehaviour
|
|||
switch (state)
|
||||
{
|
||||
case ShopState.Open:
|
||||
pinkView.SetNormal();
|
||||
BrotherPinkView.Instance.SetNormal();
|
||||
closeSign.SetActive(false);
|
||||
break;
|
||||
case ShopState.Busy:
|
||||
|
|
@ -122,7 +122,7 @@ public class MarketManager : MonoBehaviour
|
|||
case ShopState.Close:
|
||||
if (market.CustomerList.Count(x => x.State.Value == CustomerState.Order) == 0)
|
||||
{
|
||||
pinkView.SetSleepy();
|
||||
BrotherPinkView.Instance.SetSleepy();
|
||||
closeSign.SetActive(true);
|
||||
}
|
||||
else
|
||||
|
|
@ -136,7 +136,7 @@ public class MarketManager : MonoBehaviour
|
|||
.Delay(TimeSpan.FromSeconds(2f))
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
pinkView.SetSleepy();
|
||||
BrotherPinkView.Instance.SetSleepy();
|
||||
closeSign.SetActive(true);
|
||||
}).AddTo(shopStateCompositeDisposable);
|
||||
}
|
||||
|
|
@ -145,19 +145,6 @@ public class MarketManager : MonoBehaviour
|
|||
throw new ArgumentOutOfRangeException(nameof(state), state, null);
|
||||
}
|
||||
}).AddTo(this);
|
||||
|
||||
// お客さんが少なくなったら弟が走る
|
||||
market.CustomerList.ObserveCountChanged(true).AsUnitObservable()
|
||||
.Merge(Observable.Interval(TimeSpan.FromSeconds(1f)).AsUnitObservable())
|
||||
.Where(_ => market.CurrentShopState.Value != ShopState.Close)
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
var count = market.CustomerList.Count(c => c.State.Value == CustomerState.Wait || c.State.Value == CustomerState.Order);
|
||||
if (count < pinkView.FewerBorder)
|
||||
{
|
||||
pinkView.SetWalk();
|
||||
}
|
||||
}).AddTo(this);
|
||||
}
|
||||
|
||||
private void CoinEffect(int count)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue