Example #1
0
 void Awake()
 {
     // Scene transition protection for singleton
     if (_instance == null)
     {
         //If I am the first instance, make me the Singleton
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         //If a Singleton already exists and you find
         //another reference in scene, destroy it!
         if (this != _instance)
         {
             Destroy(this.gameObject);
         }
     }
     camera = GetComponent <Camera>();
     allTargets.Clear();
     GameObject[] objs = GameObject.FindGameObjectsWithTag("Player");
     foreach (GameObject obj in objs)
     {
         allTargets.Add(obj.transform);
     }
     Invoke("ZoomIn", 0.1f);
     Invoke("ZoomOut", 2);
     Invoke("ZoomIn", 3);
     Invoke("ZoomOut", 5);
     Invoke("ZoomIn", 6);
     Invoke("ZoomOut", 8);
     Invoke("ZoomIn", 9);
     Invoke("ZoomDone", 11);
 }
Example #2
0
    void Awake()
    {
        // Scene transition protection for singleton
        if (_instance == null)
        {
            //If I am the first instance, make me the Singleton
            _instance = this;
            DontDestroyOnLoad(this);
        }
        else
        {
            //If a Singleton already exists and you find
            //another reference in scene, destroy it!
            if (this != _instance)
            {
                Destroy(this.gameObject);
            }
        }

        Invoke("UpdateAllTarget", 0.1f);
    }