Exemplo n.º 1
0
    public void StartEditor()
    {
        m_PropList = new PropList();
        m_PropList.Initialize();

        m_EnemyList = new EnemyList();
        m_EnemyList.Initialize();
    }
Exemplo n.º 2
0
        // Start is called before the first frame update
        void Start()
        {
            #region Singleton, é isso

            if (instance == null)
            {
                instance = this;
            }
            else
            {
                Destroy(gameObject);
            }

            #endregion

            Application.targetFrameRate = 144;

            IsFile = true;


            //ISSO VAI PRA INPUT

            try
            {
#if UNITY_ANDROID
                WWW reader = new WWW(Application.streamingAssetsPath + @"\Levels\Level_" + sceneFile + ".json");
                while (!reader.isDone)
                {
                }
                sceneArgs = JsonUtility.FromJson <SceneArgs>(reader.text);
#endif


#if UNITY_STANDALONE
                _level = _levelList[_levelID];

                var Joystick1 = GameObject.Find("LookJoystick");
                var Joystick2 = GameObject.Find("MoveJoystick");
                Joystick1.SetActive(false);
                Joystick2.SetActive(false);
#endif
            }
            catch (Exception e)
            {
                Debug.LogError(e);
                var errorObj = GameObject.CreatePrimitive(PrimitiveType.Quad);
                errorObj.transform.position = Player.transform.position;
            }

            enemySpawnCount = new EnemyObjectDictionary();
            for (int i = 0; i < _level.LevelConfig.Count; i++)
            {
                for (int j = 0; j < _level.LevelConfig[i].enemies.Count; j++)
                {
                    var enemy = _level.LevelConfig[i].enemies[j].enemyType;
                    if (enemy == EnemyType.SPINNER)
                    {
                        continue;
                    }
                    if (!enemySpawnCount.ContainsKey((int)enemy))
                    {
                        enemySpawnCount.Add((int)enemy, 0);
                    }
                    enemySpawnCount[(int)enemy]++;
                }
            }

            spawned = new EnemyObjectDictionary();

            _enemyTypes.Initialize();

            foreach (var enemyType in _enemyTypes.Keys)
            {
                spawned.Add((int)enemyType, 0);
            }

            //VAI PRA AUDIO


            enemyAlive = new List <GameObject>();



            StartCoroutine(SpawnPowerUp());
            StartCoroutine(CheckEndGame());
        }