Exemplo n.º 1
0
    private void SpawnObj(Tags tag)
    {
        Vector2 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        pos.x = 17;
        CachedObjectPooler.SpawnObject((int)tag, pos, Quaternion.identity);
    }
Exemplo n.º 2
0
    void Update()
    {
        StartCoroutine(CheckEnemiesAtScene());

        if (Time.time > _nextAttack && _hasActiveEnemies)
        {
            _nextAttack = Time.time + _attackRate;
            CachedObjectPooler.SpawnObject((int)Tags.Arrow, transform.position, transform.rotation);
        }
    }
Exemplo n.º 3
0
        IEnumerator SpawnArrow()
        {
            yield return(new WaitForSeconds(.5f));

            for (int i = 0; i < CachedGameController.ArrowCounter; i++)
            {
                CachedObjectPooler.SpawnObject((int)Tags.Arrow, transform.position, transform.rotation);
            }
            yield return(null);
        }
Exemplo n.º 4
0
        private IEnumerator SpawnWawes(float startDelay)
        {
            EndWave = false;
            yield return(new WaitForSeconds(startDelay));

            for (int i = 0; i < EnemiesCount; i++)
            {
                Vector2    spawnPosition = new Vector2(16.25f, Random.Range(-2.6f, 4.5f));
                Quaternion spawnRotation = Quaternion.identity;
                CachedObjectPooler.SpawnObject((int)Tags.Enemy, spawnPosition, spawnRotation);
                yield return(new WaitForSeconds(_spawnWait));
            }
        }
Exemplo n.º 5
0
        protected IEnumerator SpawnDefender()
        {
            if (_statManager.WaterLevel == 10 && _spawnDefender != 1)
            {
                CachedObjectPooler.SpawnObject((int)Tags.Defender, new Vector2(-12.1f, -3.1f), Quaternion.identity);
                _spawnDefender++;
            }

            if (_statManager.WaterLevel == 20 && _spawnDefender != 2)
            {
                CachedObjectPooler.SpawnObject((int)Tags.Defender, new Vector2(-12.1f, 4.7f), Quaternion.identity);
                _spawnDefender++;
            }

            yield return(null);
        }