コード例 #1
0
 void Update()
 {
     mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
     MovingCameraInHouse();
     if (Input.GetMouseButtonDown(0))
     {
         if (Physics.Raycast(mouseRay, out selection, 200f, canSelect))
         {
             IInteracting interacting = selection.transform.GetComponent <IInteracting>();
             if (interacting != null)
             {
                 interacting.Interacting();
             }
         }
         else
         {
             HoldingObjectManager.Instance().EmptyHands();
         }
     }
     if (Input.GetKeyDown(KeyCode.H))
     {
         SeedBagManager.AddSeeds(startingSeed);
     }
     if (Input.GetKeyDown(KeyCode.G))
     {
         SeedBagManager.AddSeeds(startingSeed2);
     }
 }
コード例 #2
0
 private void Awake()
 {
     instance    = this;
     seedsAmount = new Text[seedsShown.Length];
     for (int i = 0; i < seedsAmount.Length; i++)
     {
         seedsAmount[i] = seedsShown[i].transform.GetChild(0).GetComponent <Text>();
     }
     UpdateSeeds();
 }
コード例 #3
0
        public void EmptyHands()
        {
            switch (holding)
            {
            case ObjectInHands.Seed:
                SeedBagManager.ResetSelectedSeed();
                break;

            case ObjectInHands.WaterCan:
                break;

            case ObjectInHands.Hoe:
                break;

            case ObjectInHands.Empty:
                break;

            default:
                break;
            }
            holding = ObjectInHands.Empty;
        }
コード例 #4
0
 void Update()
 {
     mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
     if (Input.GetKeyDown(KeyCode.A))
     {
         SeedBagManager.AddSeeds(startingSeed);
     }
     if (Input.GetKeyDown(KeyCode.S))
     {
         startingSeed = null;
     }
     if (Input.GetMouseButtonDown(0))
     {
         if (Physics.Raycast(mouseRay, out selection, 200f, canSelect))
         {
             IInteracting interacting = selection.transform.GetComponent <IInteracting>();
             if (interacting != null)
             {
                 interacting.Interacting();
             }
         }
     }
 }