浏览代码

Fixed framerate-dependent jump (?)

Also added a debug option to the editor initialised, to force framerate to extreme values
/main
Ciro Continisio 4 年前
当前提交
82d4c4e3
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 4
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/AscendActionSO.cs
  2. 3
      UOP1_Project/Assets/Scripts/SceneManagement/EditorInitialisationLoader.cs

4
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/AscendActionSO.cs


private float _verticalMovement;
private float _gravityContributionMultiplier;
private float _initialJumpForce;
private const float GRAVITY_COMEBACK_MULTIPLIER = 15f;
private const float GRAVITY_COMEBACK_MULTIPLIER = .03f;
private const float GRAVITY_DIVIDER = .6f;
private const float GRAVITY_MULTIPLIER = 5f;

public override void OnUpdate()
{
_gravityContributionMultiplier += Time.deltaTime * GRAVITY_COMEBACK_MULTIPLIER;
_gravityContributionMultiplier += GRAVITY_COMEBACK_MULTIPLIER;
_gravityContributionMultiplier *= GRAVITY_DIVIDER; //Reduce the gravity effect
_verticalMovement += Physics.gravity.y * GRAVITY_MULTIPLIER * Time.deltaTime * _gravityContributionMultiplier;
//Note that even if it's added, the above value is negative due to Physics.gravity.y

3
UOP1_Project/Assets/Scripts/SceneManagement/EditorInitialisationLoader.cs


{
#if UNITY_EDITOR
public GameSceneSO initializationScene;
public int targetFramerate = 0; // For debugging purposes
Application.targetFrameRate = targetFramerate; // For debugging purposes
for (int i = 0; i < SceneManager.sceneCount; ++i)
{
Scene scene = SceneManager.GetSceneAt(i);

正在加载...
取消
保存