Example #1
0
    public virtual void Init(Vector3 spawnLocation, Map map, int level)
    {
        // init sr size values
        if (!overrideSrSize)
        {
            srSize = sr.bounds.size;
        }
        // init abilities
        InitAbilities();
        if (OnEnemyInit != null)
        {
            OnEnemyInit();
        }
        // init default values
        DEFAULT_LAYER = body.gameObject.layer;
        DEFAULT_SPEED = body.moveSpeed;

        this.level    = level;
        this.map      = map;
        maxHealth     = EnemyHealthEquation(level, baseHealth);      // calculate health based on level
        health        = maxHealth;
        deathPropPool = ObjectPooler.GetObjectPooler("DeathProp");   // instantiate set object pooler

        // init movement and action
        movementMethod.Init(this, player);
        action.Init(this, ToMoveState);

        Spawn(spawnLocation);
    }
Example #2
0
 public override void Init(Enemy e, OnActionStateChanged onActionFinished)
 {
     base.Init(e, onActionFinished);
     action.Init(e, onActionFinished);
 }