示例#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);
 }