Updates for presentation build #399

Merged
glencelow merged 9 commits from PlayerController into main 2023-03-05 15:41:22 +08:00
21 changed files with 413 additions and 273 deletions
Showing only changes of commit bf5472e2c6 - Show all commits

View File

@ -113,7 +113,7 @@
Text Renderer Component:
Text: Press Space to contiune
Font: 176667660
Color: {x: 1, y: 1, z: 1, w: 1}
Color: {x: 0, y: 0, z: 0, w: 1}
Text Size: {x: 1, y: 1, z: 1}
IsActive: true
UI Component:
@ -152,6 +152,7 @@
Scripts:
- Type: CutsceneEnd
Enabled: true
nextScene: 92009475
duration: 1
skipDuration: 0.100000001
cutscene4Points: 4
@ -294,7 +295,7 @@
Text Renderer Component:
Text: Press Space to contiune
Font: 176667660
Color: {x: 1, y: 1, z: 1, w: 1}
Color: {x: 0, y: 0, z: 0, w: 1}
Text Size: {x: 1, y: 1, z: 1}
IsActive: false
UI Component:

View File

@ -2960,7 +2960,7 @@
Components:
Transform Component:
Translate: {x: 0.400000006, y: 0.400000006, z: 0.98999995}
Rotate: {x: 0, y: -299.5, z: 0.49999997}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 4.26499987, y: 2, z: 1}
IsActive: true
Renderable Component:
@ -2972,7 +2972,9 @@
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
Scripts:
- Type: FixRotation
Enabled: true
- EID: 198
Name: ====Raccoon====
IsActive: true
@ -5398,7 +5400,7 @@
Enabled: true
waypointsPool: 166
startWaypoint: 162
patrolSpeed: 1
patrolSpeed: 0.75
chaseSpeed: 2
turningSpeed: 5
sightDistance: 8
@ -5441,6 +5443,7 @@
Default Texture: 63979907
Hovered Texture: 51379325
Clicked Texture: 66788278
current texture: 0
IsActive: true
UI Component:
Canvas ID: 10
@ -5474,6 +5477,7 @@
Default Texture: 61602036
Hovered Texture: 58910810
Clicked Texture: 57786063
current texture: 0
IsActive: true
UI Component:
Canvas ID: 10
@ -5489,6 +5493,8 @@
onReleaseSound: Empty
hoverScale: 1.10000002
clickScale: 0.899999976
- Type: FixRotation
Enabled: true
- EID: 458
Name: RetryButton
IsActive: true
@ -5507,6 +5513,7 @@
Default Texture: 64806384
Hovered Texture: 58347825
Clicked Texture: 63234380
current texture: 0
IsActive: true
UI Component:
Canvas ID: 10
@ -8144,7 +8151,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.400000006, y: 0.439999998, z: 0.400000006}
Friction: 0.400000006
@ -8153,7 +8160,7 @@
Position Offset: {x: 0, y: 0.219999999, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0399999991, y: 1, z: 0.400000006}
Friction: 0.400000006
@ -8993,7 +9000,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 1.20000005}
Friction: 0.400000006
@ -9002,7 +9009,7 @@
Position Offset: {x: 0, y: 0.77700001, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0500000007, y: 0.800000012, z: 0.0500000007}
Friction: 0.400000006
@ -9011,7 +9018,7 @@
Position Offset: {x: -0.449999988, y: 0.400000006, z: -0.850000024}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0500000007, y: 0.800000012, z: 0.0500000007}
Friction: 0.400000006
@ -9020,7 +9027,7 @@
Position Offset: {x: -0.449999988, y: 0.400000006, z: 0.850000024}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0500000007, y: 0.800000012, z: 0.0500000007}
Friction: 0.400000006
@ -9029,7 +9036,7 @@
Position Offset: {x: 0.449999988, y: 0.400000006, z: 0.850000024}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0500000007, y: 0.800000012, z: 0.0500000007}
Friction: 0.400000006
@ -9056,7 +9063,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.400000006, y: 0.439999998, z: 0.400000006}
Friction: 0.400000006
@ -9065,7 +9072,7 @@
Position Offset: {x: 0, y: 0.219999999, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0399999991, y: 1, z: 0.400000006}
Friction: 0.400000006
@ -9092,7 +9099,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.400000006, y: 0.439999998, z: 0.400000006}
Friction: 0.400000006
@ -9101,7 +9108,7 @@
Position Offset: {x: 0, y: 0.219999999, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0399999991, y: 1, z: 0.400000006}
Friction: 0.400000006
@ -9128,7 +9135,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.400000006, y: 0.439999998, z: 0.400000006}
Friction: 0.400000006
@ -9137,7 +9144,7 @@
Position Offset: {x: 0, y: 0.219999999, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0399999991, y: 1, z: 0.400000006}
Friction: 0.400000006
@ -9164,7 +9171,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.400000006, y: 0.439999998, z: 0.400000006}
Friction: 0.400000006
@ -9173,7 +9180,7 @@
Position Offset: {x: 0, y: 0.219999999, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0399999991, y: 1, z: 0.400000006}
Friction: 0.400000006
@ -10539,7 +10546,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.899999976, y: 0.100000001, z: 1.89999998}
Friction: 0.400000006
@ -10638,7 +10645,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.400000006, y: 0.439999998, z: 0.400000006}
Friction: 0.400000006
@ -10647,7 +10654,7 @@
Position Offset: {x: 0, y: 0.219999999, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0399999991, y: 1, z: 0.400000006}
Friction: 0.400000006
@ -10766,7 +10773,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.899999976, y: 0.100000001, z: 1.89999998}
Friction: 0.400000006
@ -10957,7 +10964,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.899999976, y: 0.100000001, z: 1.89999998}
Friction: 0.400000006
@ -11056,7 +11063,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.699999988, y: 0.0500000007, z: 1.20000005}
Friction: 0.400000006
@ -11065,7 +11072,7 @@
Position Offset: {x: 0, y: 0.77700001, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0500000007, y: 0.800000012, z: 0.0500000007}
Friction: 0.400000006
@ -11074,7 +11081,7 @@
Position Offset: {x: -0.25, y: 0.400000006, z: -0.550000012}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0500000007, y: 0.800000012, z: 0.0500000007}
Friction: 0.400000006
@ -11083,7 +11090,7 @@
Position Offset: {x: -0.25, y: 0.400000006, z: 0.550000012}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0500000007, y: 0.800000012, z: 0.0500000007}
Friction: 0.400000006
@ -11092,7 +11099,7 @@
Position Offset: {x: 0.25, y: 0.400000006, z: 0.550000012}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0500000007, y: 0.800000012, z: 0.0500000007}
Friction: 0.400000006
@ -11119,7 +11126,7 @@
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.400000006, y: 0.439999998, z: 0.400000006}
Friction: 0.400000006
@ -11128,7 +11135,7 @@
Position Offset: {x: 0, y: 0.219999999, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: false
Collision Tag: 0
Collision Tag: 1
Type: Box
Half Extents: {x: 0.0399999991, y: 1, z: 0.400000006}
Friction: 0.400000006

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.100000001}
Translate: {x: 0, y: 0, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
@ -49,7 +49,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 75, z: 0}
Translate: {x: 0, y: 75, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1}
IsActive: true
@ -85,7 +85,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0}
Translate: {x: 0, y: -200, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1}
IsActive: true

View File

@ -29,7 +29,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.100000001}
Translate: {x: 0, y: 0, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
@ -49,7 +49,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 75, z: 0}
Translate: {x: 0, y: 75, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1}
IsActive: true
@ -85,7 +85,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0}
Translate: {x: 0, y: -200, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1}
IsActive: true

View File

@ -21,12 +21,12 @@ public class PickAndThrow : Script
private Collider itemCollider;
private Item itemScript;
private Transform raccoonHoldLocation;
private ThirdPersonCamera tpc;
public ThirdPersonCamera tpc { get; set; }
private float lastXDir;
private float lastZDir;
private bool inRange = false;
public bool throwItem = false;
private Vector3 prevTargetOffSet;
public Vector3 prevTargetOffSet { get; set; }
[Tooltip("Lenght of ray")]
public float rayDistance = 1;
@ -165,7 +165,7 @@ public class PickAndThrow : Script
}
}
private void ResetItemObject()
public void ResetItemObject()
{
itemRidigBody = null;
itemTransform = null;

View File

@ -409,9 +409,18 @@ public class PlayerController : Script
if (pat && pat.item)
{
holdItem = false;
isAiming = false;
pat.item.GetScript<Item>().returnBack = true;
if (holdItem)
{
holdItem = false;
pat.item.GetScript<Item>().returnBack = true;
}
if (isAiming)
{
isAiming = false;
cam.FOV = pat.defaultFOV;
camArm.TargetOffset = pat.prevTargetOffSet;
camArm.ArmLength = pat.tpc.armLength;
}
}
}
}

View File

@ -27,7 +27,7 @@ namespace SHADE_Scripting
{
AddComponent<Camera>();
}
GetComponent<Camera>().SetMainCamera();
if (!GetComponent<CameraArm>())
{
AddComponent<CameraArm>();

View File

@ -94,6 +94,8 @@ public class GameManager : Script
if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeOut();
Application.IsCursorVisible = false;
GamePause = false;
}
protected override void update()

View File

@ -53,7 +53,7 @@ namespace SHADE_Scripting.UI
protected override void update()
{
if (!SceneFadeInOut.Instance.FadeOutFinished() && !point1Done)
if (SceneFadeInOut.Instance && !SceneFadeInOut.Instance.FadeOutFinished() && !point1Done)
{
moveToEndPoint1.Reset();
return;
@ -68,13 +68,13 @@ namespace SHADE_Scripting.UI
SceneFadeInOut.Instance.alphaValue = 0.01f;
}
if (skip && SceneFadeInOut.Instance.FadeInFinished())
if (skip && SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished())
{
playerCamera.GetComponent<Camera>().SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut();
}
if (skip && SceneFadeInOut.Instance.FadeOutFinished())
if (skip && SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished())
{
GameManager.Instance.PreviewLevelDone = true;
}
@ -85,7 +85,7 @@ namespace SHADE_Scripting.UI
if (!point1Done)
{
listOfCamera[0].GetComponent<Transform>().LocalPosition = moveToEndPoint1.GetValue();
if (moveToEndPoint1.IsCompleted())
if (SceneFadeInOut.Instance && moveToEndPoint1.IsCompleted())
{
point1Done = true;
SceneFadeInOut.Instance.CallFadeIn();
@ -93,13 +93,13 @@ namespace SHADE_Scripting.UI
}
}
if (SceneFadeInOut.Instance.FadeInFinished() && point1Done)
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished() && point1Done)
{
listOfCamera[1].SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut();
}
if (SceneFadeInOut.Instance.FadeOutFinished() && point1Done)
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point1Done)
{
if (!point2Done)
{
@ -118,13 +118,13 @@ namespace SHADE_Scripting.UI
}
}
if (SceneFadeInOut.Instance.FadeInFinished() && point2Done)
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished() && point2Done)
{
listOfCamera[2].SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut();
}
if (SceneFadeInOut.Instance.FadeOutFinished() && point2Done)
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point2Done)
{
if (!point3Done)
{
@ -143,13 +143,13 @@ namespace SHADE_Scripting.UI
}
}
if (SceneFadeInOut.Instance.FadeInFinished() && point3Done)
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished() && point3Done)
{
playerCamera.GetComponent<Camera>().SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut();
}
if (SceneFadeInOut.Instance.FadeOutFinished() && point3Done)
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point3Done)
{
GameManager.Instance.PreviewLevelDone = true;
}

View File

@ -49,6 +49,7 @@ public class PauseMenu : Script
gamePauseText.Enabled = false;
if (canvas)
canvas.SetActive(false);
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
}
});
}
@ -101,6 +102,7 @@ public class PauseMenu : Script
gamePauseText.Enabled = true;
if (canvas)
canvas.SetActive(true);
Application.FixDeltaTime = 0;
}
}

View File

@ -37,6 +37,8 @@ namespace SHADE
{
prevFrameTime = std::chrono::high_resolution_clock::now();
}
}
//TODO Legacy code. Delete soon

View File

@ -16,6 +16,7 @@
// Project Headers
#include "ECS_Base/Managers/SHSystemManager.h"
#include "Scripting/SHScriptEngine.h"
#include "Math/SHMath.h"
namespace SHADE
{
@ -42,6 +43,10 @@ namespace SHADE
}
const double FIXED_DT = physicsSystem->fixedDT;
if (SHMath::CompareFloat(FIXED_DT, 0.0))
return;
accumulatedTime += dt;
int count = 0;

View File

@ -63,6 +63,11 @@ namespace SHADE
return fixedDT;
}
double SHPhysicsSystem::GetDefaultFixedDT() const noexcept
{
return DEFAULT_FIXED_STEP;
}
const std::vector<SHCollisionInfo>& SHPhysicsSystem::GetAllCollisionInfo() const noexcept
{
return collisionListener.GetCollisionInfoContainer();
@ -97,7 +102,7 @@ namespace SHADE
void SHPhysicsSystem::SetFixedDT(double fixedDt) noexcept
{
if (fixedDt <= 0.0)
if (fixedDt < 0.0)
{
SHLOGV_WARNING("Invalid value for setting fixed delta time! Fixed delta time unchanged.")
return;

View File

@ -58,6 +58,7 @@ namespace SHADE
[[nodiscard]] double GetFixedUpdateRate () const noexcept;
[[nodiscard]] double GetFixedDT () const noexcept;
[[nodiscard]] double GetDefaultFixedDT () const noexcept;
[[nodiscard]] const std::vector<SHCollisionInfo>& GetAllTriggerInfo () const noexcept;
[[nodiscard]] const std::vector<SHCollisionInfo>& GetAllCollisionInfo () const noexcept;

View File

@ -60,6 +60,25 @@ namespace SHADE
return 0.0;
}
double SHPhysicsSystemInterface::GetDeafultFixedDT() noexcept
{
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();
if (physicsSystem)
return physicsSystem->GetDefaultFixedDT();
SHLOGV_WARNING("Failed to get defualt fixed delta time. 0.0 returned instead.");
return 0.0;
}
void SHPhysicsSystemInterface::SetFixedDT(double value) noexcept
{
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();
if (physicsSystem)
physicsSystem->SetFixedDT(value);
SHLOGV_WARNING("Failed to set fixed delta time.");
}
int SHPhysicsSystemInterface::GetFixedUpdateRate() noexcept
{
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();

View File

@ -93,6 +93,8 @@ namespace SHADE
[[nodiscard]] static const std::vector<SHCollisionInfo>& GetCollisionInfo () noexcept;
[[nodiscard]] static const std::vector<SHCollisionInfo>& GetTriggerInfo () noexcept;
[[nodiscard]] static double GetFixedDT () noexcept;
[[nodiscard]] static void SetFixedDT (double value) noexcept;
[[nodiscard]] static double GetDeafultFixedDT () noexcept;
[[nodiscard]] static int GetFixedUpdateRate () noexcept;
[[nodiscard]] static const std::vector<SHPhysicsRaycastResult>& Raycast (const RaycastInfo& info) noexcept;

View File

@ -20,6 +20,7 @@ of DigiPen Institute of Technology is prohibited.
#include "ECS_Base/Managers/SHSystemManager.h"
#include "Editor/SHEditor.h"
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystemInterface.h"
#include "Physics/System/SHPhysicsSystemInterface.h"
namespace SHADE
{
@ -79,6 +80,14 @@ namespace SHADE
{
//SHWindow::SetMouseVisible(value);
}
double Application::FixDeltaTime::get()
{
return SHPhysicsSystemInterface::GetFixedDT();
}
void Application::FixDeltaTime::set(double value)
{
SHPhysicsSystemInterface::SetFixedDT(value);
}
/*---------------------------------------------------------------------------------*/
/* Usage Functions */
/*---------------------------------------------------------------------------------*/

View File

@ -79,6 +79,12 @@ namespace SHADE
void set(bool value);
}
static property double FixDeltaTime
{
double get();
void set(double value);
}
/*-----------------------------------------------------------------------------*/
/* Usage Functions */
/*-----------------------------------------------------------------------------*/

View File

@ -37,10 +37,17 @@ namespace SHADE
float Time::DeltaTimeF::get()
{
return static_cast<float>(SHFrameRateController::GetRawDeltaTime());
return static_cast<float>(SHFrameRateController::GetRawDeltaTime());
}
double Time::FixedDeltaTime::get()
{
return SHPhysicsSystemInterface::GetFixedDT();
}
double Time::DefaultFixDeltaTime::get()
{
return SHPhysicsSystemInterface::GetDeafultFixedDT();
}
}

View File

@ -57,5 +57,11 @@ namespace SHADE
{
double get();
}
static property double DefaultFixDeltaTime
{
double get();
}
};
}