small bug fixes

This commit is contained in:
Glence 2023-04-01 19:14:30 +08:00
parent 51f426868e
commit 716087d15c
2 changed files with 19 additions and 3 deletions

View File

@ -22,6 +22,7 @@ public class PlayerController : Script
public Transform tranform { get; set; }
public Camera cam { get; set; }
public CameraArm camArm { get; set; }
public Collider collider { get; set; }
[NonSerialized]
public PickAndThrow pat;
@ -124,6 +125,10 @@ public class PlayerController : Script
if(!tranform)
Debug.LogError("tranform is MISSING!");
collider = GetComponent<Collider>();
if (!collider)
Debug.LogError("collider is MISSING!");
stateMachine = AddScript<StateMachine>();
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine));
@ -520,7 +525,6 @@ public class PlayerController : Script
public void Caught()
{
//Debug.Log("PlayerController: Raccoon Caught");
currentState = RaccoonStates.CAUGHT;
if (stateMachine && !stateMachine.IsState(typeof(PlayerCaughtState)))
stateMachine.SetState(typeof(PlayerCaughtState));
@ -543,13 +547,21 @@ public class PlayerController : Script
camArm.ArmLength = pat.tpc.armLength;
}
}
landedOnJumpPad = false;
jumpPadDrop = false;
rb.ClearForces();
rb.ClearTorque();
rb.LinearVelocity = Vector3.Zero;
rb.AngularVelocity = Vector3.Zero;
}
public void Reset()
{
if (tranform && respawnPoint)
{
currentState = RaccoonStates.IDLE;
currentState = RaccoonStates.IDLE;
if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
stateMachine.SetState(typeof(PlayerIdleState));

View File

@ -22,7 +22,11 @@ public class ScoringZone : Script
{
if (GameManager.Instance && info.GameObject.GetScript<Item>() && info.GameObject.IsActiveSelf && !info.GameObject.GetComponent<Collider>().GetCollisionShape(0).IsTrigger )
{
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo;
if (GameManager.Instance.currMultiplierCombo > 1)
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo;
else
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score;
GameManager.Instance.ItemScored();
particle.EmissionCount = startingParticleCount * GameManager.Instance.currMultiplierCombo;
particle.Emit();