Esempio n. 1
0
    void InitializePedestals()
    {
        //if we find pedestals on the scene sort them by priority index
        if (pedestals.Count == 0)
        {
            var allPedestals  = FindObjectsOfType <PedestalController>().ToList();
            int maxIterations = allPedestals.Count;

            for (int i = 0; i < maxIterations; i++)
            {
                PedestalController itemToadd = null;
                int minIndex = int.MaxValue;

                foreach (PedestalController item in allPedestals)
                {
                    if (item.pedestalID <= minIndex)
                    {
                        itemToadd = item;
                        minIndex  = item.pedestalID;
                    }
                }
                pedestals.Add(itemToadd.gameObject);
                allPedestals.Remove(itemToadd);
            }
        }
    }
 public void OnTriggerExit(Collider other)
 {
     if (other.GetComponent <EmitterController>() && other.GetComponent <EmitterController>().canBePickedUp)
     {
         nearbyObjects.Remove(other.gameObject);
     }
     else if (other.GetComponent <PedestalController>())
     {
         nearbyPedestal = null;
     }
 }
 public void OnTriggerEnter(Collider other)
 {
     if (other.GetComponent <EmitterController>() && other.GetComponent <EmitterController>().canBePickedUp)
     {
         nearbyObjects.Add(other.gameObject);
         //UI.PlayClip("wilhelm");
     }
     else if (other.GetComponent <PedestalController>())
     {
         nearbyPedestal = other.GetComponent <PedestalController>();
         //checking for applying a ui sound
         if (heldEmitter && nearbyPedestal && nearbyPedestal.Contains(heldEmitter))
         {
             UI.PlayClip("EnterDropoffRange");
         }
     }
 }