void Update() { if (GameManager.pausaJogo == true) { return; } if (startBot) { CalculateDistance(); if ((distTarget.x <= 0.5f && distTarget.x >= -0.5f) && (distTarget.y <= 0.5f && distTarget.y >= -0.5f)) { botFSM.Idle(movementAI); } else { SetDirection(); } } else { botFSM.Idle(movementAI); botFSM.SetNone(2); botFSM.SetNone(3); } }
void SetVerticalDirection() { if (distTarget.y > 0.75) { movementAI.needToJump = true; if (movementAI.triggerController.triggerCollision.canJump || distTarget.y < movementAI.maxJumpHeight) { botFSM.SetJump(); } } else if (distTarget.y < -0.75) { if (botFSM.stateVertical == BotFSM.States.Down) { return; } botFSM.SetFall(); } else { botFSM.SetNone(2); } }