Bug fixes and scene changes #267

Merged
glencelow merged 15 commits from PlayerController into main 2022-11-23 20:53:44 +08:00
8 changed files with 37 additions and 23 deletions
Showing only changes of commit c91897f46a - Show all commits

Binary file not shown.

Binary file not shown.

View File

@ -54,4 +54,11 @@
Far: 10000
Perspective: true
IsActive: true
Scripts: ~
Scripts: ~
- EID: 4
Name: Default
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: MainMenu

View File

@ -120,7 +120,7 @@
delayTimer: 1
aimingLength: 1.5
- Type: StateMachine
currentStateName: Idle State
currentStateName: ""
currentAnimName: ""
- EID: 3
Name: HoldingPoint
@ -140,13 +140,13 @@
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: -0.361278683, y: 4.97423792, z: 0}
Rotate: {x: -0.738241911, y: 0.48064509, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Camera Component:
Position: {x: 0.330392599, y: -2.72767258, z: 5.02710676}
Pitch: -42.2981491
Yaw: 16.4989166
Position: {x: -0.0897406489, y: -4.07369709, z: 3.6087606}
Pitch: -42.2981453
Yaw: 16.4989109
Roll: 0
Width: 1920
Height: 1080
@ -275,10 +275,10 @@
- Type: GameManager
itemPool: 12
zonePool: 15
currGameState: 3
totalItemCount: 2
currGameState: 0
totalItemCount: 0
Score: 0
timer: 4.00741768
timer: 50
- EID: 12
Name: ItemPool
IsActive: true

View File

@ -92,19 +92,14 @@ public class PlayerController : Script
//rigidbody check
rb = GetComponent<RigidBody>();
if (rb == null)
if (!rb)
Debug.LogError("RigidBody is NULL!");
//Transform check
tranform = GetComponent<Transform>();
if(tranform == null)
if(!tranform)
Debug.LogError("tranform is NULL!");
//PickAndThrow check
pat = GetScript<PickAndThrow>();
if (pat == null)
Debug.LogError("PickAndThrow is NULL!");
stateMachine = AddScript<StateMachine>();
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine));
@ -120,6 +115,14 @@ public class PlayerController : Script
protected override void update()
{
//PickAndThrow check
if (!pat)
{
pat = GetScript<PickAndThrow>();
if(!pat)
Debug.LogError("PickAndThrow is NULL!");
}
if (!cam)
cam = GetComponentInChildren<Camera>();
if(!camArm)

View File

@ -6,17 +6,16 @@ public class GameManager : Script
{
public enum GameState
{
MAINMENU,
START,
WIN,
LOSE,
TOTAL
LOSE
}
public GameObject itemPool;
public GameObject zonePool;
public GameState currGameState;
[NonSerialized]
public GameState currGameState;
[NonSerialized]
public int totalItemCount;
[NonSerialized]
@ -31,7 +30,7 @@ public class GameManager : Script
{
totalItemCount = 0;
Score = 0;
currGameState = GameState.MAINMENU;
currGameState = GameState.START;
if (itemPool)
{

View File

@ -1,13 +1,17 @@
using System;
using SHADE;
public class SC_MainMenu : Script
public class MainMenu : Script
{
protected override void awake()
{
}
protected override void update()
{
if (Input.GetKey(Input.KeyCode.Space))
{
SceneManager.ChangeScene(86098106);
}
}
}

View File

@ -21,6 +21,7 @@ namespace SHADE
{
public ref class SceneManager abstract sealed
{
static void ChangeScene(AssetID sceneAssetID);
public :
static void ChangeScene(AssetID sceneAssetID);
};
}