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