public IdleState(FighterStateContext context) { stateContext = context; animator = stateContext.fighter.GetComponentInChildren <Animator> (); animator.SetTrigger("Idle"); }
// Use this for initialization public virtual void Start() { state = new FighterStateContext(this.gameObject); state.OnCooldownEnded += OnCooldownEnded; state.OnAttackEnded += OnAttack; (model as FighterModel).OnFighterDataSet += OnFighterDataSet; (view as FighterView).OnCollideWithEnemy += OnCollideWithEnemy; (view as FighterView).OnEnemyInRange += OnEnemyInRange; (view as FighterView).OnEnemyExitRange += OnEnemyExitRange; }
// Use this for initialization public virtual void Start() { state = new FighterStateContext (this.gameObject); state.OnCooldownEnded += OnCooldownEnded; state.OnAttackEnded += OnAttack; (model as FighterModel).OnFighterDataSet += OnFighterDataSet; (view as FighterView).OnCollideWithEnemy += OnCollideWithEnemy; (view as FighterView).OnEnemyInRange += OnEnemyInRange; (view as FighterView).OnEnemyExitRange += OnEnemyExitRange; }
// Constructor. public AttackState(FighterStateContext context, Attack attack) { stateContext = context; attackData = attack; // Store reference to animator. animator = stateContext.fighter.GetComponentInChildren<Animator> (); // Start attacking. animator.SetTrigger ("Attack"); }
// Constructor. public AttackState(FighterStateContext context, Attack attack) { stateContext = context; attackData = attack; // Store reference to animator. animator = stateContext.fighter.GetComponentInChildren <Animator> (); // Start attacking. animator.SetTrigger("Attack"); }
// Constructor. public WalkState(FighterStateContext context) { stateContext = context; animator = stateContext.fighter.GetComponentInChildren <Animator> (); fighterTransform = stateContext.fighter.transform; // Set move direction depending on FighterAllegiance. FighterModel fighterModel = stateContext.fighter.GetComponent <FighterModel> (); moveDirection = (int)fighterModel.allegiance; animator.SetTrigger("Walk"); }
public override void Cooldown(FighterStateContext context, float cooldownDuration) { stateContext.cooldownState = new OnCooldownState(context, cooldownDuration); }
public OnGroundState(FighterStateContext context) { stateContext = context; }
public override void Cooldown(FighterStateContext context, float cooldownDuration) { stateContext.cooldownState = new OnCooldownState (context, cooldownDuration); }
// Constructor. public ReadyState(FighterStateContext context) { stateContext = context; }
public override void Cooldown(FighterStateContext context, float cooldownDuration) { // Already On cooldown. Reset timer. cooldownLeft = cooldownDuration; stateContext = context; }
// Constructor. public OnCooldownState(FighterStateContext context, float cooldownDuration) { stateContext = context; cooldownLeft = cooldownDuration; }
// Constructor. public HitState(FighterStateContext context) { stateContext = context; }
public IdleState(FighterStateContext context) { stateContext = context; animator = stateContext.fighter.GetComponentInChildren<Animator> (); animator.SetTrigger ("Idle"); }
// Constructor. public WalkState(FighterStateContext context) { stateContext = context; animator = stateContext.fighter.GetComponentInChildren<Animator> (); fighterTransform = stateContext.fighter.transform; // Set move direction depending on FighterAllegiance. FighterModel fighterModel = stateContext.fighter.GetComponent<FighterModel> (); moveDirection = (int)fighterModel.allegiance; animator.SetTrigger ("Walk"); }
public abstract void Cooldown(FighterStateContext context, float cooldownDuration);