示例#1
0
    void SpawnEnemy(EnemyAttributes e, Vector3 l)
    {
        e.bonus.BonusSetter();
        BasicEnemy basicEnemy = _spawner.basicEnemyPool.GetObject();

        basicEnemy.UnitDefiner(e.myType);
        basicEnemy.SetPowerAmount(e.power).SetHealth(e.health).SetCooldown(e.maxCooldown).SetSpawner(_spawner).SetSetinelAmount(e.sentinelAmount).BonusSetter(e.bonus.bonus).SetPointAmount(e.pointAmount).SetLocation(l);
        basicEnemy.movementOptions.Clear();
        basicEnemy.behaviour = e.behaviour.Clone();
        basicEnemy.behaviour.TargetSetter(basicEnemy._model.transform.position);

        if (e.sentinelAmount > 0)
        {
            basicEnemy.SentinelSpawn();
        }

        if (e.behaviour.changeMovementWrappers.Length > 0)
        {
            basicEnemy.StartCoroutine(basicEnemy.ChangeMovement(e.movementTimeToChange, e.behaviour.changeMovementWrappers));
        }
    }
示例#2
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));
            }
        }
    }