public void Start()
    {
        //Get a reference to the Seeker component we added earlier
        seeker = GetComponent<Seeker>();
        //OnPathComplete will be called every time a path is returned to this seeker
        seeker.pathCallback += OnPathComplete;
        //Generating random position
        genCompRandomPos();
        //Starting path from transform.position to targetPosition
        seeker.StartPath(transform.position, targetPosition);

        hub = GameObject.FindWithTag("Hub").GetComponent<Hub>();
        gameSpeed = hub.gameSpeed;
        agent = GetComponent<ReactiveFireFighter>();

    }
Example #2
0
 //fireParticipants.Add(scrpt);
 void checkFireRefill(ReactiveFireFighter newParticipant)
 {
     //DO WE NEED WATER?
     if (needtoGetWater(newParticipant.currentWater))
     {
         fireParticipants.Add(newParticipant);
         //Debug.Log("Need to help!");
         //GRAB ONE AND ORDER HIM TO GET WATER
         ReactiveFireFighter scrpt = sendFigtherWithLessWaterToGetWater();
         if (scrpt == null)
         {
             newParticipant.helpWithFire(fire);
             return;
         }
         else if (scrpt.helping != newParticipant.helping)
         {
             newParticipant.helpWithFire(fire);
             return;
         }
         fireParticipants.Remove(scrpt);
         scrpt.goGetWater();
     }
     else
     {
         if (needHelp())
         {
             //Debug.Log("Theres no need to get water");
             fireParticipants.Add(newParticipant);
             newParticipant.helpWithFire(fire);
         }
     }
 }