we poppin

This commit is contained in:
ntr committed 2023-09-27 01:34:36 +10:00
1 parent 336945533b
commit 9f6e615653
88 files changed
+979 -170

No files matched your search

+16 -1
View File
@@ -9,6 +9,7 @@ public class ShipControls : MonoBehaviour {
public Camera aim;
public Timing timing;
ShipAudio audio;
SpaceRaceInput input;
Rigidbody rigidBody;
@@ -54,6 +55,7 @@ public class ShipControls : MonoBehaviour {
void Start() {
Cursor.lockState = CursorLockMode.Locked;
rigidBody = GetComponent<Rigidbody>();
audio = GetComponentInChildren<ShipAudio>();
// just stop the body from being affected by rotation for now
// until the 3p camera is in to explain why
@@ -115,7 +117,10 @@ public class ShipControls : MonoBehaviour {
rigidBody.rotation = Quaternion.RotateTowards(transform.rotation, aim.transform.rotation, step);
if (timing.timerEnabled) {
int boostBefore = powerUnit.BoostChargesAvailable;
powerUnit.Tick();
if (powerUnit.BoostChargesAvailable > boostBefore) OnBoostCharge();
}
}
@@ -160,6 +165,7 @@ public class ShipControls : MonoBehaviour {
}
public void Respawn() {
audio.PlayNoise();
// IMPORTANT
// stop the timer before we move the ship or anything
// otherwise it might generate a checkpoint time
@@ -188,15 +194,19 @@ public class ShipControls : MonoBehaviour {
public void Damage(float amt, string src) {
Debug.Log($"Damage {amt} from {src}");
audio.PlayNoise();
bool destroyed = powerUnit.ShieldReduce(amt);
if (destroyed) {
Debug.Log($"Ddddestroyed by {src}");
// play big noise!
Respawn();
}
}
void Deploy(Output output) {
powerUnit.Deploy(output);
bool deployed = powerUnit.Deploy(output);
if (deployed) audio.PlayNoise();
}
// I prefer doing it this way than registering the callbacks etc
@@ -250,6 +260,11 @@ public class ShipControls : MonoBehaviour {
void OnPowerUnit3(InputAction.CallbackContext ctx) => Deploy(Output.Strafing);
void OnPowerUnit4(InputAction.CallbackContext ctx) => Deploy(Output.Shield);
void OnBoostCharge() {
// audio.PlayNoise();
// do some ui fx whatever
}
void OnDrawGizmosSelected() {
if (Application.isPlaying == false)
return;