private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Beispiel #2
0
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        enemies = new List <Enemy>();
        DontDestroyOnLoad(gameObject);
        boardScript = GetComponent <BoardManager>();
        InitGame();
    }
Beispiel #3
0
    void Start()
    {
        _Single = this;
        foreach (Transform t in allObj)
        {
            var c = t.GetComponent <Character>();
            if (c != null)
            {
                all.Add(c);
            }
        }

        AllCount = all.Count(e => e.needToCount);
        UpdateCountUI();

        playerCamera.gameObject.SetActive(true);
    }