Esempio n. 1
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);
        }