// This function return false if the enemy is for any reason not targetable bool IsTargetable(PawnAI enemy) { if (enemy.GetHealth().IsDead() || enemy.GetHealth().IsKnockedDown() || enemy == currentTarget) { return(false); } return(true); }
// The update will launch a run of the behaviourtree root, which in turn trigger the run for its children, and so on... void Update() { if (Time.time - lastDecisionTick > decisionTick) { if (!pawn.GetHealth().IsDead() && !pawn.GetHealth().IsKnockedDown()) { behaviourTreeRoot.Run(); } lastDecisionTick = Time.time; } }
void Update() { if (Input.GetKeyDown("a")) { player.GetHealth().TakeDamage(1); } if (Input.GetKeyDown("q")) { enemy.GetHealth().KnockedDown(); } }