Esempio n. 1
0
 private BTNode.NodeStates GoToMine()
 {
     BTNode.NodeStates state = BTNode.NodeStates.Running;
     GetPathTo(mine.gameObject);
     MoveOnPath();
     if (DestinationReached(mine.transform.position) || pathToWalk.Count == 0)
     {
         fsm.SendEvent((int)Events.MineReached);
         rd.velocity = Vector2.zero;
         state       = BTNode.NodeStates.Success;
     }
     return(state);
 }
Esempio n. 2
0
 private BTNode.NodeStates Mining()
 {
     BTNode.NodeStates state = BTNode.NodeStates.Running;
     miningTimer += Time.deltaTime;
     if (miningTimer >= miningTime)
     {
         miningTimer = 0;
         goldInHands = mine.MineGold(mineAmount);
         fsm.SendEvent((int)Events.MiningTimeOut);
         handsEmpty = false;
         state      = BTNode.NodeStates.Success;
     }
     return(state);
 }
Esempio n. 3
0
 private BTNode.NodeStates DepositGold()
 {
     BTNode.NodeStates state = BTNode.NodeStates.Running;
     depositTimer += Time.deltaTime;
     if (depositTimer >= depositTime)
     {
         town.DepositGold(goldInHands);
         depositTimer = 0;
         goldInHands  = 0;
         handsEmpty   = true;
         fsm.SendEvent((int)Events.GoldDeposited);
         state = BTNode.NodeStates.Success;
     }
     return(state);
 }