コード例 #1
0
 protected virtual void Start()
 {
     gm = GMS.instance;
     gm.SetManager(this);
     _menuDict = new Dictionary <string, MenuObjectMap>();
     foreach (MenuObjectMap mom in menuObjects)
     {
         _menuDict[mom.name] = mom;
         ShowMenu(mom.active, mom.name);
     }
     currentCamera = Camera.main;
 }
コード例 #2
0
        protected virtual void Awake()
        {
            GameManager g = GameObject.FindObjectOfType <GameManager>();

            if (g != this) //already a game manager here. destroy ourselves.
            {
                GameObject.Destroy(this.gameObject);
            }
            else //we are the first
            {
                gm = GameObject.FindObjectOfType <GMS>();
                if (gm == null)
                {
                    Instantiate(gameManagerSingletonPrefab);
                    gm = GMS.instance;
                }
                DontDestroyOnLoad(this);
            }
        }