示例#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);