added playerstate scripts

added sub folders for player
remove unneeded scripts
This commit is contained in:
Glence 2022-11-20 16:27:39 +08:00
parent 61acbdc34e
commit 875657cfde
39 changed files with 443 additions and 270 deletions

View File

@ -44,6 +44,7 @@
Angular Drag: 0.00999999978 Angular Drag: 0.00999999978
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -68,7 +69,7 @@
NumberOfChildren: 3 NumberOfChildren: 3
Components: Components:
Transform Component: Transform Component:
Translate: {x: -18.9007454, y: -3.67369723, z: -5.23871422} Translate: {x: -21.4454765, y: -3.67383885, z: -3.43293667}
Rotate: {x: -0, y: 0, z: 0} Rotate: {x: -0, y: 0, z: 0}
Scale: {x: 2, y: 2, z: 2} Scale: {x: 2, y: 2, z: 2}
IsActive: true IsActive: true
@ -83,6 +84,7 @@
Angular Drag: 0 Angular Drag: 0
Use Gravity: false Use Gravity: false
Interpolate: false Interpolate: false
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -114,16 +116,15 @@
mediumMultiper: 0.5 mediumMultiper: 0.5
heavyMultiper: 0.25 heavyMultiper: 0.25
- Type: PickAndThrow - Type: PickAndThrow
holdPosition: [0, 1.20000005, 0]
throwForce: [200, 300, 200] throwForce: [200, 300, 200]
- EID: 3 - EID: 3
Name: Default Name: HoldingPoint
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 1.20000005, z: 0} Translate: {x: 0, y: 1.20000005, z: 0.5}
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: true IsActive: true
Scripts: ~ Scripts: ~
@ -134,13 +135,13 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0} Translate: {x: 0, y: 0, z: 0}
Rotate: {x: -0.785401046, y: 1.65799224, z: 0} Rotate: {x: -0.607372105, y: 4.78226185, z: 0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Camera Component: Camera Component:
Position: {x: -18.9007454, y: -3.67369723, z: -5.23871422} Position: {x: -21.4454765, y: -3.67383885, z: -3.43293667}
Pitch: -45.000164 Pitch: -34.7998581
Yaw: 94.9959564 Yaw: 274.003418
Roll: 0 Roll: 0
Width: 1920 Width: 1920
Height: 1080 Height: 1080
@ -190,6 +191,7 @@
Angular Drag: 0 Angular Drag: 0
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -254,6 +256,7 @@
Angular Drag: 0.00999999978 Angular Drag: 0.00999999978
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -267,11 +270,11 @@
Scripts: Scripts:
- Type: GameManager - Type: GameManager
itemPool: 12 itemPool: 12
zonePool: 51000 zonePool: 15
currGameState: 0 currGameState: 3
totalItemCount: -202 totalItemCount: 2
Score: 204 Score: 0
timer: 0 timer: 4.00741768
- EID: 12 - EID: 12
Name: ItemPool Name: ItemPool
IsActive: true IsActive: true
@ -284,8 +287,8 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 3.19870043, y: -3.67369723, z: -5} Translate: {x: 3.19867921, y: -3.66373587, z: -4.99996376}
Rotate: {x: -0, y: 0, z: 0} Rotate: {x: -9.79829474e-06, y: 1.93362598e-06, z: 2.07606699e-05}
Scale: {x: 2, y: 2, z: 2} Scale: {x: 2, y: 2, z: 2}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
@ -299,12 +302,13 @@
Angular Drag: 0 Angular Drag: 0
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
Freeze Rotation X: true Freeze Rotation X: false
Freeze Rotation Y: true Freeze Rotation Y: false
Freeze Rotation Z: true Freeze Rotation Z: false
IsActive: true IsActive: true
Collider Component: Collider Component:
Colliders: Colliders:
@ -333,45 +337,46 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: -20.6163979, y: -0.0419634879, z: -5.08873653} Translate: {x: -21.4424801, y: -1.21456838, z: -1.82083583}
Rotate: {x: -0, y: 0, z: 0} Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 2, y: 2, z: 2} Scale: {x: 2, y: 2, z: 2}
IsActive: false IsActive: true
Renderable Component: Renderable Component:
Mesh: 144838771 Mesh: 144838771
Material: 123745521 Material: 123745521
IsActive: false IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Mass: 1 Mass: 1
Drag: 0 Drag: 5
Angular Drag: 0 Angular Drag: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
Freeze Rotation X: true Freeze Rotation X: false
Freeze Rotation Y: true Freeze Rotation Y: false
Freeze Rotation Z: true Freeze Rotation Z: false
IsActive: false IsActive: true
Collider Component: Collider Component:
Colliders: Colliders:
- Is Trigger: false - Is Trigger: false
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1} Half Extents: {x: 0.5, y: 0.5, z: 0.5}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0.5, z: 0} Position Offset: {x: 0, y: 0.5, z: 0}
- Is Trigger: true - Is Trigger: true
Type: Box Type: Box
Half Extents: {x: 2, y: 2, z: 2} Half Extents: {x: 1, y: 1, z: 1}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0.5, z: 0} Position Offset: {x: 0, y: 0.5, z: 0}
IsActive: false IsActive: true
Scripts: Scripts:
- Type: Item - Type: Item
Score: 1 Score: 1
@ -388,8 +393,8 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: -24.5947151, y: -3.15127993, z: -3.29243231} Translate: {x: -24.4654179, y: -3.15127993, z: -3.29243231}
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: true IsActive: true
RigidBody Component: RigidBody Component:
@ -399,6 +404,7 @@
Angular Drag: 0.00999999978 Angular Drag: 0.00999999978
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -416,7 +422,8 @@
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: ~ Scripts:
- Type: ScoringZone
- EID: 14 - EID: 14
Name: ScoreZone Name: ScoreZone
IsActive: true IsActive: true
@ -434,6 +441,7 @@
Angular Drag: 0.00999999978 Angular Drag: 0.00999999978
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -451,4 +459,5 @@
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: ~ Scripts:
- Type: ScoringZone

View File

@ -1,23 +0,0 @@
using SHADE;
using System;
public class CameraFix : Script
{
private Transform tranform;
public Vector3 pos = Vector3.Zero;
public Vector3 rot = Vector3.Zero;
protected override void awake()
{
tranform = GetComponent<Transform>();
if (tranform == null)
Debug.LogError("tranform is NULL!");
else
{
tranform.LocalPosition = pos;
tranform.LocalEulerAngles = rot;
}
}
}

View File

@ -1,3 +0,0 @@
Name: CameraFix
ID: 162231964
Type: 9

View File

@ -4,7 +4,6 @@ using static PlayerController;
public class PickAndThrow : Script public class PickAndThrow : Script
{ {
public Vector3 holdPosition = new Vector3(0.0f, 1.0f, 0.0f);
public Vector3 throwForce = new Vector3(100.0f, 200.0f, 100.0f); public Vector3 throwForce = new Vector3(100.0f, 200.0f, 100.0f);
public GameObject item { get; set; } public GameObject item { get; set; }
private PlayerController pc; private PlayerController pc;
@ -22,34 +21,40 @@ public class PickAndThrow : Script
raccoonHoldLocation = GetComponentInChildren<Transform>(); raccoonHoldLocation = GetComponentInChildren<Transform>();
if (raccoonHoldLocation == null) if (raccoonHoldLocation == null)
Debug.Log("CHILD EMPTY"); Debug.Log("CHILD EMPTY");
else
raccoonHoldLocation.LocalPosition = holdPosition;
} }
protected override void update() protected override void update()
{ {
CalculateDir(); CalculateDir();
if (pc != null && pc.holdItem && itemRidibody != null && itemTransform != null) if (pc && itemRidibody && itemTransform)
{ {
itemTransform.LocalPosition = raccoonHoldLocation.GlobalPosition; if (pc.holdItem)
itemRidibody.IsGravityEnabled = false;
itemRidibody.LinearVelocity = Vector3.Zero;
itemRidibody.AngularVelocity = Vector3.Zero;
if (Input.GetMouseButtonDown(Input.MouseCode.LeftButton))
{ {
pc.holdItem = false; itemTransform.LocalPosition = raccoonHoldLocation.GlobalPosition;
inRange = false;
itemRidibody.IsGravityEnabled = true;
itemRidibody.AddForce(new Vector3(throwForce.x * lastXDir, throwForce.y, throwForce.z * lastZDir));
itemRidibody.LinearVelocity += pc.rb.LinearVelocity;
ResetItemObject();
}
}
else if(!pc.holdItem && itemRidibody != null)
itemRidibody.IsGravityEnabled = true;
if (pc != null && !pc.holdItem && inRange && Input.GetMouseButtonDown(Input.MouseCode.LeftButton)) if (Input.GetMouseButtonDown(Input.MouseCode.LeftButton))
{
pc.holdItem = false;
inRange = false;
itemRidibody.IsGravityEnabled = true;
itemRidibody.AddForce(new Vector3(throwForce.x * lastXDir, throwForce.y, throwForce.z * lastZDir));
itemRidibody.LinearVelocity += pc.rb.LinearVelocity;
ResetItemObject();
}
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton))
{
pc.holdItem = false;
inRange = false;
itemRidibody.IsGravityEnabled = true;
ResetItemObject();
}
}
else if (!pc.holdItem)
itemRidibody.IsGravityEnabled = true;
}
if (pc && !pc.holdItem && inRange && Input.GetMouseButtonDown(Input.MouseCode.LeftButton))
{ {
pc.holdItem = true; pc.holdItem = true;
RetrieveItemComponets(); RetrieveItemComponets();
@ -66,15 +71,26 @@ public class PickAndThrow : Script
private void RetrieveItemComponets() private void RetrieveItemComponets()
{ {
//get the transform of the given item //get the transform of the given item
if (item.GetScript<Item>() != null && itemTransform == null && itemRidibody == null) if (item.GetScript<Item>() && itemTransform == null && itemRidibody == null)
{ {
itemTransform = item.GetComponent<Transform>();
if (itemTransform == null)
Debug.Log("Item transform EMPTY");
itemRidibody = item.GetComponent<RigidBody>(); itemRidibody = item.GetComponent<RigidBody>();
if (itemRidibody == null) if (itemRidibody == null)
Debug.Log("Item rb EMPTY"); Debug.Log("Item rb EMPTY");
else
{
itemRidibody.IsGravityEnabled = false;
itemRidibody.LinearVelocity = Vector3.Zero;
itemRidibody.AngularVelocity = Vector3.Zero;
}
itemTransform = item.GetComponent<Transform>();
if (itemTransform == null)
Debug.Log("Item transform EMPTY");
else
{
itemTransform.LocalEulerAngles = Vector3.Zero;
}
} }
} }
@ -82,7 +98,7 @@ public class PickAndThrow : Script
{ {
if (cam == null) if (cam == null)
cam = GetComponentInChildren<Camera>(); cam = GetComponentInChildren<Camera>();
else if (cam != null) else if (cam)
{ {
Vector3 camerAixs = cam.GetForward(); Vector3 camerAixs = cam.GetForward();
camerAixs.y = 0; camerAixs.y = 0;

View File

@ -81,7 +81,6 @@ public class PlayerController : Script
protected override void awake() protected override void awake()
{ {
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
//default setup //default setup
isMoveKeyPress = false; isMoveKeyPress = false;
holdItem = false; holdItem = false;
@ -113,9 +112,13 @@ public class PlayerController : Script
stateMachine = AddScript<StateMachine>(); stateMachine = AddScript<StateMachine>();
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>(); Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
dictionary.Add(typeof(IdleState), new IdleState(stateMachine)); dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine));
dictionary.Add(typeof(WalkState), new WalkState(stateMachine)); dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine));
dictionary.Add(typeof(RunState), new RunState(stateMachine)); dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine));
dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine));
dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine));
dictionary.Add(typeof(PlayerLandState), new PlayerLandState(stateMachine));
dictionary.Add(typeof(PlayerCaughtState), new PlayerCaughtState(stateMachine));
stateMachine.InitStateMachine(dictionary); stateMachine.InitStateMachine(dictionary);
} }
@ -188,16 +191,16 @@ public class PlayerController : Script
{ {
currentState = RaccoonStates.WALKING; currentState = RaccoonStates.WALKING;
if(stateMachine && !stateMachine.IsState(typeof(WalkState))) if(stateMachine && !stateMachine.IsState(typeof(PlayerWalkState)))
stateMachine.SetState(typeof(WalkState)); stateMachine.SetState(typeof(PlayerWalkState));
} }
if (!isMoveKeyPress && isGrounded) if (!isMoveKeyPress && isGrounded)
{ {
currentState = RaccoonStates.IDLE; currentState = RaccoonStates.IDLE;
if(stateMachine && !stateMachine.IsState(typeof(IdleState))) if(stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
stateMachine.SetState(typeof(IdleState)); stateMachine.SetState(typeof(PlayerIdleState));
} }
} }
@ -230,8 +233,8 @@ public class PlayerController : Script
if (Input.GetKey(Input.KeyCode.LeftShift) && isMoveKeyPress && isGrounded) if (Input.GetKey(Input.KeyCode.LeftShift) && isMoveKeyPress && isGrounded)
{ {
currentState = RaccoonStates.RUNNING; currentState = RaccoonStates.RUNNING;
if (stateMachine && !stateMachine.IsState(typeof(RunState))) if (stateMachine && !stateMachine.IsState(typeof(PlayerRunState)))
stateMachine.SetState(typeof(RunState)); stateMachine.SetState(typeof(PlayerRunState));
holdItem = false; holdItem = false;
if (!sprintIncreaseOnce) if (!sprintIncreaseOnce)
@ -250,8 +253,8 @@ public class PlayerController : Script
if (isMoveKeyPress) if (isMoveKeyPress)
{ {
currentState = RaccoonStates.WALKING; currentState = RaccoonStates.WALKING;
if(stateMachine && !stateMachine.IsState(typeof(WalkState))) if(stateMachine && !stateMachine.IsState(typeof(PlayerWalkState)))
stateMachine.SetState(typeof(WalkState)); stateMachine.SetState(typeof(PlayerWalkState));
} }
sprintIncreaseOnce = false; sprintIncreaseOnce = false;
moveForce = oldForce; moveForce = oldForce;
@ -349,8 +352,8 @@ public class PlayerController : Script
if (currentState == RaccoonStates.CAUGHT && tranform != null) if (currentState == RaccoonStates.CAUGHT && tranform != null)
{ {
currentState = RaccoonStates.IDLE; currentState = RaccoonStates.IDLE;
if (stateMachine && !stateMachine.IsState(typeof(IdleState))) if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
stateMachine.SetState(typeof(IdleState)); stateMachine.SetState(typeof(PlayerIdleState));
tranform.LocalPosition = new Vector3(-3.0f, -2.0f, -5.0f); tranform.LocalPosition = new Vector3(-3.0f, -2.0f, -5.0f);
} }
} }
@ -361,80 +364,3 @@ public class PlayerController : Script
} }
public class WalkState : BaseState
{
public WalkState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Walk State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}
public class RunState : BaseState
{
public RunState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Run State";
}
public override void OnEnter()
{
//Debug.Log("Run ENTER");
}
public override void update()
{
//Debug.Log("RUNING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED RUNNING");
}
public override void OnExit()
{
//Debug.Log("Run EXIT");
}
}
public class IdleState : BaseState
{
public IdleState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Idle State";
}
public override void OnEnter()
{
//Debug.Log("IDLE ENTER");
}
public override void update()
{
//Debug.Log("IDLING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED IDLING");
}
public override void OnExit()
{
//Debug.Log("IDLE EXIT");
}
}

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerCaughtState : BaseState
{
public PlayerCaughtState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Caught State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerCaughtState
ID: 152856879
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerFallState : BaseState
{
public PlayerFallState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Fall State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerFallState
ID: 155635109
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerIdleState : BaseState
{
public PlayerIdleState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Idle State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerIdleState
ID: 167587808
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerJumpState : BaseState
{
public PlayerJumpState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Jump State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerJumpState
ID: 158874227
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerLandState : BaseState
{
public PlayerLandState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Land State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerLandState
ID: 151865541
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerRunState : BaseState
{
public PlayerRunState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Walk State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerRunState
ID: 153407272
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerWalkState : BaseState
{
public PlayerWalkState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Walk State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerWalkState
ID: 166650679
Type: 9

View File

@ -7,6 +7,7 @@ public class GameManager : Script
public enum GameState public enum GameState
{ {
MAINMENU, MAINMENU,
START,
WIN, WIN,
LOSE, LOSE,
TOTAL TOTAL
@ -35,28 +36,32 @@ public class GameManager : Script
if (itemPool) if (itemPool)
{ {
listOfItems = itemPool.GetScriptsInChildren<Item>(); listOfItems = itemPool.GetScriptsInChildren<Item>();
foreach (Item i in listOfItems) if (listOfItems != null)
totalItemCount += 1; foreach (Item i in listOfItems)
totalItemCount += 1;
} }
if (zonePool) if (zonePool)
{ {
listOfZone = itemPool.GetScriptsInChildren<ScoringZone>(); listOfZone = zonePool.GetScriptsInChildren<ScoringZone>();
foreach (ScoringZone i in listOfZone) if (listOfZone != null)
i.gameManger = Owner.GetScript<GameManager>(); foreach (ScoringZone sz in listOfZone)
sz.gameManger = Owner.GetScript<GameManager>();
} }
} }
protected override void update() protected override void update()
{ {
if (timer > 0) if (timer > 0 && currGameState == GameState.START)
{
timer -= Time.DeltaTimeF; timer -= Time.DeltaTimeF;
if (totalItemCount <= 0)
{
currGameState = GameState.WIN;
}
}
else else
currGameState = GameState.LOSE; currGameState = GameState.LOSE;
} }
protected override void onTriggerEnter(CollisionInfo info)
{
}
} }

View File

@ -12,9 +12,17 @@ public class Item : Script
public int Score = 10; public int Score = 10;
public ItemCategory currCategory; public ItemCategory currCategory;
private RigidBody rb;
protected override void awake() protected override void awake()
{ {
rb = GetComponent<RigidBody>();
if (rb)
{
rb.FreezeRotationX = false;
rb.FreezeRotationY = false;
rb.FreezeRotationZ = false;
}
} }
protected override void onTriggerEnter(CollisionInfo info) protected override void onTriggerEnter(CollisionInfo info)

View File

@ -1,3 +0,0 @@
Name: Item
ID: 163145289
Type: 9

View File

@ -1,71 +0,0 @@
using SHADE;
using System;
public class PhysicsTest : Script
{
[SerializeField]
[Tooltip("Force to apply when pressing Space.")]
private Vector3 Force = new Vector3(0.0f, 200.0f, 0.0f);
private Transform Transform;
private RigidBody RigidBody;
private Collider Collider;
protected override void awake()
{
Transform = GetComponent<Transform>();
if (Transform == null)
{
Debug.LogError("Transform is NULL!");
}
RigidBody = GetComponent<RigidBody>();
if (RigidBody == null)
{
Debug.LogError("RigidBody is NULL!");
}
Collider = GetComponent<Collider>();
if (Collider == null)
{
Debug.LogError("Collider is NULL!");
}
var subColider = Collider.CollisionShapeCount;
Debug.Log($"There are {subColider} colliders.");
}
protected override void update()
{
if (Input.GetKeyUp(Input.KeyCode.Space))
{
RigidBody.AddForce(Force);
Debug.Log($"Jump!");
}
}
protected override void fixedUpdate()
{
Debug.Log("Fixed Update");
}
protected override void onCollisionEnter(CollisionInfo info)
{
Debug.Log($"Collision Enter: {info.GameObject.Name}");
}
protected override void onCollisionStay(CollisionInfo info)
{
Debug.Log($"Collision Stay: {info.GameObject.Name}");
}
protected override void onCollisionExit(CollisionInfo info)
{
Debug.Log($"Collision Exit: {info.GameObject.Name}");
}
protected override void onTriggerEnter(CollisionInfo info)
{
Debug.Log($"Trigger Enter: {info.GameObject.Name}");
}
protected override void onTriggerStay(CollisionInfo info)
{
Debug.Log($"Trigger Stay: {info.GameObject.Name}");
}
protected override void onTriggerExit(CollisionInfo info)
{
Debug.Log($"Trigger Exit: {info.GameObject.Name}");
}
}

View File

@ -1,3 +0,0 @@
Name: PickAndThrow
ID: 165331952
Type: 9

View File

@ -1,3 +0,0 @@
Name: PlayerController
ID: 164563088
Type: 9

View File

@ -0,0 +1,74 @@
using SHADE;
using System;
public class SoundsBoard : Script
{
protected override void awake()
{
/*
* event:/UI/failure
event:/UI/mouse_down_element
event:/UI/mouse_down_empty
event:/UI/mouse_enter_element
event:/UI/mouse_exit_element
event:/UI/success
event:/Raccoon/raccoon_footsteps
event:/Raccoon/raccoon_throw
event:/Props/impact_hard
event:/Props/impact_elastic
event:/Music/player_undetected
event:/Music/player_detected
event:/Music/stingers/player_detected
event:/Music/stingers/item_scored
event:/Homeowner/homeowner_humming
event:/Homeowner/homeowner_footsteps
event:/Homeowner/homeowner_detect_raccoon
*/
}
protected override void update()
{
if (Input.GetKey(Input.KeyCode.Q))
Audio.PlayBGMOnce2D("event:/UI/mouse_down_element");
if (Input.GetKey(Input.KeyCode.W))
Audio.PlayBGMOnce2D("event:/UI/mouse_down_empty");
if (Input.GetKey(Input.KeyCode.E))
Audio.PlayBGMOnce2D("event:/UI/mouse_enter_element");
if (Input.GetKey(Input.KeyCode.R))
Audio.PlayBGMOnce2D("event:/UI/mouse_exit_element");
if (Input.GetKey(Input.KeyCode.T))
Audio.PlayBGMOnce2D("event:/UI/success");
if (Input.GetKey(Input.KeyCode.Y))
Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_throw");
if (Input.GetKey(Input.KeyCode.U))
Audio.PlayBGMOnce2D("event:/Props/impact_hard");
if (Input.GetKey(Input.KeyCode.I))
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
if (Input.GetKey(Input.KeyCode.O))
Audio.PlayBGMOnce2D("event:/Music/player_detected");
if (Input.GetKey(Input.KeyCode.P))
Audio.PlayBGMOnce2D("event:/Music/stingers/player_detected");
if (Input.GetKey(Input.KeyCode.A))
Audio.PlayBGMOnce2D("event:/Music/stingers/item_scored");
if (Input.GetKey(Input.KeyCode.S))
Audio.PlayBGMOnce2D("event:/Homeowner/homeowner_humming");
if (Input.GetKey(Input.KeyCode.D))
Audio.PlayBGMOnce2D("event:/Homeowner/homeowner_footsteps");
if (Input.GetKey(Input.KeyCode.F))
Audio.PlayBGMOnce2D("event:/Homeowner/homeowner_detect_raccoon");
if (Input.GetKey(Input.KeyCode.G))
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
if (Input.GetKey(Input.KeyCode.H))
Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_footsteps");
if (Input.GetKey(Input.KeyCode.J))
Audio.PlayBGMOnce2D("event:/Props/impact_elastic");
}
}

View File

@ -0,0 +1,3 @@
Name: SC_SoundsBoard
ID: 156397807
Type: 9