コード例 #1
0
 private void Awake()
 {
     // Singleton
     if (DNInstance == null)
     {
         DNInstance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
コード例 #2
0
    private void Start()
    {
        myGameManager      = FindObjectOfType <GameManager>();
        myDifficultyNumber = FindObjectOfType <DifficultyNumber>();

        // find instructionsGO and set it to false
        instructionsGO = GameObject.FindGameObjectWithTag("Instructions");
        InstructionsOff();
        instructionsGO.SetActive(false);

        // find difficultyGO and set it to false
        if (GameObject.FindGameObjectWithTag("Difficulty") != null)
        {
            difficulyGO = GameObject.FindGameObjectWithTag("Difficulty");
            difficulyGO.SetActive(false);
        }
    }
コード例 #3
0
//// Singleton
//    public static GameManager GMInstance { get; private set; }

    private void Awake()
    {
        //// Singleton
        //if (GMInstance  == null)
        //{
        //    GMInstance = this;
        //    DontDestroyOnLoad(gameObject);
        //}
        //else
        //{
        //    Destroy(gameObject);
        //}

        myDepotManager     = FindObjectOfType <DepotManager>();
        myDifficultyNumber = FindObjectOfType <DifficultyNumber>();
        isDifficultySet    = false;
        // Debug.Log($"Diffculty started with: {difficultySetting}");
    }
コード例 #4
0
    private void Awake()
    {
        myGameManger = FindObjectOfType <GameManager>();


        myDifficultyNumber = FindObjectOfType <DifficultyNumber>();
        if (myDifficultyNumber.difficultyNo == 1)
        {
            myGameManger.difficultySetting = GameManager.DifficultySetting.EASY;
        }
        else if (myDifficultyNumber.difficultyNo == 2)
        {
            myGameManger.difficultySetting = GameManager.DifficultySetting.MEDIUM;
        }
        else if (myDifficultyNumber.difficultyNo == 3)
        {
            myGameManger.difficultySetting = GameManager.DifficultySetting.HARD;
        }
        else
        {
            myGameManger.difficultySetting = GameManager.DifficultySetting.MEDIUM;
        }
    }