public void automatic_exits(string src, string dst, CharacterStateContext context = null)
 {
     TestTransition(src, dst, context ?? new CharacterStateContext {
         NormalizedAnimationTime = 1.0f,
         ShieldHP = 100
     });
 }
 public override void UpdateStateContext(CharacterStateContext context)
 {
     if (Animator == null)
     {
         return;
     }
     context.NormalizedAnimationTime = Animator.GetCurrentAnimatorStateInfo(0).normalizedTime;
 }
        public override void UpdateStateContext(CharacterStateContext context)
        {
            InputContext input = context.Input;

            input.Movement = Movement;
            input.Smash    = Smash;
            var valid = !IsInvalid;

            input.Attack.Update(valid && (GetKeys(KeyCode.E) || _controlMapping.Attack(Player.Controller)));
            input.Special.Update(valid && (GetKeys(KeyCode.S) || _controlMapping.Special(Player.Controller)));
            input.Shield.Update(valid && (GetKeys(KeyCode.LeftShift) || _controlMapping.Shield(Player.Controller)));
            input.Jump.Update(Jump);
            context.Input = input;
        }
 /// <summary>
 /// Awake is called when the script instance is being loaded.
 /// </summary>
 void Awake()
 {
     gameObject.tag   = Config.Tags.PlayerTag;
     gameObject.layer = Config.Tags.CharacterLayer;
     if (_controller == null)
     {
         throw new InvalidOperationException("Cannot start a character without a State Controller!");
     }
     StateController = _controller.BuildCharacterControllerImpl(
         new StateControllerBuilder <CharacterState, CharacterStateContext>());
     if (Debug.isDebugBuild)
     {
         StateController.OnStateChange += (b, a) => Log.Debug("{0} changed states: {1} => {2}".With(name, b.Name, a.Name));
     }
     Context     = new CharacterStateContext();
     _hitboxMap  = new Dictionary <int, Hitbox>();
     _hurtboxes  = new List <Hitbox>();
     _components = new List <ICharacterComponent>();
     _stateMap   = StateController.States.ToDictionary(s => s.AnimatorHash);
     _hitHistory = new HashSet <object>();
     Controller  = this.SafeGetComponent <CharacterController>();
     Movement    = this.SafeGetComponent <MovementState>();
     EstablishImmunityChanges();
 }
Exemple #5
0
 public override void UpdateStateContext(CharacterStateContext context)
 {
     context.Hitstun = Hitstun;
 }
 public virtual void UpdateStateContext(CharacterStateContext context)
 {
 }
Exemple #7
0
 public override void UpdateStateContext(CharacterStateContext context)
 {
     context.IsGrounded = IsGrounded;
 }
 public override void UpdateStateContext(CharacterStateContext context)
 {
     context.IsGrabbingLedge = CurrentLedge != null;
     context.Direction       = Direction ? 1.0f : -1.0f;
     context.CanJump         = JumpCount > 0 && JumpCount <= MaxJumpCount;
 }
 public void ledge_transitions(string src, string dst, CharacterStateContext context)
 {
     TestTransition(src, dst, context);
 }
 void TestTransition(string src, string dst, CharacterStateContext context)
 {
     _stateController.SetState(_stateMap[src]);
     _stateController.UpdateState(context);
     Assert.AreEqual(dst, _stateController.CurrentState.Name);
 }
Exemple #11
0
 public override void UpdateStateContext(CharacterStateContext context)
 {
     context.ShieldHP = ShieldHealth;
 }