Esempio n. 1
0
        public IdleState(FighterStateContext context)
        {
            stateContext = context;
            animator     = stateContext.fighter.GetComponentInChildren <Animator> ();

            animator.SetTrigger("Idle");
        }
Esempio n. 2
0
    // 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;
    }
Esempio n. 3
0
    // 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;
    }
Esempio n. 4
0
        // 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");
        }
Esempio n. 5
0
        // 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");
        }
Esempio n. 6
0
        // 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");
        }
Esempio n. 7
0
 public override void Cooldown(FighterStateContext context, float cooldownDuration)
 {
     stateContext.cooldownState = new OnCooldownState(context, cooldownDuration);
 }
Esempio n. 8
0
 public OnGroundState(FighterStateContext context)
 {
     stateContext = context;
 }
Esempio n. 9
0
 public override void Cooldown(FighterStateContext context, float cooldownDuration)
 {
     stateContext.cooldownState = new OnCooldownState (context, cooldownDuration);
 }
Esempio n. 10
0
 // Constructor.
 public ReadyState(FighterStateContext context)
 {
     stateContext = context;
 }
Esempio n. 11
0
 public override void Cooldown(FighterStateContext context, float cooldownDuration)
 {
     // Already On cooldown. Reset timer.
     cooldownLeft = cooldownDuration;
     stateContext = context;
 }
Esempio n. 12
0
        // Constructor.
        public OnCooldownState(FighterStateContext context, float cooldownDuration)
        {
            stateContext = context;

            cooldownLeft = cooldownDuration;
        }
Esempio n. 13
0
 // Constructor.
 public HitState(FighterStateContext context)
 {
     stateContext = context;
 }
Esempio n. 14
0
        public IdleState(FighterStateContext context)
        {
            stateContext = context;
            animator = stateContext.fighter.GetComponentInChildren<Animator> ();

            animator.SetTrigger ("Idle");
        }
Esempio n. 15
0
 // Constructor.
 public ReadyState(FighterStateContext context)
 {
     stateContext = context;
 }
Esempio n. 16
0
 public override void Cooldown(FighterStateContext context, float cooldownDuration)
 {
     // Already On cooldown. Reset timer.
     cooldownLeft = cooldownDuration;
     stateContext = context;
 }
Esempio n. 17
0
        // Constructor.
        public OnCooldownState(FighterStateContext context, float cooldownDuration)
        {
            stateContext = context;

            cooldownLeft = cooldownDuration;
        }
Esempio n. 18
0
 public OnGroundState(FighterStateContext context)
 {
     stateContext = context;
 }
Esempio n. 19
0
        // 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");
        }
Esempio n. 20
0
 public abstract void Cooldown(FighterStateContext context, float cooldownDuration);
Esempio n. 21
0
 // Constructor.
 public HitState(FighterStateContext context)
 {
     stateContext = context;
 }
Esempio n. 22
0
 public abstract void Cooldown(FighterStateContext context, float cooldownDuration);