June 2017
Beginner
348 pages
7h 50m
English
Let's define what triggers each state and how the AI should choose the correct state in different scenarios. The PASSIVE state will be the default state, and the game will start in that position until the player comes across our character. The DEFENSIVE state will be used in two different situations if the player comes from the right side and if he has already confronted the player and has low HP. Finally, the AGGRESSIVE state will be activated if the player comes from the left side or has already arrived at the middle area:
public class Enemy : MonoBehaviour {private int Health = 100;private bool statePassive; private bool stateAggressive; private bool stateDefensive; private bool triggerL; private bool triggerR; private ...Read now
Unlock full access