public void ForcePush(int dir) { if (entity == null) { return; } if (entity.tag == "Enemy") { BasicEnemyAI enemyAI = entity.GetComponent <BasicEnemyAI>(); enemyAI.IsStunned = true; if (enemyAI.gridCell.cellNeighbours[dir] != null && enemyAI.gridCell.cellNeighbours[dir].entity == null) { //enemyAI.gridCell.cellNeighbours[dir].ForcePush(dir); enemyAI.IsStunned = true; Walkable = true; entity = null; enemyAI.gridCell = enemyAI.gridCell.cellNeighbours[dir]; } else { enemyAI.Die(VisualInfo.deathExpansionRatio);//h } } }
// Use this for initialization void Start() { aiController = this.GetComponentInParent <BasicEnemyAI>(); }
BasicEnemyAI enemy; // Reference to enemy /*--------------------------------------------------------------------------------------*/ /* */ /* Start: Runs once at the begining of the game. Initalizes variables. */ /* */ /*--------------------------------------------------------------------------------------*/ void Start() { enemy = GetComponentInChildren <BasicEnemyAI> (); }
// Use this for initialization void Start() { ai = gameObject.GetComponentInParent <BasicEnemyAI> (); }