Пример #1
0
        /*public void SpawnMinions()
         * {
         *  StartCoroutine(SpawnMinionsRoutine());
         * }
         *
         * public IEnumerator SpawnMinionsRoutine()
         * {
         *  yield return new WaitForSeconds(InitialDelay);
         *  SpawnMinion();
         * }*/

        public void SpawnMinion()
        {
            Vector3 SpawnPosition = Camera.main.ScreenPointToRay(Input.mousePosition).origin;

            SpawnPosition.z = 0;
            GameObject MySpawn = Instantiate(CharacterPrefab, GetRandomPosition(), Quaternion.identity, transform);

            MapData.Instance.SpawnedCharacters.Add(MySpawn);
            Spawns.Add(MySpawn);
            Character2D MyCharacter = MySpawn.GetComponent <Character2D>();

            MyCharacter.SetLevel(SpawnLevel);
        }
Пример #2
0
        public void SpawnBossMinion()
        {
            Vector3 SpawnPosition = Camera.main.ScreenPointToRay(Input.mousePosition).origin;

            SpawnPosition.z = 0;
            GameObject MySpawn = Instantiate(CharacterPrefab, GetRandomPosition(), Quaternion.identity, transform);

            MapData.Instance.SpawnedCharacters.Add(MySpawn);
            Spawns.Add(MySpawn);
            Character2D MyCharacter = MySpawn.GetComponent <Character2D>();

            MyCharacter.SetLevel(Mathf.RoundToInt(SpawnLevel * MaxMinionsToSpawn * 4f));
            MyCharacter.SetSize(2.5f);
            MyCharacter.SetMovementSpeed(0.5f);
            Generators.TextureGenerator MyGenerator = MySpawn.transform.GetChild(0).GetComponent <Generators.TextureGenerator>();
            MyGenerator.IsAddOutline = true;
            if (MyGenerator.HasStarted)
            {
                Debug.LogError("Regenerating boss sprite.");
                MyGenerator.GenerateSprite();
            }
        }