예제 #1
0
        public void ApplyUse(IInteractionComponent interactor)
        {
            switch (state)
            {
            case States.None:
                if (interactor.CurrentItem is Cup c && !c.HasCoffee)
                {
                    state = States.Operating;
                    TakeCup((Cup)interactor.RemoveItem());
                    GameManager.Gameplay.DisablePlayerInput();
                }
                break;

            case States.Ready:
                if (interactor.ReceiveItem(heldCup))
                {
                    heldCup.gameObject.SetActive(true);
                    heldCup.AddCoffee(true);
                    cupVisual.gameObject.SetActive(false);
                    heldCup = null;
                    state   = States.None;
                }
                break;
            }
        }
예제 #2
0
 private void TakeCup(Cup c)
 {
     heldCup = c;
     heldCup.transform.SetParent(cupPlacementPoint);
     heldCup.gameObject.SetActive(false);
     cupVisual.gameObject.SetActive(true);
 }
예제 #3
0
 public override void ResetState()
 {
     if (heldCup != null)
     {
         heldCup.Destroy();
         heldCup = null;
     }
     cupVisual.ResetState();
     cupVisual.gameObject.SetActive(false);
 }