Fix bugs and add Pause for the game in #364
|
@ -4,5 +4,5 @@
|
||||||
Properties:
|
Properties:
|
||||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
data.textureIndex: 51995224
|
data.textureIndex: 51995224
|
||||||
data.alpha: 0
|
data.alpha: 1
|
||||||
data.beta: {x: 1, y: 1, z: 1}
|
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -4,5 +4,5 @@
|
||||||
Properties:
|
Properties:
|
||||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
data.textureIndex: 54429632
|
data.textureIndex: 54429632
|
||||||
data.alpha: 0
|
data.alpha: 1
|
||||||
data.beta: {x: 1, y: 1, z: 1}
|
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -8540,6 +8540,7 @@
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 157
|
- EID: 157
|
||||||
Name: Mesh_Meat
|
Name: Mesh_Meat
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -8587,6 +8588,7 @@
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 156
|
- EID: 156
|
||||||
Name: Mesh_Meat
|
Name: Mesh_Meat
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -8634,6 +8636,7 @@
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 155
|
- EID: 155
|
||||||
Name: Mesh_Cheese
|
Name: Mesh_Cheese
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -8681,6 +8684,7 @@
|
||||||
currCategory: 2
|
currCategory: 2
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 154
|
- EID: 154
|
||||||
Name: Mesh_Cheese
|
Name: Mesh_Cheese
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -8728,6 +8732,7 @@
|
||||||
currCategory: 2
|
currCategory: 2
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 153
|
- EID: 153
|
||||||
Name: Mesh_Cheese
|
Name: Mesh_Cheese
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -8775,6 +8780,7 @@
|
||||||
currCategory: 2
|
currCategory: 2
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 65778
|
- EID: 65778
|
||||||
Name: Mesh_Apple
|
Name: Mesh_Apple
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -8822,6 +8828,7 @@
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 152
|
- EID: 152
|
||||||
Name: Mesh_Apple
|
Name: Mesh_Apple
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -8869,6 +8876,7 @@
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 151
|
- EID: 151
|
||||||
Name: Mesh_Apple
|
Name: Mesh_Apple
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -8916,6 +8924,7 @@
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 65686
|
- EID: 65686
|
||||||
Name: Watermelon
|
Name: Watermelon
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -8967,6 +8976,7 @@
|
||||||
currCategory: 2
|
currCategory: 2
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 131220
|
- EID: 131220
|
||||||
Name: Piece1
|
Name: Piece1
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -9014,6 +9024,7 @@
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 131219
|
- EID: 131219
|
||||||
Name: Piece2
|
Name: Piece2
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -9061,6 +9072,7 @@
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 131221
|
- EID: 131221
|
||||||
Name: Piece3
|
Name: Piece3
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -9108,6 +9120,7 @@
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 145
|
- EID: 145
|
||||||
Name: Piece4
|
Name: Piece4
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -9155,6 +9168,7 @@
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 196754
|
- EID: 196754
|
||||||
Name: Piece5
|
Name: Piece5
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -9202,6 +9216,7 @@
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
density: 3
|
density: 3
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 144
|
- EID: 144
|
||||||
Name: Egg
|
Name: Egg
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -9253,6 +9268,7 @@
|
||||||
currCategory: 0
|
currCategory: 0
|
||||||
density: 2
|
density: 2
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 143
|
- EID: 143
|
||||||
Name: Piece1
|
Name: Piece1
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -9662,7 +9678,7 @@
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 2.35245037, y: 0.38365531, z: 7.10571432}
|
Translate: {x: 2.35245037, y: 0.38365531, z: 7.10571432}
|
||||||
Rotate: {x: -0, y: 0, z: -0}
|
Rotate: {x: 0, y: 0.326376587, z: 0.0698131472}
|
||||||
Scale: {x: 0.999999881, y: 1, z: 0.999999881}
|
Scale: {x: 0.999999881, y: 1, z: 0.999999881}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
|
@ -9740,7 +9756,7 @@
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: -5.96046448e-08, z: 0}
|
Translate: {x: 0, y: -5.96046448e-08, z: 0}
|
||||||
Rotate: {x: 0, y: 6.28318548, z: 2.23517329e-08}
|
Rotate: {x: 0, y: 5.95680904, z: -0.0698131248}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Camera Component:
|
Camera Component:
|
||||||
|
@ -9748,8 +9764,8 @@
|
||||||
Pitch: 0
|
Pitch: 0
|
||||||
Yaw: 360
|
Yaw: 360
|
||||||
Roll: 1.28065994e-06
|
Roll: 1.28065994e-06
|
||||||
Width: 2560
|
Width: 1055
|
||||||
Height: 1369
|
Height: 604
|
||||||
Near: 0.00999999978
|
Near: 0.00999999978
|
||||||
Far: 10000
|
Far: 10000
|
||||||
Perspective: true
|
Perspective: true
|
||||||
|
@ -10521,14 +10537,14 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 2.70000005, y: 0.100000001, z: -2}
|
Translate: {x: 0, y: 0, z: -2.64324665}
|
||||||
Rotate: {x: -0, y: 0, z: -0}
|
Rotate: {x: -0, y: 0, z: -0}
|
||||||
Scale: {x: 1, y: 1, z: 1}
|
Scale: {x: 1, y: 1, z: 1}
|
||||||
IsActive: false
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 140697366
|
Mesh: 140697366
|
||||||
Material: 129495479
|
Material: 129495479
|
||||||
IsActive: false
|
IsActive: true
|
||||||
RigidBody Component:
|
RigidBody Component:
|
||||||
Type: Dynamic
|
Type: Dynamic
|
||||||
Drag: 0.00999999978
|
Drag: 0.00999999978
|
||||||
|
@ -10542,7 +10558,7 @@
|
||||||
Freeze Rotation X: true
|
Freeze Rotation X: true
|
||||||
Freeze Rotation Y: false
|
Freeze Rotation Y: false
|
||||||
Freeze Rotation Z: true
|
Freeze Rotation Z: true
|
||||||
IsActive: false
|
IsActive: true
|
||||||
Collider Component:
|
Collider Component:
|
||||||
Colliders:
|
Colliders:
|
||||||
- Is Trigger: false
|
- Is Trigger: false
|
||||||
|
@ -10554,7 +10570,7 @@
|
||||||
Density: 1
|
Density: 1
|
||||||
Position Offset: {x: 0, y: 0.899999976, z: 0}
|
Position Offset: {x: 0, y: 0.899999976, z: 0}
|
||||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||||
IsActive: false
|
IsActive: true
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: Homeowner1
|
- Type: Homeowner1
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -10614,6 +10630,7 @@
|
||||||
currCategory: 1
|
currCategory: 1
|
||||||
density: 1
|
density: 1
|
||||||
dontReturn: false
|
dontReturn: false
|
||||||
|
soundDistance: 10
|
||||||
- EID: 16
|
- EID: 16
|
||||||
Name: JumpPad
|
Name: JumpPad
|
||||||
IsActive: false
|
IsActive: false
|
||||||
|
@ -10641,13 +10658,13 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- EID: 10
|
- EID: 10
|
||||||
Name: Canvas
|
Name: Canvas
|
||||||
IsActive: false
|
IsActive: true
|
||||||
NumberOfChildren: 3
|
NumberOfChildren: 3
|
||||||
Components:
|
Components:
|
||||||
Canvas Component:
|
Canvas Component:
|
||||||
Canvas Width: 1920
|
Canvas Width: 1920
|
||||||
Canvas Height: 1080
|
Canvas Height: 1080
|
||||||
IsActive: false
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 8
|
- EID: 8
|
||||||
Name: ResumeButton
|
Name: ResumeButton
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: 0, z: 0}
|
Translate: {x: 0, y: 0, z: 0.5}
|
||||||
Rotate: {x: 0, y: 0, z: 0}
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
Scale: {x: 1920, y: 1080, z: 1}
|
Scale: {x: 1920, y: 1080, z: 1}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: 75, z: 0}
|
Translate: {x: 0, y: 75, z: 0.400000006}
|
||||||
Rotate: {x: 0, y: 0, z: 0}
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
Scale: {x: 400, y: 200, z: 1}
|
Scale: {x: 400, y: 200, z: 1}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Transform Component:
|
||||||
Translate: {x: 0, y: -200, z: 0}
|
Translate: {x: 0, y: -200, z: 0.400000006}
|
||||||
Rotate: {x: 0, y: 0, z: 0}
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
Scale: {x: 400, y: 200, z: 1}
|
Scale: {x: 400, y: 200, z: 1}
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -129,3 +129,4 @@
|
||||||
- Type: MainMenu
|
- Type: MainMenu
|
||||||
Enabled: true
|
Enabled: true
|
||||||
sceneID: 96668835
|
sceneID: 96668835
|
||||||
|
obj: 1
|
|
@ -111,6 +111,7 @@
|
||||||
Near: 0.00999999978
|
Near: 0.00999999978
|
||||||
Far: 10000
|
Far: 10000
|
||||||
Perspective: true
|
Perspective: true
|
||||||
|
FOV: 90
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 4
|
- EID: 4
|
||||||
|
|
|
@ -74,6 +74,9 @@ public partial class Homeowner1 : BehaviourTree
|
||||||
private float footstepSFXIntervalMultiplier;
|
private float footstepSFXIntervalMultiplier;
|
||||||
|
|
||||||
private float footstepTimeRemaining;
|
private float footstepTimeRemaining;
|
||||||
|
|
||||||
|
//singleton for AI
|
||||||
|
public static Homeowner1 aiInstance { get; private set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
//AI tree
|
//AI tree
|
||||||
|
@ -111,6 +114,11 @@ public partial class Homeowner1 : BehaviourTree
|
||||||
AudioHandler.audioClipHandlers["SFXFootstep"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
|
AudioHandler.audioClipHandlers["SFXFootstep"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
|
||||||
AudioHandler.audioClipHandlers["SFXDetectAh"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_detect_raccoon");
|
AudioHandler.audioClipHandlers["SFXDetectAh"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_detect_raccoon");
|
||||||
AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected");
|
AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected");
|
||||||
|
|
||||||
|
if (aiInstance != null && aiInstance != this)
|
||||||
|
RemoveScript<Homeowner1>();
|
||||||
|
else
|
||||||
|
aiInstance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Called every tick
|
//Called every tick
|
||||||
|
@ -182,4 +190,10 @@ public partial class Homeowner1 : BehaviourTree
|
||||||
//Debug.Log("Tree Created");
|
//Debug.Log("Tree Created");
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void onDestroy()
|
||||||
|
{
|
||||||
|
if (aiInstance == this)
|
||||||
|
aiInstance = null;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -24,6 +24,10 @@ public class Item : Script
|
||||||
public bool dontReturn = false;
|
public bool dontReturn = false;
|
||||||
|
|
||||||
|
|
||||||
|
private bool checkSound = false;
|
||||||
|
public float soundDistance = 10;
|
||||||
|
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
transform = GetComponent<Transform>();
|
transform = GetComponent<Transform>();
|
||||||
|
@ -55,10 +59,25 @@ public class Item : Script
|
||||||
|
|
||||||
returnBack = false;
|
returnBack = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (checkSound)
|
||||||
|
{
|
||||||
|
/* //need to wait for collisionEnter Fix
|
||||||
|
Vector3 itemPos = transform.LocalPosition;
|
||||||
|
Vector3 len = Homeowner1.aiInstance.GetComponent<Transform>().LocalPosition - itemPos;
|
||||||
|
Debug.Log($"distance: {len.GetSqrMagnitude()}");
|
||||||
|
if (len.GetSqrMagnitude() <= soundDistance)
|
||||||
|
{
|
||||||
|
//set ai to alert
|
||||||
|
}
|
||||||
|
checkSound = false;*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void onCollisionEnter(CollisionInfo info)
|
protected override void onCollisionEnter(CollisionInfo info)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!caputurePos)
|
if (!caputurePos)
|
||||||
{
|
{
|
||||||
firstPostion = transform.LocalPosition;
|
firstPostion = transform.LocalPosition;
|
||||||
|
@ -83,6 +102,7 @@ public class Item : Script
|
||||||
protected override void onCollisionExit(CollisionInfo info)
|
protected override void onCollisionExit(CollisionInfo info)
|
||||||
{
|
{
|
||||||
playSound = true;
|
playSound = true;
|
||||||
|
checkSound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -26,6 +26,7 @@ public class PickAndThrow : Script
|
||||||
private float lastZDir;
|
private float lastZDir;
|
||||||
private bool inRange = false;
|
private bool inRange = false;
|
||||||
public bool throwItem = false;
|
public bool throwItem = false;
|
||||||
|
private Vector3 prevTargetOffSet;
|
||||||
|
|
||||||
[Tooltip("Lenght of ray")]
|
[Tooltip("Lenght of ray")]
|
||||||
public float rayDistance = 1;
|
public float rayDistance = 1;
|
||||||
|
@ -56,8 +57,12 @@ public class PickAndThrow : Script
|
||||||
}
|
}
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
|
if (GameManager.Instance.GamePause)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(timer <= delayTimer)
|
if (timer <= delayTimer)
|
||||||
timer += Time.DeltaTimeF;
|
timer += Time.DeltaTimeF;
|
||||||
|
|
||||||
CalculateDir();
|
CalculateDir();
|
||||||
|
@ -76,6 +81,7 @@ public class PickAndThrow : Script
|
||||||
{
|
{
|
||||||
pc.isAiming = true;
|
pc.isAiming = true;
|
||||||
pc.camArm.ArmLength = aimingLength;
|
pc.camArm.ArmLength = aimingLength;
|
||||||
|
prevTargetOffSet = pc.camArm.TargetOffset;
|
||||||
pc.camArm.TargetOffset = cameraArmOffSet;
|
pc.camArm.TargetOffset = cameraArmOffSet;
|
||||||
pc.cam.FOV = aimingFOV;
|
pc.cam.FOV = aimingFOV;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +92,7 @@ public class PickAndThrow : Script
|
||||||
itemRidigBody.IsGravityEnabled = true;
|
itemRidigBody.IsGravityEnabled = true;
|
||||||
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
||||||
pc.isAiming = false;
|
pc.isAiming = false;
|
||||||
pc.camArm.TargetOffset = Vector3.Zero;
|
pc.camArm.TargetOffset = prevTargetOffSet;
|
||||||
pc.cam.FOV = defaultFOV;
|
pc.cam.FOV = defaultFOV;
|
||||||
if (tpc)
|
if (tpc)
|
||||||
pc.camArm.ArmLength = tpc.armLength;
|
pc.camArm.ArmLength = tpc.armLength;
|
||||||
|
@ -109,7 +115,7 @@ public class PickAndThrow : Script
|
||||||
{
|
{
|
||||||
pc.isAiming = false;
|
pc.isAiming = false;
|
||||||
pc.cam.FOV = defaultFOV;
|
pc.cam.FOV = defaultFOV;
|
||||||
pc.camArm.TargetOffset = Vector3.Zero;
|
pc.camArm.TargetOffset = prevTargetOffSet;
|
||||||
if (tpc)
|
if (tpc)
|
||||||
pc.camArm.ArmLength = tpc.armLength;
|
pc.camArm.ArmLength = tpc.armLength;
|
||||||
}
|
}
|
||||||
|
@ -134,6 +140,11 @@ public class PickAndThrow : Script
|
||||||
|
|
||||||
protected override void fixedUpdate()
|
protected override void fixedUpdate()
|
||||||
{
|
{
|
||||||
|
if (GameManager.Instance.GamePause)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (throwItem && itemRidigBody && pc)
|
if (throwItem && itemRidigBody && pc)
|
||||||
{
|
{
|
||||||
if (itemScript)
|
if (itemScript)
|
||||||
|
|
|
@ -124,8 +124,14 @@ public class PlayerController : Script
|
||||||
protected override void lateUpdate()
|
protected override void lateUpdate()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
|
if (GameManager.Instance.GamePause)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (delayTimer <= 1)
|
if (delayTimer <= 1)
|
||||||
delayTimer += Time.DeltaTimeF;
|
delayTimer += Time.DeltaTimeF;
|
||||||
|
|
||||||
|
@ -158,22 +164,27 @@ public class PlayerController : Script
|
||||||
if (tranform)
|
if (tranform)
|
||||||
tranform.LocalEulerAngles = new Vector3(0.0f, tranform.LocalEulerAngles.y, 0.0f);
|
tranform.LocalEulerAngles = new Vector3(0.0f, tranform.LocalEulerAngles.y, 0.0f);
|
||||||
|
|
||||||
|
GotCaught();
|
||||||
Rotation();
|
Rotation();
|
||||||
MoveKey();
|
MoveKey();
|
||||||
Sprint();
|
Sprint();
|
||||||
Jump();
|
Jump();
|
||||||
GotCaught();
|
|
||||||
//Debug.Log($"{currentState}");
|
//Debug.Log($"{currentState}");
|
||||||
//Debug.Log($" axisX: {axisMove.x} axisY:{axisMove.y}");
|
//Debug.Log($" axisX: {axisMove.x} axisY:{axisMove.y}");
|
||||||
//Debug.Log($"X: {rb.LinearVelocity.x}" + $" Z: {rb.LinearVelocity.z}");
|
//Debug.Log($"X: {rb.LinearVelocity.x}" + $" Z: {rb.LinearVelocity.z}");
|
||||||
//Debug.Log(currentState.ToString() + " x:" + rb.LinearVelocity.x.ToString() + " y:" + rb.LinearVelocity.y.ToString() + " z:" + rb.LinearVelocity.z.ToString());
|
//Debug.Log(currentState.ToString() + " x:" + rb.LinearVelocity.x.ToString() + " y:" + rb.LinearVelocity.y.ToString() + " z:" + rb.LinearVelocity.z.ToString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void fixedUpdate()
|
protected override void fixedUpdate()
|
||||||
{
|
{
|
||||||
|
if (GameManager.Instance.GamePause)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Move();
|
Move();
|
||||||
Gravity();
|
Gravity();
|
||||||
//Debug.Log($"X: {rb.LinearVelocity.x}" + $" Z: {rb.LinearVelocity.z}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,7 +245,7 @@ public class PlayerController : Script
|
||||||
|
|
||||||
private void Move()
|
private void Move()
|
||||||
{
|
{
|
||||||
if (rb != null)
|
if (rb != null && currentState != RaccoonStates.CAUGHT)
|
||||||
{
|
{
|
||||||
rb.LinearVelocity += new Vector3(axisMove.x * moveForce, 0.0f, axisMove.y * moveForce) * Time.DeltaTimeF;
|
rb.LinearVelocity += new Vector3(axisMove.x * moveForce, 0.0f, axisMove.y * moveForce) * Time.DeltaTimeF;
|
||||||
|
|
||||||
|
@ -286,7 +297,6 @@ public class PlayerController : Script
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//press and hold jump
|
|
||||||
private void Jump()
|
private void Jump()
|
||||||
{
|
{
|
||||||
if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING || currentState == RaccoonStates.IDLE)
|
if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING || currentState == RaccoonStates.IDLE)
|
||||||
|
|
|
@ -41,6 +41,11 @@ namespace SHADE_Scripting
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
|
if (GameManager.Instance.GamePause)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CameraArm arm = GetComponent<CameraArm>();
|
CameraArm arm = GetComponent<CameraArm>();
|
||||||
if (arm)
|
if (arm)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,13 +38,11 @@ public class GameManager : Script
|
||||||
private Vector3 fontScalar;
|
private Vector3 fontScalar;
|
||||||
|
|
||||||
public static GameManager Instance { get; private set; }
|
public static GameManager Instance { get; private set; }
|
||||||
//public static int highScore { get; private set; } maybe need
|
|
||||||
|
|
||||||
public bool GamePause { get; set; }
|
public bool GamePause { get; set; }
|
||||||
|
|
||||||
protected override void start()
|
protected override void start()
|
||||||
{
|
{
|
||||||
base.start();
|
|
||||||
|
|
||||||
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
|
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
|
||||||
AudioHandler.audioClipHandlers["BGMAdaptive"].Play();
|
AudioHandler.audioClipHandlers["BGMAdaptive"].Play();
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Name: SC_JumpPad
|
||||||
|
ID: 163951275
|
||||||
|
Type: 9
|
|
@ -5,6 +5,10 @@ using SHADE_Scripting.Audio;
|
||||||
public class MainMenu : Script
|
public class MainMenu : Script
|
||||||
{
|
{
|
||||||
public uint sceneID;
|
public uint sceneID;
|
||||||
|
|
||||||
|
public GameObject obj;
|
||||||
|
private Renderable renderable;
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
|
AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
|
||||||
|
@ -12,9 +16,31 @@ public class MainMenu : Script
|
||||||
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||||
//Audio.PlayBGMOnce2D("event:/Music/main_menu");
|
//Audio.PlayBGMOnce2D("event:/Music/main_menu");
|
||||||
AudioHandler.audioClipHandlers["BGMMainMenu"].Play();
|
AudioHandler.audioClipHandlers["BGMMainMenu"].Play();
|
||||||
|
|
||||||
|
renderable = obj.GetComponent<Renderable>();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void start()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
|
if (Input.GetKeyDown(Input.KeyCode.K) && obj)
|
||||||
|
{
|
||||||
|
if (renderable.Material.GetProperty<float>("data.alpha") == 1)
|
||||||
|
{
|
||||||
|
Debug.Log("ALPHA ZERO");
|
||||||
|
Debug.Log($"{obj.EntityId}");
|
||||||
|
obj.GetComponent<Renderable>().Material.SetProperty<float>("data.alpha", 0);
|
||||||
|
}
|
||||||
|
else if (renderable.Material.GetProperty<float>("data.alpha") == 0)
|
||||||
|
{
|
||||||
|
Debug.Log("ALPHA ONE");
|
||||||
|
Debug.Log($"{obj.EntityId}");
|
||||||
|
obj.GetComponent<Renderable>().Material.SetProperty<float>("data.alpha", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown(Input.KeyCode.Space))
|
if (Input.GetKeyDown(Input.KeyCode.Space))
|
||||||
{
|
{
|
||||||
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||||
|
|
|
@ -59,8 +59,7 @@ public class PauseMenu : Script
|
||||||
retry.OnClick.RegisterAction(() =>
|
retry.OnClick.RegisterAction(() =>
|
||||||
{
|
{
|
||||||
Audio.StopAllSounds();
|
Audio.StopAllSounds();
|
||||||
//get curr scene
|
SceneManager.RestartScene();
|
||||||
//SceneManager.ChangeScene();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -86,10 +85,6 @@ public class PauseMenu : Script
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
if (GameManager.Instance.GamePause)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause)
|
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,10 +5,8 @@
|
||||||
|
|
||||||
struct MatPropData
|
struct MatPropData
|
||||||
{
|
{
|
||||||
vec4 color;
|
|
||||||
int textureIndex;
|
int textureIndex;
|
||||||
float alpha;
|
float alpha;
|
||||||
vec3 beta;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(location = 0) in struct
|
layout(location = 0) in struct
|
||||||
|
@ -43,6 +41,8 @@ void main()
|
||||||
{
|
{
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
fragColor.a = MatProp.data[In2.materialIndex].alpha;
|
||||||
|
|
||||||
|
// fragColor.a = 1.0f;
|
||||||
outEntityID = In2.eid;
|
outEntityID = In2.eid;
|
||||||
}
|
}
|
Binary file not shown.
|
@ -58,8 +58,11 @@ void main()
|
||||||
Out.normal.rgb = transposeInv * aNormal.rgb;
|
Out.normal.rgb = transposeInv * aNormal.rgb;
|
||||||
Out.normal.rgb = normalize (Out.normal.rgb);
|
Out.normal.rgb = normalize (Out.normal.rgb);
|
||||||
|
|
||||||
|
vec3 vert = aVertexPos;
|
||||||
|
vert.z += 0.1f;
|
||||||
|
|
||||||
// clip space for rendering
|
// clip space for rendering
|
||||||
gl_Position = cameraData.projMat * worldTransform * vec4 (aVertexPos, 1.0f);
|
gl_Position = cameraData.projMat * worldTransform * vec4 (vert, 1.0f);
|
||||||
gl_Position.z += 0.1f; // HAX
|
// gl_Position.z += 0.1f; // HAX
|
||||||
// gl_Position = vec4 (aVertexPos, 1.0f);
|
// gl_Position = vec4 (aVertexPos, 1.0f);
|
||||||
}
|
}
|
Binary file not shown.
|
@ -59,7 +59,7 @@ namespace SHADE
|
||||||
camSystem->UpdateEditorArm(SHFrameRateController::GetRawDeltaTime(), shouldUpdateCamArm, targetPos);
|
camSystem->UpdateEditorArm(SHFrameRateController::GetRawDeltaTime(), shouldUpdateCamArm, targetPos);
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||||
if (Begin())
|
if (Begin())
|
||||||
{
|
{
|
||||||
ImGuizmo::SetDrawlist();
|
ImGuizmo::SetDrawlist();
|
||||||
|
@ -101,6 +101,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ImGui::PopStyleColor();
|
||||||
ImGuizmo::SetRect(beginCursorPos.x, beginCursorPos.y, beginContentRegionAvailable.x, beginContentRegionAvailable.y);
|
ImGuizmo::SetRect(beginCursorPos.x, beginCursorPos.y, beginContentRegionAvailable.x, beginContentRegionAvailable.y);
|
||||||
if(editor->editorState != SHEditor::State::PLAY)
|
if(editor->editorState != SHEditor::State::PLAY)
|
||||||
transformGizmo.Draw();
|
transformGizmo.Draw();
|
||||||
|
|
|
@ -345,7 +345,7 @@ namespace SHADE
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Should be deactivated
|
// Should be deactivated
|
||||||
static const SHMatrix ZERO_MTX =
|
static const SHMatrix ZERO_MTX
|
||||||
{
|
{
|
||||||
0.0f, 0.0f, 0.0f, 0.0f,
|
0.0f, 0.0f, 0.0f, 0.0f,
|
||||||
0.0f, 0.0f, 0.0f, 0.0f,
|
0.0f, 0.0f, 0.0f, 0.0f,
|
||||||
|
|
|
@ -350,10 +350,17 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
/* SCREEN SPACE PASS */
|
/* SCREEN SPACE PASS */
|
||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
auto screenSpaceNode = renderGraph->AddNode(SHGraphicsConstants::RenderGraphEntityNames::SCREEN_SPACE_PASS.data(), {"Scene", "Entity ID"}, {SHGraphicsConstants::RenderGraphEntityNames::DEFERRED_COMPOSITE_PASS.data(), SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data(), SHGraphicsConstants::RenderGraphEntityNames::DEBUG_DRAW.data()});
|
auto screenSpaceNode = renderGraph->AddNode(SHGraphicsConstants::RenderGraphEntityNames::SCREEN_SPACE_PASS.data(), { "Scene", "Entity ID", "Depth Buffer" },
|
||||||
|
{
|
||||||
|
SHGraphicsConstants::RenderGraphEntityNames::DEFERRED_COMPOSITE_PASS.data(),
|
||||||
|
SHGraphicsConstants::RenderGraphEntityNames::GBUFFER_PASS.data(),
|
||||||
|
SHGraphicsConstants::RenderGraphEntityNames::DEBUG_DRAW.data(),
|
||||||
|
SHGraphicsConstants::RenderGraphEntityNames::DEBUG_DRAW_DEPTH_PASS.data()
|
||||||
|
});
|
||||||
auto uiSubpass = screenSpaceNode->AddSubpass(SHGraphicsConstants::RenderGraphEntityNames::UI_SUBPASS.data(), worldViewport, screenRenderer);
|
auto uiSubpass = screenSpaceNode->AddSubpass(SHGraphicsConstants::RenderGraphEntityNames::UI_SUBPASS.data(), worldViewport, screenRenderer);
|
||||||
uiSubpass->AddColorOutput("Scene");
|
uiSubpass->AddColorOutput("Scene");
|
||||||
uiSubpass->AddColorOutput("Entity ID");
|
uiSubpass->AddColorOutput("Entity ID");
|
||||||
|
uiSubpass->AddDepthOutput("Depth Buffer");
|
||||||
uiSubpass->AddExteriorDrawCalls([=](Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHRenderer> renderer, uint32_t frameIndex)
|
uiSubpass->AddExteriorDrawCalls([=](Handle<SHVkCommandBuffer> cmdBuffer, Handle<SHRenderer> renderer, uint32_t frameIndex)
|
||||||
{
|
{
|
||||||
textRenderingSubSystem->Render(cmdBuffer, renderer, frameIndex);
|
textRenderingSubSystem->Render(cmdBuffer, renderer, frameIndex);
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace SHADE
|
||||||
if (SHVkUtil::IsDepthStencilAttachment(vkDescriptions[i].format))
|
if (SHVkUtil::IsDepthStencilAttachment(vkDescriptions[i].format))
|
||||||
clearColors[i].depthStencil = vk::ClearDepthStencilValue(1.0f, 0);
|
clearColors[i].depthStencil = vk::ClearDepthStencilValue(1.0f, 0);
|
||||||
else
|
else
|
||||||
clearColors[i].color = { {{0.0f, 0.0f, 0.0f, 1.0f}} };
|
clearColors[i].color = { {{0.0f, 0.0f, 0.0f, 0.0f}} };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,4 +22,12 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
SHSceneManager::RestartScene(sceneAssetID);
|
SHSceneManager::RestartScene(sceneAssetID);
|
||||||
}
|
}
|
||||||
|
void SceneManager::RestartScene()
|
||||||
|
{
|
||||||
|
SHSceneManager::RestartScene();
|
||||||
|
}
|
||||||
|
AssetID SceneManager::GetCurrentSceneID()
|
||||||
|
{
|
||||||
|
return SHSceneManager::GetCurrentSceneAssetID();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -23,5 +23,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
static void ChangeScene(AssetID sceneAssetID);
|
static void ChangeScene(AssetID sceneAssetID);
|
||||||
|
static void RestartScene();
|
||||||
|
static AssetID GetCurrentSceneID();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue