コード例 #1
0
        private VegetableView GetVegetable(Transform chef)
        {
            RaycastHit2D  hit       = Physics2D.Raycast(chef.position, Vector2.zero);
            VegetableView vegetable = null;

            if (hit.collider != null)
            {
                vegetable = hit.collider.GetComponent <VegetableView>();
            }

            return(vegetable);
        }
コード例 #2
0
 public override void DoActionUpdate(Actor actor, float deltaTime)
 {
     if (Input.GetKeyDown(((ChefActor)actor).chef.pActionKeyCode))
     {
         VegetableView vegetable = GetVegetable(((ChefActor)actor).chefTransform.value);
         if (vegetable)
         {
             ((ChefActor)actor).chef.isReadyToCollectVegetables.value = true;
             ((ChefActor)actor).chef.selectedVegetable = vegetable.gameObject;
             ((ChefActor)actor).chef.MoveToNextState();
         }
     }
 }