protected override void OnCantMove <T>(T component) { try { MoveWall disWall = component as MoveWall; disWall.AttemptMoveWall(horizontal, vertical); GameManager.instance.playersTurn = false; } catch (Exception) {} try { BreakWall hitWall = component as BreakWall; hitWall.DamageWall(); GameManager.instance.playersTurn = false; } catch (Exception) { } try { Enemy enemy = component as Enemy; enemy.DamageEnemy(); GameManager.instance.playersTurn = false; } catch (Exception) { } food--; SoundManager.instance.RandomizeSfx(chopSound1, chopSound2); foodText.text = "energy: " + food; animator.SetTrigger("PlatoAttack"); }
public EnemyDecisionTree(Enemy agent) { advance = new Advance(agent); breakWall = new BreakWall(agent); attack = new Attack(agent); defend = new Defend(agent); wallInWay = new BooleanDecision(breakWall, advance); defenderAttacking = new BooleanDecision(defend, attack); defenseInRange = new BooleanDecision(defenderAttacking, wallInWay); start = defenseInRange; }
Advance advance; // move towards next target #endregion /// <param name="agent">the agent to act upon</param> public EnemyDecisionTree(BasicEnemy agent) { advance = new Advance(agent); breakWall = new BreakWall(agent); attack = new Attack(agent); defend = new Defend(agent); wallInWay = new BooleanDecision(breakWall, advance); defenderAttacking = new BooleanDecision(defend, attack); defenseInRange = new BooleanDecision(defenderAttacking, wallInWay); start = defenseInRange; // subscribe update method to game events }