示例#1
0
 protected override void OnEnable()
 {
     base.OnEnable();
     stateConfig = (StateMotorConfig)target;
 }
示例#2
0
 public abstract void Move(IMovable user, ref Vector2 velocity, ref CollisionStatus collisionStatus, StateMotorMachine machine, StateMotorConfig config, LayerMask collisionMask);
示例#3
0
 public void Move(IMovable user, ref Vector2 velocity, ref CollisionStatus status, StateMotorConfig config, LayerMask collisionMask)
 {
     state.Move(user, ref velocity, ref status, this, config, collisionMask);
 }
示例#4
0
        public override void Move(IMovable user, ref Vector2 velocity, ref CollisionStatus collisionStatus, StateMotorMachine machine, StateMotorConfig config1, LayerMask collisionMask)
        {
            var config = user.GetMotorConfig <GroundMotorConfig>();

            if (config == null)
            {
                UPMDebug.LogWarning("Expected GroundMotorConfig for GroundedState @ " + user);
                return;
            }

            ProcessInputs(user, config, ref velocity, ref collisionStatus);
            velocity.y += Gravity * config.GravityScale * Time.deltaTime;
            var max = user.MaxSpeed;

            velocity.x = Mathf.Clamp(velocity.x, -max, max);
            GroundedBehaviour.Check(user, ref velocity, ref collisionStatus, collisionMask);
        }