コード例 #1
0
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     else if (_instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
コード例 #2
0
ファイル: HeroesFactory.cs プロジェクト: Lulubul/HCI
        // Use this for initialization
        void Start()
        {
            Screen.orientation = ScreenOrientation.LandscapeLeft;
            HeroSelection selection = FindObjectOfType <HeroSelection>();

            if (selection != null)
            {
                Hero selectedHero = (Hero)Enum.Parse(typeof(Hero), selection.SelectedHero, true);
                switch (selectedHero)
                {
                case Hero.Barbarian:
                    CurrentHero = Barbarian;
                    break;

                case Hero.Aname:
                    CurrentHero = Aname;
                    break;

                case Hero.Chan:
                    CurrentHero = Chan;
                    break;

                case Hero.Jack:
                    CurrentHero = Jack;
                    break;

                case Hero.John:
                    CurrentHero = John;
                    break;

                case Hero.Josh:
                    CurrentHero = Josh;
                    break;
                }
                CurrentHero.SetActive(true);
            }
            SpawnEnemy();
        }