Example #1
0
    public void SentinelSpawn()
    {
        for (int i = 0; i < _sentinelAmount; i++)
        {
            BasicEnemy sentinel = _enemySpawner.basicEnemyPool.GetObject();
            sentinel.UnitDefiner(_enemySpawner.sentinel.myType);
            sentinel.BehaviourSetter(_enemySpawner.sentinel.behaviour.Clone());
            sentinel.SetSpawner(_enemySpawner);
            sentinel.SetHealth(_enemySpawner.sentinel.health);
            sentinel.SetCooldown(_enemySpawner.sentinel.maxCooldown);
            if (behaviour.changeMovementWrappers.Length > 0)
            {
                sentinel.StartCoroutine(ChangeMovement(0.4f, behaviour.changeMovementWrappers));
            }
            Vector3 pos;
            pos = new Vector3(transform.position.x + Mathf.Sin(i + 0.5f), transform.position.y + Mathf.Cos(i + 0.5f));
            sentinel.transform.position = pos;

            if (_enemySpawner.sentinel.behaviour.changeMovementWrappers.Length > 0)
            {
                sentinel.StartCoroutine(sentinel.ChangeMovement(_enemySpawner.sentinel.movementTimeToChange, behaviour.changeMovementWrappers));
            }
        }
    }