Potential fix for incorrect collision states #350
|
@ -1,4 +1,4 @@
|
|||
Start in Fullscreen: false
|
||||
Starting Scene ID: 97086054
|
||||
Starting Scene ID: 86098106
|
||||
Window Size: {x: 1920, y: 1080}
|
||||
Window Title: SHADE Engine
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,10 +1,10 @@
|
|||
0 1 0000000000000000
|
||||
1 2 0000000000000000
|
||||
2 3 0000000000000000
|
||||
3 4 0000000000000000
|
||||
4 5 0000000000000000
|
||||
5 6 0000000000000000
|
||||
6 7 0000000000000000
|
||||
0 StaticObject 1110000000000000
|
||||
1 Player 1100000000000000
|
||||
2 Food 1000000000000000
|
||||
3 Breakable 1100000000000000
|
||||
4 ScoringWallCollider 0110000000000000
|
||||
5 Homeowner 1100000000000000
|
||||
6 Camera 0010000000000000
|
||||
7 8 0000000000000000
|
||||
8 9 0000000000000000
|
||||
9 10 0000000000000000
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Start Maximized: true
|
||||
Working Scene ID: 91685359
|
||||
Working Scene ID: 86098106
|
||||
Window Size: {x: 1920, y: 1013}
|
||||
Style: 0
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -36,6 +36,9 @@
|
|||
Mesh: 141771688
|
||||
Material: 129138332
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 1
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 5
|
||||
Name: Main Menu Button
|
||||
|
@ -56,6 +59,9 @@
|
|||
Hovered Texture: 55999018
|
||||
Clicked Texture: 66382894
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 1
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: ChangeSceneButton
|
||||
Enabled: true
|
||||
|
@ -79,6 +85,9 @@
|
|||
Hovered Texture: 65045286
|
||||
Clicked Texture: 58607560
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 1
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: QuitButton
|
||||
Enabled: true
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
using SHADE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SHADE_Scripting.Audio
|
||||
{
|
||||
public static class AudioHandler
|
||||
{
|
||||
public static Dictionary<string, AudioClipHandler> audioClipHandlers = new Dictionary<string, AudioClipHandler>();
|
||||
|
||||
//Functions here, maybe
|
||||
public static void stopAllSounds(bool fadeOut)
|
||||
{
|
||||
foreach (KeyValuePair<string, AudioClipHandler> h in audioClipHandlers)
|
||||
{
|
||||
h.Value.Stop(fadeOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: AudioHandler
|
||||
ID: 159235425
|
||||
Type: 9
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
using SHADE;
|
||||
using SHADE_Scripting.AIBehaviour.BehaviourTree;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -99,6 +100,17 @@ public partial class Homeowner1 : BehaviourTree
|
|||
SetData("turningSpeed", turningSpeed);
|
||||
SetData("distanceToCapture", distanceToCapture);
|
||||
SetData("baseCaptureTime", captureTime);*/
|
||||
|
||||
|
||||
//These should be somewhere else
|
||||
//Debug.Log("TESTING");
|
||||
AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected");
|
||||
AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected");
|
||||
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
|
||||
|
||||
AudioHandler.audioClipHandlers["SFXFootstep"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
|
||||
AudioHandler.audioClipHandlers["SFXDetectAh"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_detect_raccoon");
|
||||
AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected");
|
||||
}
|
||||
|
||||
//Called every tick
|
||||
|
@ -132,7 +144,6 @@ public partial class Homeowner1 : BehaviourTree
|
|||
if (GetData("baseCaptureTime") == null || (float)GetData("baseCaptureTime") != captureTime)
|
||||
SetData("baseCaptureTime", captureTime);
|
||||
|
||||
|
||||
events.Tick();
|
||||
|
||||
//Footsteps SFX, move them somewhere else soon
|
||||
|
@ -141,7 +152,8 @@ public partial class Homeowner1 : BehaviourTree
|
|||
footstepTimeRemaining -= velocity * Time.DeltaTimeF;
|
||||
if (footstepTimeRemaining < 0.0f)
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_footsteps");
|
||||
//Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_footsteps");
|
||||
//AudioHandler.audioClipHandlers["SFXFootstep"].Play();
|
||||
footstepTimeRemaining = footstepSFXIntervalMultiplier;
|
||||
}
|
||||
//Debug.Log("Ticked");
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
using SHADE;
|
||||
using SHADE_Scripting.AIBehaviour.BehaviourTree;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -111,7 +112,9 @@ public partial class LeafChase : BehaviourTreeNode
|
|||
|
||||
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true)
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/Homeowner/humming");
|
||||
//AudioHandler.audioClipHandlers["BGMAdpative"].SetParameter("Detected", 0.0f);
|
||||
Audio.SetParameter("Detected", 0.0f);
|
||||
AudioHandler.audioClipHandlers["SFXHumming"].Play();
|
||||
}
|
||||
SetNodeData("isAlert", false);
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
using SHADE;
|
||||
using SHADE_Scripting.AIBehaviour.BehaviourTree;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -239,9 +240,12 @@ public partial class LeafPatrol : BehaviourTreeNode
|
|||
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert"))
|
||||
{
|
||||
//Debug.Log("Unalert");
|
||||
Audio.PlaySFXOnce2D("event:/Homeowner/humming");
|
||||
Audio.StopAllSounds();
|
||||
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
|
||||
//AudioHandler.audioClipHandlers["BGMAlert"].Stop(true);
|
||||
//Audio.PlaySFXOnce2D("event:/Homeowner/humming");
|
||||
AudioHandler.audioClipHandlers["SFXHumming"].Play();
|
||||
//AudioHandler.audioClipHandlers["BGMUnalert"].Play();
|
||||
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
|
||||
Audio.SetParameter("Detected", 0.0f);
|
||||
}
|
||||
SetNodeData("isAlert", false);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
using SHADE;
|
||||
using SHADE_Scripting.AIBehaviour.BehaviourTree;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -65,7 +66,9 @@ public partial class LeafSearch : BehaviourTreeNode
|
|||
{
|
||||
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true)
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/Homeowner/humming");
|
||||
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
|
||||
Audio.SetParameter("Detected", 0.0f);
|
||||
AudioHandler.audioClipHandlers["SFXHumming"].Play();
|
||||
reevaluateWaypoint();
|
||||
}
|
||||
SetNodeData("isAlert", false);
|
||||
|
@ -185,19 +188,27 @@ public partial class LeafSearch : BehaviourTreeNode
|
|||
if (GetNodeData("isAlert") == null)
|
||||
{
|
||||
SetNodeData("isAlert", true);
|
||||
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_detect_raccoon");
|
||||
Audio.PlaySFXOnce2D("event:/Music/stingers/player_detected");
|
||||
Audio.StopAllSounds();
|
||||
Audio.PlayBGMOnce2D("event:/Music/player_detected");
|
||||
//Audio.StopAllSounds();
|
||||
AudioHandler.audioClipHandlers["SFXDetectAh"].Play();
|
||||
AudioHandler.audioClipHandlers["SFXDetectSting"].Play();
|
||||
//AudioHandler.audioClipHandlers["BGMAlert"].Play();
|
||||
AudioHandler.audioClipHandlers["SFXHumming"].Stop(false);
|
||||
//AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true);
|
||||
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 1.0f);
|
||||
Audio.SetParameter("Detected", 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == false)
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_detect_raccoon");
|
||||
Audio.PlaySFXOnce2D("event:/Music/stingers/player_detected");
|
||||
Audio.StopAllSounds();
|
||||
Audio.PlayBGMOnce2D("event:/Music/player_detected");
|
||||
//Audio.StopAllSounds();
|
||||
AudioHandler.audioClipHandlers["SFXDetectAh"].Play();
|
||||
AudioHandler.audioClipHandlers["SFXDetectSting"].Play();
|
||||
//AudioHandler.audioClipHandlers["BGMAlert"].Play();
|
||||
AudioHandler.audioClipHandlers["SFXHumming"].Stop(false);
|
||||
//AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true);
|
||||
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 1.0f);
|
||||
Audio.SetParameter("Detected", 1.0f);
|
||||
}
|
||||
SetNodeData("isAlert", true);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
@ -12,6 +13,7 @@ public class Breakable : Script
|
|||
private Transform trans;
|
||||
public bool isBreak { get; set; }
|
||||
private List<GameObject> itemPieces = new List<GameObject>();
|
||||
public bool print = false;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
|
@ -30,6 +32,8 @@ public class Breakable : Script
|
|||
}
|
||||
|
||||
isBreak = false;
|
||||
|
||||
AudioHandler.audioClipHandlers["SFXBreak"] = Audio.CreateAudioClip("event:/Props/impact_break");
|
||||
}
|
||||
|
||||
protected override void update()
|
||||
|
@ -43,6 +47,9 @@ public class Breakable : Script
|
|||
if (ignoreRaccoon && info.GameObject.GetScript<PlayerController>())
|
||||
return;
|
||||
|
||||
if (print)
|
||||
Debug.Log($"{info.GameObject.Name}");
|
||||
|
||||
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold && !info.GameObject.GetScript<PlayerController>())
|
||||
{
|
||||
isBreak = true;
|
||||
|
@ -68,7 +75,7 @@ public class Breakable : Script
|
|||
}
|
||||
|
||||
isBreak = false;
|
||||
Audio.PlaySFXOnce2D("event:/Props/impact_break");
|
||||
AudioHandler.audioClipHandlers["SFXBreak"].Play();
|
||||
GameObject.SetActive(false);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
public class Item : Script
|
||||
{
|
||||
|
@ -14,6 +15,7 @@ public class Item : Script
|
|||
public ItemCategory currCategory;
|
||||
public bool returnBack { get; set; }
|
||||
private Transform transform;
|
||||
private RigidBody rb;
|
||||
private bool playSound = false;
|
||||
private bool caputurePos = false;
|
||||
private Vector3 firstPostion;
|
||||
|
@ -24,11 +26,15 @@ public class Item : Script
|
|||
protected override void awake()
|
||||
{
|
||||
transform = GetComponent<Transform>();
|
||||
rb = GetComponent<RigidBody>();
|
||||
collider = GetComponent<Collider>();
|
||||
if(collider)
|
||||
collider.GetCollisionShape(0).Density = density;
|
||||
|
||||
returnBack = false;
|
||||
|
||||
AudioHandler.audioClipHandlers["SFXImpactElastic"] = Audio.CreateAudioClip("event:/Props/impact_elastic");
|
||||
AudioHandler.audioClipHandlers["SFXImpactHard"] = Audio.CreateAudioClip("event:/Props/impact_hard");
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
|
@ -40,7 +46,12 @@ public class Item : Script
|
|||
{
|
||||
if (returnBack && !dontReturn)
|
||||
{
|
||||
transform.LocalPosition = firstPostion;
|
||||
if(transform)
|
||||
transform.LocalPosition = firstPostion;
|
||||
|
||||
if (rb)
|
||||
rb.LinearVelocity = Vector3.Zero;
|
||||
|
||||
returnBack = false;
|
||||
}
|
||||
}
|
||||
|
@ -55,10 +66,10 @@ public class Item : Script
|
|||
|
||||
if (playSound)
|
||||
{
|
||||
if(currCategory == ItemCategory.LIGHT)
|
||||
Audio.PlaySFXOnce2D("event:/Props/impact_elastic");
|
||||
if (currCategory == ItemCategory.LIGHT)
|
||||
AudioHandler.audioClipHandlers["SFXImpactElastic"].Play();
|
||||
else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY)
|
||||
Audio.PlaySFXOnce2D("event:/Props/impact_hard");
|
||||
AudioHandler.audioClipHandlers["SFXImpactHard"].Play();
|
||||
playSound = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using static PlayerController;
|
||||
|
@ -43,6 +44,8 @@ public class PickAndThrow : Script
|
|||
if(!tpc)
|
||||
Debug.LogError("TPC EMPTY");
|
||||
|
||||
AudioHandler.audioClipHandlers["SFXThrow"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw");
|
||||
|
||||
timer = delayTimer;
|
||||
}
|
||||
protected override void update()
|
||||
|
@ -72,7 +75,7 @@ public class PickAndThrow : Script
|
|||
|
||||
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_throw");
|
||||
AudioHandler.audioClipHandlers["SFXThrow"].Play();
|
||||
itemRidigBody.IsGravityEnabled = true;
|
||||
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
||||
pc.isAiming = false;
|
||||
|
|
|
@ -150,7 +150,13 @@ public class PlayerController : Script
|
|||
if(!camArm)
|
||||
camArm = GetComponentInChildren<CameraArm>();
|
||||
|
||||
//tempFix
|
||||
if (tranform)
|
||||
tranform.LocalEulerAngles = new Vector3(0.0f, tranform.LocalEulerAngles.y, 0.0f);
|
||||
|
||||
Rotation();
|
||||
MoveKey();
|
||||
Sprint();
|
||||
Jump();
|
||||
GotCaught();
|
||||
//Debug.Log($"{currentState}");
|
||||
|
@ -161,10 +167,7 @@ public class PlayerController : Script
|
|||
|
||||
protected override void fixedUpdate()
|
||||
{
|
||||
|
||||
MoveKey();
|
||||
Move();
|
||||
Sprint();
|
||||
Gravity();
|
||||
//Debug.Log($"X: {rb.LinearVelocity.x}" + $" Z: {rb.LinearVelocity.z}");
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace SHADE_Scripting
|
|||
public float pitchClamp = 45.0f;
|
||||
public bool inverseXControls = false;
|
||||
public bool inverseYControls = false;
|
||||
public float lowerClamp = 5.0f;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
|
@ -58,9 +59,9 @@ namespace SHADE_Scripting
|
|||
{
|
||||
arm.Pitch = pitchClamp;
|
||||
}
|
||||
else if (arm.Pitch < 0)
|
||||
else if (arm.Pitch < lowerClamp)
|
||||
{
|
||||
arm.Pitch = 0;
|
||||
arm.Pitch = lowerClamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -38,6 +39,23 @@ public class GameManager : Script
|
|||
|
||||
public static GameManager Instance { get; private set; }
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
base.start();
|
||||
|
||||
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
|
||||
AudioHandler.audioClipHandlers["BGMAdaptive"].Play();
|
||||
|
||||
Audio.SetParameter("Detected", 0.0f);
|
||||
|
||||
AudioHandler.audioClipHandlers["KitchenAmbience"] = Audio.CreateAudioClip("event:/Ambience/roomtone_kitchen");
|
||||
AudioHandler.audioClipHandlers["KitchenAmbience"].Play();
|
||||
|
||||
AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming");
|
||||
AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f);
|
||||
AudioHandler.audioClipHandlers["SFXHumming"].Play();
|
||||
}
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
if (Instance != null && Instance != this)
|
||||
|
@ -45,8 +63,12 @@ public class GameManager : Script
|
|||
else
|
||||
Instance = this;
|
||||
|
||||
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
|
||||
Audio.PlayBGMOnce2D("event:/Ambience/roomtone_kitchen");
|
||||
|
||||
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
|
||||
//Audio.PlayBGMOnce2D("event:/Music/player_undetected");
|
||||
|
||||
//Audio.PlayBGMOnce2D("event:/Ambience/roomtone_kitchen");
|
||||
|
||||
totalItemCount = 0;
|
||||
Score = 0;
|
||||
currGameState = GameState.START;
|
||||
|
@ -54,6 +76,9 @@ public class GameManager : Script
|
|||
currMultiplierCombo = 1;
|
||||
currMultiplierDuration = 0;
|
||||
fontScalar = new Vector3(multiplierFont / maxMultiplierDuration, multiplierFont / maxMultiplierDuration , multiplierFont / maxMultiplierDuration);
|
||||
|
||||
AudioHandler.audioClipHandlers["BGMWin"] = Audio.CreateAudioClip("event:/Music/stingers/game_win");
|
||||
AudioHandler.audioClipHandlers["BGMLose"] = Audio.CreateAudioClip("event:/Music/stingers/game_lose");
|
||||
}
|
||||
|
||||
protected override void update()
|
||||
|
@ -86,19 +111,25 @@ public class GameManager : Script
|
|||
multiplierText.GetComponent<Transform>().LocalScale = Vector3.Zero;
|
||||
}
|
||||
|
||||
if ((timer > 0 && totalItemCount < 0) || Input.GetKeyDown(Input.KeyCode.F1))
|
||||
if ((timer > 0 && totalItemCount <= 0) || Input.GetKeyDown(Input.KeyCode.F1))
|
||||
{
|
||||
currGameState = GameState.WIN;
|
||||
Audio.StopAllSounds();
|
||||
//Audio.StopAllSounds(); //Calling this outright breaks audio clip handlers
|
||||
AudioHandler.stopAllSounds(false);
|
||||
AudioHandler.audioClipHandlers["BGMWin"].Play();
|
||||
SceneManager.ChangeScene(winScene);
|
||||
Audio.PlaySFXOnce2D("event:/Music/stingers/game_win");
|
||||
//Audio.PlaySFXOnce2D("event:/Music/stingers/game_win");
|
||||
|
||||
}
|
||||
else if(timer < 0 || Input.GetKeyDown(Input.KeyCode.F2))
|
||||
{
|
||||
currGameState = GameState.LOSE;
|
||||
Audio.StopAllSounds();
|
||||
//Audio.StopAllSounds();
|
||||
AudioHandler.stopAllSounds(false);
|
||||
AudioHandler.audioClipHandlers["BGMLose"].Play();
|
||||
SceneManager.ChangeScene(loseScene);
|
||||
Audio.PlaySFXOnce2D("event:/Music/stingers/game_lose");
|
||||
//Audio.PlaySFXOnce2D("event:/Music/stingers/game_lose");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
public class ScoringZone : Script
|
||||
{
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
AudioHandler.audioClipHandlers["SFXItemScore"] = Audio.CreateAudioClip("event:/Music/stingers/item_scored");
|
||||
}
|
||||
|
||||
protected override void onTriggerEnter(CollisionInfo info)
|
||||
{
|
||||
if (GameManager.Instance && info.GameObject.GetScript<Item>())
|
||||
if (GameManager.Instance && info.GameObject.GetScript<Item>() && info.GameObject.IsActiveSelf && !info.GameObject.GetComponent<Collider>().GetCollisionShape(0).IsTrigger )
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/Music/stingers/item_scored");
|
||||
GameManager.Instance.ItemScored();
|
||||
AudioHandler.audioClipHandlers["SFXItemScore"].Play();
|
||||
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo;
|
||||
GameManager.Instance.ItemScored();
|
||||
info.GameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
|
||||
public class EndScene : Script
|
||||
{
|
||||
|
@ -8,28 +9,36 @@ public class EndScene : Script
|
|||
|
||||
protected override void awake()
|
||||
{
|
||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
||||
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||
}
|
||||
protected override void update()
|
||||
{
|
||||
if (Input.GetKeyDown(Input.KeyCode.R))
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
||||
}
|
||||
if (Input.GetKeyUp(Input.KeyCode.R))
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
Audio.StopAllSounds();
|
||||
//Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
//Audio.StopAllSounds();
|
||||
AudioHandler.stopAllSounds(false);
|
||||
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
||||
SceneManager.ChangeScene(mainGameScene);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(Input.KeyCode.M))
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
||||
}
|
||||
if (Input.GetKeyUp(Input.KeyCode.M))
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
Audio.StopAllSounds();
|
||||
//Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
//Audio.StopAllSounds();
|
||||
AudioHandler.stopAllSounds(false);
|
||||
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
||||
SceneManager.ChangeScene(mainMainScene);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +1,30 @@
|
|||
using System;
|
||||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
|
||||
public class MainMenu : Script
|
||||
{
|
||||
public uint sceneID;
|
||||
protected override void awake()
|
||||
{
|
||||
Audio.PlayBGMOnce2D("event:/Music/main_menu");
|
||||
AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
|
||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
||||
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||
//Audio.PlayBGMOnce2D("event:/Music/main_menu");
|
||||
AudioHandler.audioClipHandlers["BGMMainMenu"].Play();
|
||||
}
|
||||
protected override void update()
|
||||
{
|
||||
if (Input.GetKeyDown(Input.KeyCode.Space))
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
||||
}
|
||||
|
||||
if (Input.GetKeyUp(Input.KeyCode.Space))
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
//Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
||||
SceneManager.ChangeScene(sceneID);
|
||||
Audio.StopAllSounds();
|
||||
}
|
||||
|
|
|
@ -171,6 +171,7 @@ namespace Sandbox
|
|||
SHSceneManager::InitSceneManager<SBMainScene>(editorConfig.workingSceneID);
|
||||
#else
|
||||
SHSceneManager::InitSceneManager<SBMainScene>(appConfig.startingSceneID);
|
||||
window.SetMouseVisible(false);
|
||||
#endif
|
||||
SHFrameRateController::UpdateFRC();
|
||||
|
||||
|
@ -199,7 +200,8 @@ namespace Sandbox
|
|||
|
||||
#ifdef SHEDITOR
|
||||
if(editor->editorState == SHEditor::State::PLAY)
|
||||
|
||||
#else
|
||||
window.ClipMouseCursor();
|
||||
#endif
|
||||
SHSceneManager::SceneUpdate(0.016f);
|
||||
#ifdef SHEDITOR
|
||||
|
|
|
@ -23,6 +23,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Graphics/SHVkUtil.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
|
||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||
#include "Tools/SHDebugDraw.h"
|
||||
|
||||
namespace SHADE
|
||||
|
@ -98,7 +99,7 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
if (rig && currClip)
|
||||
if (rig && rig->GetRootNode() && currClip)
|
||||
{
|
||||
updatePoseWithClip(0.0f);
|
||||
}
|
||||
|
@ -109,8 +110,11 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
void SHAnimatorComponent::Update(float dt)
|
||||
{
|
||||
//Reset matrices
|
||||
std::fill(boneMatrices.begin(), boneMatrices.end(), SHMatrix::Identity);
|
||||
|
||||
// Nothing to animate
|
||||
if (!currClip || !isPlaying || !rig)
|
||||
if (!currClip || !isPlaying || !rig || !rig->GetRootNode())
|
||||
return;
|
||||
|
||||
// Update time on the playback
|
||||
|
@ -120,12 +124,6 @@ namespace SHADE
|
|||
currPlaybackTime = currPlaybackTime - currClip->GetTotalTime();
|
||||
}
|
||||
|
||||
// Reset all matrices
|
||||
for (auto& mat : boneMatrices)
|
||||
{
|
||||
mat = SHMatrix::Identity;
|
||||
}
|
||||
|
||||
// Play the clip
|
||||
updatePoseWithClip(currPlaybackTime);
|
||||
}
|
||||
|
|
|
@ -142,10 +142,10 @@ namespace SHADE
|
|||
|
||||
|
||||
|
||||
SHVec3 offset{ 0.0f,0.0f, pivot.GetArmLength() };
|
||||
SHVec3 offset{ 0.0f,0.0f, 1.0f };
|
||||
offset = SHVec3::RotateX(offset, -(SHMath::DegreesToRadians(pivot.GetPitch())));
|
||||
offset = SHVec3::RotateY(offset, (SHMath::DegreesToRadians(pivot.GetYaw())));
|
||||
|
||||
offset = SHVec3::Normalise(offset) * pivot.armLength;
|
||||
|
||||
//pivot.rtMatrix = SHMatrix::RotateX(SHMath::DegreesToRadians(pivot.GetPitch()))
|
||||
// * SHMatrix::RotateY(SHMath::DegreesToRadians(pivot.GetYaw()))
|
||||
|
@ -165,7 +165,7 @@ namespace SHADE
|
|||
return;
|
||||
|
||||
|
||||
/*if (SHComponentManager::HasComponent<SHTransformComponent>(camera->GetEID()) == true && camera != &editorCamera)
|
||||
if (SHComponentManager::HasComponent<SHTransformComponent>(camera->GetEID()) == true && camera != &editorCamera)
|
||||
{
|
||||
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera->GetEID());
|
||||
SHVec3 rotation = transform->GetWorldRotation();
|
||||
|
@ -174,14 +174,47 @@ namespace SHADE
|
|||
camera->roll = SHMath::RadiansToDegrees(rotation.z);
|
||||
camera->position = transform->GetWorldPosition();
|
||||
camera->dirtyView = true;
|
||||
}*/
|
||||
}
|
||||
|
||||
pivot.ray.position = camera->GetPosition() + pivot.targetOffset;
|
||||
pivot.ray.direction = SHVec3::Normalise((camera->position + offset)- pivot.ray.position);
|
||||
|
||||
SHVec3 cameraPos = camera->position + pivot.offset;
|
||||
SHVec3 cameraTarget = camera->position;
|
||||
|
||||
//SHLOG_INFO("Ray position: {},{},{} direction:{},{},{}",pivot.ray.position.x, pivot.ray.position.y, pivot.ray.position.z,pivot.ray.direction.x, pivot.ray.direction.y, pivot.ray.direction.z)
|
||||
SHRaycaster::RaycastInfo info;
|
||||
//info.layers = (SHCollisionTagMatrix::GetTag("7")->GetMask());
|
||||
info.layers = (uint16_t)(SHCollisionTagMatrix::GetTag("Camera")->GetMask());
|
||||
info.distance = pivot.armLength;
|
||||
info.continuous = false;
|
||||
info.ray.position = cameraTarget;
|
||||
info.SetColliderID(2);
|
||||
info.ray.direction = SHVec3::Normalise(cameraPos - cameraTarget);
|
||||
auto result = physicsSystem->Raycast(info);
|
||||
for (auto hitResult : result)
|
||||
{
|
||||
if (hitResult.distance < pivot.armLength)
|
||||
{
|
||||
|
||||
//auto result = physicsSystem->Raycast(pivot.ray);
|
||||
SHVec3 newOffset{ 0.0f,0.0f, 1.0f };
|
||||
newOffset = SHVec3::RotateX(newOffset, -(SHMath::DegreesToRadians(pivot.GetPitch())));
|
||||
newOffset = SHVec3::RotateY(newOffset, (SHMath::DegreesToRadians(pivot.GetYaw())));
|
||||
newOffset = SHVec3::Normalise(newOffset) * (hitResult.distance * 0.95f);
|
||||
pivot.offset = newOffset;
|
||||
//cameraPos = camera->position + pivot.offset;
|
||||
//SHLOG_INFO("CAMERA COLLISION HIT, {} armlength: {}, true armlength: {}", hitResult.distance, hitResult.distance, (cameraPos - camera->position).Length());
|
||||
//SHLOG_INFO("Racoon Position {}, {}, {}, Camera Position: {}, {}, {}, Distance {}", cameraTarget.x, cameraTarget.y, cameraTarget.z, cameraPos.x, cameraPos.y, cameraPos.z, SHVec3::Distance(cameraTarget, cameraPos));
|
||||
//SHLOG_INFO("Camera Position: {}, {}, {}", cameraPos.x, cameraPos.y, cameraPos.z);
|
||||
auto otherTransform = SHComponentManager::GetComponent_s<SHTransformComponent>(hitResult.entityHit);
|
||||
SHVec3 otherPos = hitResult.position;
|
||||
|
||||
|
||||
|
||||
//SHLOG_INFO("hit distance{} other pos: {},{},{}, distance between: {}", hitResult.distance, otherPos.x, otherPos.y, otherPos.z, SHVec3::Distance(cameraTarget,otherPos));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
////auto result = physicsSystem->Raycast(pivot.ray);
|
||||
//if (result && result.distance < pivot.GetArmLength())
|
||||
//{
|
||||
//
|
||||
|
@ -196,8 +229,6 @@ namespace SHADE
|
|||
// //SHLOG_INFO("CAMERA COLLISION CANT HIT CAMERA");
|
||||
//}
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
// pivot.rtMatrix = SHMatrix::Inverse(pivot.rtMatrix);
|
||||
|
||||
|
@ -234,7 +265,8 @@ namespace SHADE
|
|||
{
|
||||
camera.offset = arm->GetOffset();
|
||||
if (arm->lookAtCameraOrigin)
|
||||
CameraLookAt(camera, camera.position + arm->GetTargetOffset());
|
||||
CameraLookAt(camera, camera.position);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -418,7 +450,7 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
void SHCameraSystem::DecomposeViewMatrix(SHMatrix const& viewMatrix, float& pitch, float& yaw, float& roll, SHVec3& pos) noexcept
|
||||
void SHCameraSystem::DecomposeViewMatrix(SHMatrix const& viewMatrix, float& pitch, float& yaw, float& roll, SHVec3& pos, bool takePos) noexcept
|
||||
{
|
||||
|
||||
float initPitch = pitch;
|
||||
|
@ -441,15 +473,18 @@ namespace SHADE
|
|||
mtx = SHMatrix::Inverse(mtx);
|
||||
SHVec4 translate = mtx* dotPos;
|
||||
|
||||
pos.x = translate.x;
|
||||
pos.y = translate.y;
|
||||
pos.z = translate.z;
|
||||
if (takePos)
|
||||
{
|
||||
pos.x = translate.x;
|
||||
pos.y = translate.y;
|
||||
pos.z = translate.z;
|
||||
}
|
||||
|
||||
}
|
||||
void SHCameraSystem::SetCameraViewMatrix(SHCameraComponent& camera, SHMatrix const& viewMatrix) noexcept
|
||||
void SHCameraSystem::SetCameraViewMatrix(SHCameraComponent& camera, SHMatrix const& viewMatrix, bool takePos) noexcept
|
||||
{
|
||||
SHVec3 pos;
|
||||
DecomposeViewMatrix(viewMatrix, camera.pitch, camera.yaw, camera.roll, camera.position);
|
||||
DecomposeViewMatrix(viewMatrix, camera.pitch, camera.yaw, camera.roll, camera.position, takePos);
|
||||
|
||||
camera.dirtyView = true;
|
||||
}
|
||||
|
@ -457,7 +492,7 @@ namespace SHADE
|
|||
void SHCameraSystem::CameraLookAt(SHCameraComponent& camera, SHVec3 target) noexcept
|
||||
{
|
||||
|
||||
if (camera.position == target)
|
||||
if (camera.position + camera.offset == target)
|
||||
{
|
||||
//lets off set it abit so the view is nt fked
|
||||
target.z -= 0.0001f;
|
||||
|
@ -499,7 +534,7 @@ namespace SHADE
|
|||
viewMtx(2, 3) = -forward.Dot(camera.position + camera.offset);
|
||||
|
||||
|
||||
SetCameraViewMatrix(camera, viewMtx);
|
||||
SetCameraViewMatrix(camera, viewMtx,false);
|
||||
}
|
||||
|
||||
SHVec2 SHCameraSystem::GetCameraWidthHeight(size_t index) noexcept
|
||||
|
|
|
@ -54,8 +54,8 @@ namespace SHADE
|
|||
void ClampCameraRotation(SHCameraComponent& camera) noexcept;
|
||||
void UpdateEditorCamera(double dt) noexcept;
|
||||
void SetMainCamera(EntityID eid, size_t directorIndex) noexcept;
|
||||
void DecomposeViewMatrix(SHMatrix const& matrix, float& pitch, float& yaw, float& roll, SHVec3& pos) noexcept;
|
||||
void SetCameraViewMatrix(SHCameraComponent& camera, SHMatrix const& viewMatrix) noexcept;
|
||||
void DecomposeViewMatrix(SHMatrix const& matrix, float& pitch, float& yaw, float& roll, SHVec3& pos, bool takePos) noexcept;
|
||||
void SetCameraViewMatrix(SHCameraComponent& camera, SHMatrix const& viewMatrix, bool takePos) noexcept;
|
||||
void CameraLookAt(SHCameraComponent& camera, SHVec3 target) noexcept;
|
||||
void UpdateEditorArm(double dt,bool active ,SHVec3 const& targetPos) noexcept;
|
||||
|
||||
|
|
|
@ -185,12 +185,40 @@ namespace SHADE
|
|||
|
||||
void SHWindow::SetMouseVisible(bool show)
|
||||
{
|
||||
ShowCursor(show ? TRUE : FALSE);
|
||||
if (GetActiveWindow() == wndHWND)
|
||||
ShowCursor(show);
|
||||
}
|
||||
|
||||
void SHWindow::SetMousePosition(unsigned x, unsigned y)
|
||||
void SHWindow::SetMousePosition(int x, int y)
|
||||
{
|
||||
SetCursorPos(x, y);
|
||||
if(GetActiveWindow() == wndHWND)
|
||||
{
|
||||
//if(x == -1)
|
||||
// x = GetSystemMetrics(SM_CXSCREEN) * 0.5;
|
||||
//if (y == -1)
|
||||
// y = GetSystemMetrics(SM_CYSCREEN) * 0.5;
|
||||
//SetCursorPos(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void SHWindow::ClipMouseCursor(int left, int top, int right, int bottom)
|
||||
{
|
||||
if (GetActiveWindow() == wndHWND)
|
||||
{
|
||||
RECT rect{};
|
||||
if (left == 0 || right == 0)
|
||||
{
|
||||
GetClientRect(wndHWND, &rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.left = left;
|
||||
rect.right = right;
|
||||
rect.top = top;
|
||||
rect.bottom = bottom;
|
||||
}
|
||||
ClipCursor(&rect);
|
||||
}
|
||||
}
|
||||
|
||||
//unsigned SHWindow::GetBGColor()
|
||||
|
|
|
@ -106,7 +106,9 @@ namespace SHADE
|
|||
|
||||
void SetMouseVisible(bool show);
|
||||
|
||||
void SetMousePosition(unsigned x, unsigned y);
|
||||
void SetMousePosition(int x = -1, int y = -1);
|
||||
|
||||
void ClipMouseCursor(int left = 0, int top = 0, int right = 0, int bottom = 0);
|
||||
|
||||
//unsigned GetBGColor();
|
||||
|
||||
|
@ -144,7 +146,6 @@ namespace SHADE
|
|||
|
||||
void SetHWND(HWND hwnd);
|
||||
|
||||
|
||||
HWND wndHWND = nullptr;
|
||||
|
||||
HINSTANCE hInstance = nullptr;
|
||||
|
|
Loading…
Reference in New Issue