Added Navigation System. Added basic AI FSM #438

Merged
maverickdgg merged 9 commits from Navigation into main 2023-03-24 16:11:14 +08:00
3 changed files with 19 additions and 14 deletions
Showing only changes of commit 78d30cb051 - Show all commits

View File

@ -530,7 +530,6 @@
Scripts:
- Type: SHADE_Scripting.UI.FadeInOnActive
Enabled: true
alpha: 0
- EID: 19
Name: Options Canvas
IsActive: false
@ -1236,7 +1235,6 @@
Scripts:
- Type: SHADE_Scripting.UI.FadeInOnActive
Enabled: true
alpha: 0
- EID: 46
Name: Credits Canvas
IsActive: false
@ -1461,7 +1459,6 @@
Scripts:
- Type: SHADE_Scripting.UI.FadeInOnActive
Enabled: true
alpha: 0
- EID: 441
Name: Level Select Buttons
IsActive: true

View File

@ -60,6 +60,14 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
{
alertCooldown = 0.0f;
}
RigidBody rigid = GetComponent<RigidBody>();
if(rigid)
{
rigid.AngularVelocity = Vector3.Zero;
}
}
public bool ShouldTransitAlert()
@ -78,17 +86,17 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
public void RotateToPlayer()
{
Transform playerTransform = player.GetComponent<Transform>();
//Transform playerTransform = player.GetComponent<Transform>();
//Rotate to face player.
Transform aiTransform = GetComponent<Transform>();
if(playerTransform && aiTransform)
{
Vector3 direction = playerTransform.GlobalPosition - aiTransform.GlobalPosition;
Quaternion currentRotation = aiTransform.LocalRotation;
Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(direction.x, direction.z), 0.0f);
aiTransform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, 5.0f * (float)Time.FixedDeltaTime);
}
////Rotate to face player.
//Transform aiTransform = GetComponent<Transform>();
//if(playerTransform && aiTransform)
//{
// Vector3 direction = playerTransform.GlobalPosition - aiTransform.GlobalPosition;
// Quaternion currentRotation = aiTransform.LocalRotation;
// Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(direction.x, direction.z), 0.0f);
// aiTransform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, 5.0f * (float)Time.FixedDeltaTime);
//}
}

View File

@ -9,7 +9,7 @@ namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
{
public class RotateToVelocity : Script
{
public float rotationPerSecond = 5.0f;
public float rotationPerSecond = 2.0f;
protected override void update()
{