Exemplo n.º 1
0
 void builMinion()
 {
     chest.DropResource(ResourceType.MEAT, meatNeed);
     chest.DropResource(ResourceType.ROCK, rockNeed);
     chest.DropResource(ResourceType.WOOD, woodNeed);
     chest.DropResource(ResourceType.WATER, waterNeed);
     Instantiate(bot, particle.transform.position, transform.rotation);
 }
Exemplo n.º 2
0
 void Pose()
 {
     UIText.text     = "Moving to the chest...";
     nav.destination = chest.gameObject.transform.position;
     if (Vector2.Distance(transform.position, nav.destination) <= actionDist)
     {
         anim.SetTrigger("Action");
         UIText.text = "Cleaning inventory";
         chest.AddResource(ResourceType.MEAT, inventory.DropResource(ResourceType.MEAT, inventory.GetInventoryValue(ResourceType.MEAT)));
         chest.AddResource(ResourceType.ROCK, inventory.DropResource(ResourceType.ROCK, inventory.GetInventoryValue(ResourceType.ROCK)));
         chest.AddResource(ResourceType.WATER, inventory.DropResource(ResourceType.WATER, inventory.GetInventoryValue(ResourceType.WATER)));
         chest.AddResource(ResourceType.WOOD, inventory.DropResource(ResourceType.WOOD, inventory.GetInventoryValue(ResourceType.WOOD)));
         currentState = defaultState;
         Debug.Log("POSE -> " + defaultState.ToString());
     }
 }
Exemplo n.º 3
0
 void Take()
 {
     nav.destination = chestPosition;
     if (Vector2.Distance(transform.position, nav.destination) <= actionDist)
     {
         UIText.text = "Looking for resources...";
         anim.SetTrigger("Action");
         int c = chest.DropResource(currentMining, inventory.maxCapacity);
         chest.AddResource(currentMining, inventory.AddResource(currentMining, c));
         if (inventory.GetInventoryValue(currentMining) >= currentNeed)
         {
             UIText.text           = "FAIL : not enought material";
             targetPattern.choosen = false;
             oldPattern            = targetPattern;
             currentState          = defaultState;
             Debug.Log("TAKE -> " + defaultState.ToString());
         }
         else
         {
             UIText.text  = "Can't carry more material";
             currentState = State.POSE;
             Debug.Log("TAKE -> POSE");
         }
     }
 }
Exemplo n.º 4
0
 void Take()
 {
     nav.destination = chestPosition;
     if (Vector3.Distance(transform.position, nav.destination) <= actionDist)
     {
         Debug.Log("Prendre : Recherche dans le coffre");
         int c = chest.DropResource(currentMining, currentNeed);
         inventory.AddResource(currentMining, c);
         if (inventory.GetInventoryValue(currentMining) < currentNeed)
         {
             Debug.Log("Prendre : Pas assez de ressources dans le coffre");
             currentState = State.MINE;
             Debug.Log("Prendre -> Minage");
         }
         if (inventory.IsFull)
         {
             Debug.Log("Prendre : Inventaire plein");
             currentState = State.POSE;
             Debug.Log("Prendre -> Poser");
         }
     }
 }