Пример #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);