Exemple #1
0
        private void JumpObjectUpdate()
        {
            // start the jump
            if (step == 0)
            {
                haveJumped = true;
                step       = 1;
            }

            // jumping
            if (step == 1)
            {
                settings.ComputeJumpVelocity(jumpHeight);
                settings.MoveCharacter(true);
                if (!settings.startJump)
                {
                    step = 2;
                }
            }

            // finish the jump
            if (step == 2)
            {
                haveJumped = false;
                enabled    = false;
            }
        }
Exemple #2
0
        /// <summary>
        /// Manage the current status of the move.
        /// </summary>
        private void MoveObjectUpdate()
        {
            // get duration
            if (moveStep == 0)
            {
                settings.customMovementIsOn = true;
                Move();
                settings.angle            = turnAngle;
                settings.hasTurnedForMove = false;
                settings.TurnObject();
                totalMoveDuration = Time.time + settings.moveDuration;
                moveStep          = 1;
            }

            // move the object
            else if (moveStep == 1)
            {
                if (Time.time >= totalMoveDuration)
                {
                    moveStep = 2;
                }
                else
                {
                    settings.ComputeVelocity(speed);
                    settings.AnimateCharacter();
                    settings.MoveCharacter(true);
                }
            }

            // stop moving
            else if (moveStep == 2)
            {
                settings.ComputeVelocity(new Vector2(0, 0));
                settings.AnimateCharacter();
                settings.MoveCharacter(true);
                //if (settings.velocity == new Vector2(0, 0))
                //{
                moveStep = 0;
                settings.customMovementIsOn = false;
                enabled = false;
                //}
            }
        }
 // move character
 void FixedUpdate()
 {
     settings.MoveCharacter(true);
     settings.RotateCharacterWithMouse();
 }
Exemple #4
0
 // move character
 void FixedUpdate()
 {
     settings.MoveCharacter();
     settings.RotateCharacterWithCamera();
 }
Exemple #5
0
 // move character
 void FixedUpdate()
 {
     settings.MoveCharacter(true);
     settings.SaveLastMove();
 }