Ejemplo n.º 1
0
        /* This is the AI Brain, it knows its state and its behaviour tree and chooses an action depending on it */

        //private readonly Subject<CharacterAction> onActionSelectedObservable = new Subject<CharacterAction>();
        //public IObservable<CharacterAction> OnActionSelectedObservable { get { return onActionSelectedObservable; } }


        public AIActionSelector(EnemyActor actor)
        {
            this.actor = actor;
            this.state = AIState.Default;

            this.patrouille = actor.GetComponent <PatrouilleBehaviour>();
        }
Ejemplo n.º 2
0
    private void SpawnEnemy(EnemyWaveItem enemyWaveItem, Dictionary <BonusType, StatBonus> bonuses, RarityType rarity)
    {
        EnemyBase enemyBase = ResourceManager.Instance.GetEnemyBase(enemyWaveItem.enemyName);
        Spawner   spawner   = SpawnerList[enemyWaveItem.spawnerIndex];

        EnemyActor enemy = EnemyPool.GetEnemy(spawner.transform);

        enemy.ParentSpawner = spawner;
        Vector3 positionOffset = new Vector3(Random.Range(-0.4f, 0.4f), Random.Range(-0.4f, 0.4f), 0);

        //Vector3 positionOffset = new Vector3(-0.5f, -0.5f, 0);
        enemy.positionOffset = positionOffset;
        enemy.rotatedOffset  = positionOffset;

        if (enemyBase.isBoss || enemyWaveItem.isBossOverride)
        {
            enemy.isBoss = true;
        }
        else
        {
            enemy.isBoss = false;
        }

        Sprite enemySprite = ResourceManager.Instance.GetEnemySprite(enemyBase.idName);

        if (enemySprite != null)
        {
            enemy.GetComponent <SpriteRenderer>().sprite = enemySprite;
        }
        else
        {
            Debug.Log("Could not find sprite: " + enemyBase.idName);
        }

        enemy.SetBase(enemyBase, rarity, stageInfo.monsterLevel + survivalLoopCount);

        //Set bonuses from wave
        enemy.Data.SetMobBonuses(bonuses);

        enemy.Init(enemyWaveItem.goalIndex);

        currentEnemyList.Add(enemy);
        enemiesSpawned++;
    }