예제 #1
0
        public IdleState(FighterStateContext context)
        {
            stateContext = context;
            animator     = stateContext.fighter.GetComponentInChildren <Animator> ();

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

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

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

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