#146 Drink Order
This commit is contained in:
parent
997e582958
commit
4e06f1facc
@ -33,6 +33,7 @@ namespace BlueWaterProject
|
|||||||
public Sprite tomato;
|
public Sprite tomato;
|
||||||
public Sprite onion;
|
public Sprite onion;
|
||||||
public Sprite kingCrabMeat;
|
public Sprite kingCrabMeat;
|
||||||
|
public Sprite beer;
|
||||||
|
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using BehaviorDesigner.Runtime.Tasks.Unity.UnityGameObject;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
@ -7,8 +6,9 @@ namespace BlueWaterProject
|
|||||||
public class FoodOrderState : INpcState
|
public class FoodOrderState : INpcState
|
||||||
{
|
{
|
||||||
private TycoonNpc npc;
|
private TycoonNpc npc;
|
||||||
private float fillTime = 15f; // 15초 동안 채워짐
|
private float maxWaitTime = 30f; // 15초 동안 채워짐
|
||||||
private float elapsedTime = 0f; // 경과 시간
|
private float foodEt; // 음식 경과 시간
|
||||||
|
private float drinkEt; // 음료 경과 시간
|
||||||
|
|
||||||
public FoodOrderState(TycoonNpc npc)
|
public FoodOrderState(TycoonNpc npc)
|
||||||
{
|
{
|
||||||
@ -19,47 +19,72 @@ namespace BlueWaterProject
|
|||||||
{
|
{
|
||||||
npc.BarkImg.gameObject.SetActive(true);
|
npc.BarkImg.gameObject.SetActive(true);
|
||||||
npc.BarkFillImg.gameObject.SetActive(true);
|
npc.BarkFillImg.gameObject.SetActive(true);
|
||||||
|
npc.FoodImg.sprite = DataManager.Inst.beer;
|
||||||
npc.FoodImg.gameObject.SetActive(true);
|
npc.FoodImg.gameObject.SetActive(true);
|
||||||
|
|
||||||
elapsedTime = 0f;
|
foodEt = 0f;
|
||||||
|
drinkEt = 0f;
|
||||||
npc.IsGetFood = false;
|
npc.IsGetFood = false;
|
||||||
|
npc.IsGetDrink = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnUpdate(NpcStateMachine npcStateMachine)
|
public void OnUpdate(NpcStateMachine npcStateMachine)
|
||||||
{
|
{
|
||||||
if (elapsedTime < fillTime)
|
if (npc.IsGetDrink == false)
|
||||||
{
|
{
|
||||||
elapsedTime += Time.deltaTime;
|
if (drinkEt < maxWaitTime)
|
||||||
npc.BarkFillImg.fillAmount = Mathf.Clamp(elapsedTime / fillTime, 0, 1);
|
|
||||||
|
|
||||||
if (npc.IsGetFood)
|
|
||||||
{
|
{
|
||||||
|
drinkEt += Time.deltaTime;
|
||||||
|
npc.BarkFillImg.fillAmount = Mathf.Clamp(drinkEt / maxWaitTime, 0, 1);
|
||||||
|
if (npc.IsGetDrink)
|
||||||
|
{
|
||||||
|
npc.BarkImg.gameObject.SetActive(false);
|
||||||
|
npc.BarkFillImg.gameObject.SetActive(false);
|
||||||
|
npc.FoodImg.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
npcStateMachine.InstantiateUi(DataManager.Inst.emojiHeart, npc.EmojiTransform);
|
||||||
|
|
||||||
|
npc.BarkFillImg.fillAmount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (npc.IsGetDrink)
|
||||||
|
{
|
||||||
|
npc.FoodImg.sprite = DataManager.Inst.kingCrabMeat;
|
||||||
|
if (foodEt < maxWaitTime)
|
||||||
|
{
|
||||||
|
foodEt += Time.deltaTime;
|
||||||
|
npc.BarkFillImg.fillAmount = Mathf.Clamp(foodEt / maxWaitTime, 0, 1);
|
||||||
|
|
||||||
|
if (npc.IsGetFood)
|
||||||
|
{
|
||||||
|
npc.BarkImg.gameObject.SetActive(false);
|
||||||
|
npc.BarkFillImg.gameObject.SetActive(false);
|
||||||
|
npc.FoodImg.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
npcStateMachine.InstantiateUi(DataManager.Inst.emojiHeart, npc.EmojiTransform);
|
||||||
|
|
||||||
|
npc.AssignedSeat.IsUsing = false;
|
||||||
|
npc.AssignedSeat.IsDirty = true;
|
||||||
|
npc.DoSeat = false;
|
||||||
|
|
||||||
|
npcStateMachine.ChangeState(new PayState(npc));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (foodEt >= maxWaitTime)
|
||||||
|
{
|
||||||
|
npcStateMachine.InstantiateUi(DataManager.Inst.emojiAnger, npc.EmojiTransform);
|
||||||
|
|
||||||
npc.BarkImg.gameObject.SetActive(false);
|
npc.BarkImg.gameObject.SetActive(false);
|
||||||
npc.BarkFillImg.gameObject.SetActive(false);
|
npc.BarkFillImg.gameObject.SetActive(false);
|
||||||
npc.FoodImg.gameObject.SetActive(false);
|
npc.FoodImg.gameObject.SetActive(false);
|
||||||
|
|
||||||
npcStateMachine.InstantiateUi(DataManager.Inst.emojiHeart, npc.EmojiTransform);
|
|
||||||
|
|
||||||
npc.AssignedSeat.IsUsing = false;
|
|
||||||
npc.AssignedSeat.IsDirty = true;
|
|
||||||
npc.DoSeat = false;
|
|
||||||
|
|
||||||
npcStateMachine.ChangeState(new PayState(npc));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (elapsedTime >= fillTime)
|
|
||||||
{
|
|
||||||
npcStateMachine.InstantiateUi(DataManager.Inst.emojiAnger, npc.EmojiTransform);
|
|
||||||
|
|
||||||
npc.BarkImg.gameObject.SetActive(false);
|
|
||||||
npc.BarkFillImg.gameObject.SetActive(false);
|
|
||||||
npc.FoodImg.gameObject.SetActive(false);
|
|
||||||
|
|
||||||
npc.AssignedSeat.IsUsing = false;
|
npc.AssignedSeat.IsUsing = false;
|
||||||
npc.AssignedSeat.IsDirty = false;
|
npc.AssignedSeat.IsDirty = false;
|
||||||
npc.DoSeat = false;
|
npc.DoSeat = false;
|
||||||
|
|
||||||
npcStateMachine.ChangeState(new WalkOutSate(npc));
|
npcStateMachine.ChangeState(new WalkOutSate(npc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ namespace BlueWaterProject
|
|||||||
public Image FoodImg { get; set; }
|
public Image FoodImg { get; set; }
|
||||||
public Transform EmojiTransform { get; set; }
|
public Transform EmojiTransform { get; set; }
|
||||||
public bool IsGetFood { get; set; }
|
public bool IsGetFood { get; set; }
|
||||||
|
public bool IsGetDrink { get; set; }
|
||||||
|
|
||||||
[Title("PayState")]
|
[Title("PayState")]
|
||||||
public PayController PayController { get; set; }
|
public PayController PayController { get; set; }
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using BlueWaterProject.Type;
|
using BlueWaterProject.Type;
|
||||||
using PixelCrushers.DialogueSystem;
|
using PixelCrushers.DialogueSystem;
|
||||||
@ -167,14 +168,20 @@ namespace BlueWaterProject
|
|||||||
transform.position = position;
|
transform.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TakeFoodFromKitchen()
|
public void TakeKingCrab()
|
||||||
{
|
{
|
||||||
if (!foodTransform.gameObject.activeSelf)
|
if (foodTransform.gameObject.activeSelf) return;
|
||||||
{
|
foodVisual.sprite = DataManager.Inst.kingCrabMeat;
|
||||||
foodVisual.sprite = DataManager.Inst.kingCrabMeat;
|
foodTransform.gameObject.SetActive(true);
|
||||||
foodTransform.gameObject.SetActive(true);
|
foodOnHand = GlobalValue.FoodOnHand.KING_CRAB;
|
||||||
foodOnHand = GlobalValue.FoodOnHand.KING_CRAB;
|
}
|
||||||
}
|
|
||||||
|
public void TakeBeer()
|
||||||
|
{
|
||||||
|
if (foodTransform.gameObject.activeSelf) return;
|
||||||
|
foodVisual.sprite = DataManager.Inst.beer;
|
||||||
|
foodTransform.gameObject.SetActive(true);
|
||||||
|
foodOnHand = GlobalValue.FoodOnHand.BEER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TakeFoodFromPlayer()
|
public void TakeFoodFromPlayer()
|
||||||
@ -185,7 +192,29 @@ namespace BlueWaterProject
|
|||||||
var tycoonNpc = proximitySelector.CurrentUsable.gameObject.GetComponent<TycoonNpc>();
|
var tycoonNpc = proximitySelector.CurrentUsable.gameObject.GetComponent<TycoonNpc>();
|
||||||
if (tycoonNpc != null && tycoonNpc.DoSeat)
|
if (tycoonNpc != null && tycoonNpc.DoSeat)
|
||||||
{
|
{
|
||||||
tycoonNpc.IsGetFood = true;
|
switch (foodOnHand)
|
||||||
|
{
|
||||||
|
case GlobalValue.FoodOnHand.NONE:
|
||||||
|
break;
|
||||||
|
case GlobalValue.FoodOnHand.KING_CRAB:
|
||||||
|
case GlobalValue.FoodOnHand.JELLYFISH:
|
||||||
|
case GlobalValue.FoodOnHand.ONION:
|
||||||
|
case GlobalValue.FoodOnHand.TOMATO:
|
||||||
|
case GlobalValue.FoodOnHand.SCALLION:
|
||||||
|
case GlobalValue.FoodOnHand.CLAM:
|
||||||
|
case GlobalValue.FoodOnHand.SALT:
|
||||||
|
case GlobalValue.FoodOnHand.CHILI_POWDER:
|
||||||
|
case GlobalValue.FoodOnHand.DINOSAUR_EGG:
|
||||||
|
case GlobalValue.FoodOnHand.DINOSAUR_MEAT:
|
||||||
|
tycoonNpc.IsGetFood = true;
|
||||||
|
break;
|
||||||
|
case GlobalValue.FoodOnHand.BEER:
|
||||||
|
case GlobalValue.FoodOnHand.WINE:
|
||||||
|
tycoonNpc.IsGetDrink = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
foodTransform.gameObject.SetActive(false);
|
foodTransform.gameObject.SetActive(false);
|
||||||
foodOnHand = GlobalValue.FoodOnHand.NONE;
|
foodOnHand = GlobalValue.FoodOnHand.NONE;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,9 @@ namespace BlueWaterProject
|
|||||||
SALT,
|
SALT,
|
||||||
CHILI_POWDER,
|
CHILI_POWDER,
|
||||||
DINOSAUR_EGG,
|
DINOSAUR_EGG,
|
||||||
DINOSAUR_MEAT
|
DINOSAUR_MEAT,
|
||||||
|
BEER,
|
||||||
|
WINE
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum InIslandPlayerMode
|
public enum InIslandPlayerMode
|
||||||
|
Loading…
Reference in New Issue
Block a user