Beispiel #1
0
        public EGFiretruck GetClosestIdleTruck(Vector3 pos)
        {
            EGFiretruck closest      = null;
            float       shortestDist = -1;

            for (int i = 0; i < _idleTrucks.Count; i++)
            {
                EGFiretruck truck = _idleTrucks[i];
                float       dist  = Vector3.Distance(truck.transform.position, pos);
                if (closest == null)
                {
                    closest      = truck;
                    shortestDist = dist;
                }
                else if (dist < shortestDist)
                {
                    closest      = truck;
                    shortestDist = dist;
                }
            }

            if (closest != null)
            {
                _idleTrucks.Remove(closest);
            }

            return(closest);
        }
Beispiel #2
0
        void Start()
        {
            truck = transform.root.gameObject.GetComponent <EGFiretruck> ();
            //set the tile size of the texture (in UV units), based on the rows and columns
            Vector2 size = new Vector2(1f / UnifiedAnimator.FLAME_COLUMNS, 1f / NUM_STATES);

            GetComponent <Renderer>().sharedMaterial.SetTextureScale("_MainTex", size);
        }
Beispiel #3
0
 public void RemoveTruck(EGFiretruck truck)
 {
     if (_idleTrucks.Contains(truck))
     {
         _idleTrucks.Remove(truck);
     }
     else if (_activeTrucks.Contains(truck))
     {
         _activeTrucks.Remove(truck);
     }
 }
Beispiel #4
0
        public EGFiretruck GetActiveTruckAtIndex(int index)
        {
            EGFiretruck truck = null;

            if (index >= 0 && index < _activeTrucks.Count)
            {
                truck = _activeTrucks[index];
            }

            return(truck);
        }
Beispiel #5
0
 void HandleTouchTruckStart(RaycastHit hitInfo)
 {
     if (hitInfo.transform.gameObject.tag.Equals("Truck"))
     {
         EGFiretruck truck = hitInfo.transform.root.gameObject.GetComponent <EGFiretruck> ();
         if (truck != null)
         {
             _dispatcher.SetSelectedTruck(truck);
         }
     }
 }
Beispiel #6
0
        public EGFiretruck PopIdleTruck()
        {
            EGFiretruck poppedTruck = null;

            if (_idleTrucks.Count > 0)
            {
                poppedTruck = _idleTrucks[0];
                _idleTrucks.Remove(poppedTruck);
            }

            return(poppedTruck);
        }
Beispiel #7
0
        void HandleTouchTruckEnded(RaycastHit hitInfo)
        {
            singleTouchDown = false;
            dragging        = false;

            if (hitInfo.transform.gameObject.tag.Equals("Truck"))
            {
                EGFiretruck truck = hitInfo.transform.root.gameObject.GetComponent <EGFiretruck> ();
                if (truck != null)
                {
                    _dispatcher.SetSelectedTruck(truck);
                }
            }
        }
Beispiel #8
0
 public void RemoveActiveTruck(EGFiretruck truck)
 {
     _activeTrucks.Remove(truck);
 }
Beispiel #9
0
 public void RemoveIdleTruck(EGFiretruck truck)
 {
     _idleTrucks.Remove(truck);
 }
Beispiel #10
0
 public void AddActiveTruck(EGFiretruck truck)
 {
     _activeTrucks.Add(truck);
 }
Beispiel #11
0
 public void AddIdleTruck(EGFiretruck truck)
 {
     _idleTrucks.Add(truck);
 }