Ejemplo n.º 1
0
    /// <summary>
    /// Shows the teleport star effect
    /// 2017-10-31: copied from PlayerController.showTeleportStar()
    /// </summary>
    /// <param name="pos"></param>
    public static void showTeleportStar(Vector3 pos)
    {
        TeleportStarUpdater chosenTSU = null;

        //Find existing particle system
        foreach (TeleportStarUpdater tsu in instance.teleportStarList)
        {
            if (tsu != null && !tsu.TurnedOn)
            {
                chosenTSU = tsu;
                break;
            }
        }
        //Else make a new one
        if (chosenTSU == null)
        {
            GameObject newTS = GameObject.Instantiate(instance.teleportStarPrefab);
            newTS.transform.parent = instance.transform;
            TeleportStarUpdater newTSU = newTS.GetComponent <TeleportStarUpdater>();
            newTSU.init();
            newTSU.duration  = instance.teleportStarDuration;
            newTSU.baseColor = instance.teleportStarColor;
            instance.teleportStarList.Add(newTSU);
            chosenTSU = newTSU;
        }
        //Set values
        chosenTSU.position(pos);
        chosenTSU.TurnedOn = true;
    }
Ejemplo n.º 2
0
 protected void sparkle()
 {//2016-03-17: copied from PlayerController.showTeleportStar(..)
     for (int i = 0; i < starAmount; i++)
     {
         GameObject          newTS = (GameObject)Instantiate(particle);
         TeleportStarUpdater tsu   = newTS.GetComponent <TeleportStarUpdater>();
         tsu.start    = new Vector3(Random.Range(minX, maxX), Random.Range(minY, maxY));
         tsu.waitTime = i * (starAmount / starSpawnDuration);
         tsu.position();
         tsu.turnOn(true);
     }
 }