private void MoveObjectUpdate() { // get duration if (moveStep == 0) { settings.rpgMovementIsOn = true; Move(); totalMoveDuration = Time.time + settings.moveDuration; moveStep = 1; } // move the object else if (moveStep == 1) { if (Time.time >= totalMoveDuration) { moveStep = 2; } else { // x = horiz movement, y = vertical movement settings.ComputeVelocityRPG(speed); settings.AnimateCharacterRPG(); settings.MoveCharacterRPG(); } } // stop moving else if (moveStep == 2) { settings.ComputeVelocityRPG(new Vector2(0, 0)); settings.AnimateCharacterRPG(); settings.MoveCharacterRPG(); if (settings.velocity == new Vector2(0, 0)) { moveStep = 0; settings.rpgMovementIsOn = false; enabled = false; } } }
// move character void FixedUpdate() { settings.MoveCharacterRPG(); }