Пример #1
0
 void OnTriggerEnter(Collider other)
 {
     if (!transform.parent.Equals(other.transform.parent) &&
         other.gameObject.tag.Equals("Truck"))
     {
         EGFiretruck otherTruck   = other.transform.root.gameObject.GetComponent <EGFiretruck>();
         Vector3     closestPoint = other.ClosestPointOnBounds(truck.GetPosition());
         if (otherTruck != null)
         {
             truck.addOtherTruck(other.transform.root.gameObject, closestPoint);
         }
     }
 }
Пример #2
0
        public void SendTruckToTile(EGFiretruck truckToSend, int x, int y)
        {
            TDPath truckPath = new TDPath();
            TDMap  dataMap   = _map.Map;

            truckPath.BuildPath(dataMap,
                                dataMap.GetTile(Mathf.FloorToInt(truckToSend.GetPosition().x), Mathf.FloorToInt(-truckToSend.GetPosition().z)),
                                dataMap.GetTile(x, y));
            truckToSend.SetPath(truckPath);
            truckToSend.SetIdle(false);

            _dispatcher.AddActiveTruck(truckToSend);
        }