diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index bb63634..21cc6f7 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -482,14 +482,10 @@ MonoBehaviour: turnSpeed: 2 drift: 1 brake: 2 - maxBrakeTime: 30 - accelerationTime: 0 - decelerationTime: 0 - brakeTime: 0 - lastFrame: 0 - state: 0 - changeTime: 0 ---- !u!198 &198051526896437106 + maxBrakeTime: 5 + accelerationTime: 2.115 + decelerationTime: 1.2346 +--- !u!198 &198696209911726984 ParticleSystem: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} diff --git a/Assets/Scenes/CodeDEV.unity b/Assets/Scenes/CodeDEV.unity index b6df391..b2f0c84 100644 --- a/Assets/Scenes/CodeDEV.unity +++ b/Assets/Scenes/CodeDEV.unity @@ -152,7 +152,7 @@ AudioSource: serializedVersion: 4 OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae, type: 2} - m_audioClip: {fileID: 8300000, guid: a90787ea4a183c44699deb2babada64b, type: 3} + m_audioClip: {fileID: 8300000, guid: 2a0cc1bc613a80645b3c91ef12ed3f02, type: 3} m_PlayOnAwake: 0 m_Volume: 1 m_Pitch: 1 @@ -713,7 +713,7 @@ AudioSource: serializedVersion: 4 OutputAudioMixerGroup: {fileID: 243356048287013750, guid: efb934a745665924d8c7dd46c0a117ae, type: 2} - m_audioClip: {fileID: 8300000, guid: 55610acd4a5540d4db1fe1e3f4a55f4a, type: 3} + m_audioClip: {fileID: 8300000, guid: 4c1bf81eb5198e8478ab6e997feef50d, type: 3} m_PlayOnAwake: 0 m_Volume: 1 m_Pitch: 1 @@ -837,6 +837,62 @@ Transform: m_Father: {fileID: 734498092} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &865504979 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} + propertyPath: m_RootOrder + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114874769993434856, guid: 3d1911457c1e44f53b6b4044334db52f, + type: 2} + propertyPath: decelerationTime + value: 1.2346 + objectReference: {fileID: 0} + - target: {fileID: 114874769993434856, guid: 3d1911457c1e44f53b6b4044334db52f, + type: 2} + propertyPath: accelerationTime + value: 2.115 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2} + m_IsPrefabParent: 0 --- !u!1 &881384367 GameObject: m_ObjectHideFlags: 0 @@ -962,7 +1018,6 @@ MonoBehaviour: - {fileID: 2133072948} - {fileID: 2012930731} - {fileID: 2060531170} - - {fileID: 1908750963} - {fileID: 1015503430} - {fileID: 343165590} --- !u!1001 &934296221 @@ -1360,8 +1415,8 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 114395085421692120, guid: 460d856ea4eb14cedb5fecde1fe6d743, type: 2} - propertyPath: m_FontData.m_FontSize - value: 200 + propertyPath: m_AnchoredPosition.x + value: 0 objectReference: {fileID: 0} - target: {fileID: 114395085421692120, guid: 460d856ea4eb14cedb5fecde1fe6d743, type: 2} diff --git a/Assets/Scenes/TitleScene.unity b/Assets/Scenes/TitleScene.unity index 36f6841..82aa93d 100644 --- a/Assets/Scenes/TitleScene.unity +++ b/Assets/Scenes/TitleScene.unity @@ -152,7 +152,7 @@ AudioSource: serializedVersion: 4 OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae, type: 2} - m_audioClip: {fileID: 8300000, guid: a90787ea4a183c44699deb2babada64b, type: 3} + m_audioClip: {fileID: 8300000, guid: 2a0cc1bc613a80645b3c91ef12ed3f02, type: 3} m_PlayOnAwake: 1 m_Volume: 1 m_Pitch: 1 @@ -652,7 +652,7 @@ AudioSource: serializedVersion: 4 OutputAudioMixerGroup: {fileID: 243356048287013750, guid: efb934a745665924d8c7dd46c0a117ae, type: 2} - m_audioClip: {fileID: 8300000, guid: 55610acd4a5540d4db1fe1e3f4a55f4a, type: 3} + m_audioClip: {fileID: 8300000, guid: 4c1bf81eb5198e8478ab6e997feef50d, type: 3} m_PlayOnAwake: 0 m_Volume: 1 m_Pitch: 1 @@ -1635,6 +1635,8 @@ MonoBehaviour: - {fileID: 114022018} - {fileID: 272880427} - {fileID: 2015154023} + - {fileID: 1671123313} + - {fileID: 390756940} --- !u!1 &1039057777 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/AudioControl.cs b/Assets/Scripts/AudioControl.cs index 99bab8c..2f6b31a 100644 --- a/Assets/Scripts/AudioControl.cs +++ b/Assets/Scripts/AudioControl.cs @@ -14,13 +14,13 @@ public class AudioControl : MonoBehaviour public enum Sfx { shoot, explosion, mobattack, door, faster, slower, driving, slowdriving, hitmob, hitplayer }; private const float lvlbgm = 5.725f; - private const float gobgm = 14.406f; + private const float gobgm = 14.157f; private const float loopdelay = 0.025f; - private bool menu; // Use this for initialization void Start() { + maintheme.loop = true; menutheme.loop = true; gameovers.loop = true; @@ -67,12 +67,15 @@ public class AudioControl : MonoBehaviour soundeffects[sound].Stop(); } + public void SfxStop(Sfx sound) { + SfxStop((int)sound); + } public bool SfxPlaying(int sound) { return soundeffects[sound].isPlaying; } - + public void SetMasterVolume(float nvol) { mixer.SetFloat("masterVolume", Mathf.Clamp(nvol, -80f, 20f)); diff --git a/Assets/Scripts/BrakeBarController.cs b/Assets/Scripts/BrakeBarController.cs index 12c60f8..4bb8f10 100644 --- a/Assets/Scripts/BrakeBarController.cs +++ b/Assets/Scripts/BrakeBarController.cs @@ -23,7 +23,7 @@ public class BrakeBarController : MonoBehaviour { } private float CalculateOffset() { - return (maxRotation * (player.GetComponent().brakeTime / player.GetComponent().maxBrakeTime)) - currentRotation; + return (maxRotation * (player.GetComponent().GetBrakeTime() / player.GetComponent().maxBrakeTime)) - currentRotation; } public void SetPlayer(Player ply) { diff --git a/Assets/Scripts/Entities/Attack/SingleShot.cs b/Assets/Scripts/Entities/Attack/SingleShot.cs index 8bef022..70c8805 100644 --- a/Assets/Scripts/Entities/Attack/SingleShot.cs +++ b/Assets/Scripts/Entities/Attack/SingleShot.cs @@ -42,7 +42,10 @@ namespace Assets.Scripts.Entities.Attack { bu.SetSpeed(speed); bu.SetOwner(owner); bu.StartBullet(); - GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.shoot); + if (owner.name.Contains("Player")) + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.shoot); + else + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.mobattack); } public float GetCooldownTime() { diff --git a/Assets/Scripts/Entities/Mob.cs b/Assets/Scripts/Entities/Mob.cs index a77a8fe..de29fc0 100644 --- a/Assets/Scripts/Entities/Mob.cs +++ b/Assets/Scripts/Entities/Mob.cs @@ -32,7 +32,10 @@ public abstract class Mob : Entity { isDead = true; Death(); } else if (! isDead) { - GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.mobattack); + if (this is Player) + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.hitplayer); + else + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.hitmob); } } diff --git a/Assets/Scripts/Entities/Player.cs b/Assets/Scripts/Entities/Player.cs index c8659f8..2e87157 100644 --- a/Assets/Scripts/Entities/Player.cs +++ b/Assets/Scripts/Entities/Player.cs @@ -81,7 +81,10 @@ public class Player : Mob { /// protected override void Death() { Debug.Log("Player died..."); - Destroy(this.gameObject); + Destroy(this.gameObject); + GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.slowdriving); + GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.driving); + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.explosion); GameController.instance.EndGame(GameController.EndedCause.DIED); } } diff --git a/Assets/Scripts/Generation/DungeonGenerator.cs b/Assets/Scripts/Generation/DungeonGenerator.cs index 8abf092..d91efd3 100644 --- a/Assets/Scripts/Generation/DungeonGenerator.cs +++ b/Assets/Scripts/Generation/DungeonGenerator.cs @@ -433,7 +433,7 @@ public class DungeonGenerator { r.tiles[pos].type = Room.TileType.ROCK; continue; } - float prob2 = 0.04f; + float prob2 = 0.004f; if (UnityEngine.Random.value > 1 - prob2) { r.spawnpoints.Add(pos); diff --git a/Assets/Scripts/HealthbarController.cs b/Assets/Scripts/HealthbarController.cs index 86b3a7d..a525518 100644 --- a/Assets/Scripts/HealthbarController.cs +++ b/Assets/Scripts/HealthbarController.cs @@ -14,7 +14,7 @@ public class HealthbarController : MonoBehaviour { // if player alive and spawned if (player != null) { - Debug.Log(player.GetHealth()); + //Debug.Log(player.GetHealth()); UpdatePointer(player.GetHealth()); } else @@ -32,7 +32,7 @@ public class HealthbarController : MonoBehaviour { offset = 0; Debug.Log("Player not found"); } else { - Debug.Log("calculated offset"); + //Debug.Log("calculated offset"); offset = ((playerLife / maxRotation) * 100) - currentRotation; } diff --git a/Assets/Scripts/Objectives/EntityObjective.cs b/Assets/Scripts/Objectives/EntityObjective.cs index 6f774fa..3f5eb66 100644 --- a/Assets/Scripts/Objectives/EntityObjective.cs +++ b/Assets/Scripts/Objectives/EntityObjective.cs @@ -28,6 +28,13 @@ public class EntityObjective : Objective { if ( activated ) return; base.ActivateGoal(ply); + + List spawnPointList = room.GetSpawnpoints(); + if (spawnPointList.Count == 0) { + ReachedGoal(); + return; + } + foreach ( GameObject i in prefabList ) { Debug.Log("[ROOMS] Spawning Entity..."); if(i == null || player == null) { @@ -35,8 +42,7 @@ public class EntityObjective : Objective { return; } - GameObject tempObject = GameObject.Instantiate(i); - List spawnPointList = room.GetSpawnpoints(); + GameObject tempObject = UnityEngine.Object.Instantiate(i); tempObject.transform.position = spawnPointList[Random.Range(0, spawnPointList.Count)].position; tempObject.GetComponent().SetObjective(this); entityList.Add(tempObject); diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index c0ca462..c51e374 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -15,22 +15,24 @@ public class PlayerMovement : MonoBehaviour { [SerializeField] public float brake = 2f; [SerializeField] - public float maxBrakeTime = 30f; + public float maxBrakeTime = 5f; // The time of the acceleration/deceleration sounds in seconds - public double accelerationTime; - public double decelerationTime; + [SerializeField] + public float accelerationTime = 5; + [SerializeField] + public float decelerationTime = 5; - public float brakeTime; - public float lastFrame; + float brakeTime; + float lastFrame; public enum SpeedState { SLOW, FASTER, FAST, SLOWER } - public SpeedState state; - public double changeTime; + SpeedState state; + double changeTime; Rigidbody2D rb; @@ -41,6 +43,7 @@ public class PlayerMovement : MonoBehaviour { state = SpeedState.SLOW; brakeTime = 0; lastFrame = Time.time; + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slowdriving); } void Update() { @@ -50,8 +53,12 @@ public class PlayerMovement : MonoBehaviour { } if ( !firstKeyPressed && Input.anyKey ) { firstKeyPressed = true; - state = SpeedState.FASTER; - changeTime = Time.time; + if (Input.GetAxis("Vertical") >= 0) { + state = SpeedState.FASTER; + changeTime = Time.time; + GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.slowdriving); + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.faster); + } } } @@ -61,46 +68,66 @@ public class PlayerMovement : MonoBehaviour { Vector3 speedVec = new Vector3(rb.velocity.x, rb.velocity.y, 0); float speed = speedVec.magnitude; - + bool braking = Input.GetAxis("Vertical") < 0; - if (brakeTime > maxBrakeTime) { + if (braking && brakeTime >= maxBrakeTime) { brakeTime = maxBrakeTime; braking = false; + } else if (!braking) { + //brakeTime -= (Time.time - lastFrame) * 0.1f; } if (braking) { brakeTime += Time.time - lastFrame; + GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.driving); switch (state) { case SpeedState.FASTER: if (Time.time - changeTime > accelerationTime) - state = SpeedState.SLOWER; + { + changeTime = Time.time; + state = SpeedState.SLOWER; + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slower); + } break; case SpeedState.FAST: changeTime = Time.time; state = SpeedState.SLOWER; + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slower); break; case SpeedState.SLOWER: if (Time.time - changeTime > decelerationTime) + { state = SpeedState.SLOW; + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slowdriving); + } break; case SpeedState.SLOW: break; } } else { + if (brakeTime < 0) + brakeTime = 0; + GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.slowdriving); switch (state) { case SpeedState.FASTER: - if (Time.time - changeTime > accelerationTime) - state = SpeedState.FAST; + if (Time.time - changeTime > accelerationTime) { + state = SpeedState.FAST; + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.driving); + } break; case SpeedState.FAST: break; case SpeedState.SLOWER: - if (Time.time - changeTime > decelerationTime) - state = SpeedState.FASTER; + if (Time.time - changeTime > decelerationTime) { + changeTime = Time.time; + state = SpeedState.FASTER; + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.faster); + } break; case SpeedState.SLOW: changeTime = Time.time; - state = SpeedState.FASTER; + state = SpeedState.FASTER; + GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.faster); break; } } diff --git a/Assets/graphics/textures/car.meta b/Assets/graphics/textures/car.meta new file mode 100644 index 0000000..8504594 --- /dev/null +++ b/Assets/graphics/textures/car.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9ec323b9157704d00a3409f8ea6e46b2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/graphics/textures/tmp.meta b/Assets/graphics/textures/tmp.meta new file mode 100644 index 0000000..7ebab68 --- /dev/null +++ b/Assets/graphics/textures/tmp.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: df6e7833427b5497b92308fb6f54e552 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/sound/AudioMixer.mixer b/Assets/sound/AudioMixer.mixer index ab00ea4..88bdf4c 100644 --- a/Assets/sound/AudioMixer.mixer +++ b/Assets/sound/AudioMixer.mixer @@ -77,8 +77,17 @@ AudioMixerSnapshotController: m_AudioMixer: {fileID: 24100000} m_SnapshotID: d3789ccdbdc046a448f1887d94c3f7f5 m_FloatValues: + aa6b64c186541834a990dc7d71ef0490: -9.833286 + 2531afd284b58274a93052c093565106: -9.960263 25123d234de4ec84aafee1d0c380f3ad: 0.025578512 - 7e224658afaf14242ba3996793ac12a1: -0.025776558 + af748c25161478f4c933cb5cf60cf925: -4.560346 + 8b04b72683f112d418bf818b2395ba51: -9.833286 + ce741f86488e78548ad32eec9ad31803: -13.0627575 + 3085c47799436ad43a18d4ae4adb712d: -9.833286 + 7e224658afaf14242ba3996793ac12a1: -0.02577656 + 644f6589fc60a074a98ad67d609f2bfb: 5.1526957 + 5da050aa578318a4f8f1fed71a509fce: -14.816608 + bf89843b5f1f52248935471e56d764be: -9.833286 m_TransitionOverrides: {} --- !u!243 &243021022379401452 AudioMixerGroupController: diff --git a/Assets/sound/menuV1.wav b/Assets/sound/MenuV1.2.wav similarity index 60% rename from Assets/sound/menuV1.wav rename to Assets/sound/MenuV1.2.wav index 83ede20..f1e0827 100644 Binary files a/Assets/sound/menuV1.wav and b/Assets/sound/MenuV1.2.wav differ diff --git a/Assets/sound/menuV1.wav.meta b/Assets/sound/MenuV1.2.wav.meta similarity index 91% rename from Assets/sound/menuV1.wav.meta rename to Assets/sound/MenuV1.2.wav.meta index a7ebd32..b8e48e6 100644 --- a/Assets/sound/menuV1.wav.meta +++ b/Assets/sound/MenuV1.2.wav.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a90787ea4a183c44699deb2babada64b +guid: 2a0cc1bc613a80645b3c91ef12ed3f02 AudioImporter: externalObjects: {} serializedVersion: 6 diff --git a/Assets/sound/game over.wav b/Assets/sound/game overV1.2.wav similarity index 50% rename from Assets/sound/game over.wav rename to Assets/sound/game overV1.2.wav index 66673f8..79a8e32 100644 Binary files a/Assets/sound/game over.wav and b/Assets/sound/game overV1.2.wav differ diff --git a/Assets/sound/game over.wav.meta b/Assets/sound/game overV1.2.wav.meta similarity index 91% rename from Assets/sound/game over.wav.meta rename to Assets/sound/game overV1.2.wav.meta index 1b8ba8f..802bda1 100644 --- a/Assets/sound/game over.wav.meta +++ b/Assets/sound/game overV1.2.wav.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 55610acd4a5540d4db1fe1e3f4a55f4a +guid: 4c1bf81eb5198e8478ab6e997feef50d AudioImporter: externalObjects: {} serializedVersion: 6 diff --git a/Assets/sound/main(0.5).wav b/Assets/sound/main(0.5).wav deleted file mode 100644 index 390c75c..0000000 Binary files a/Assets/sound/main(0.5).wav and /dev/null differ diff --git a/Assets/sound/main(0.5).wav.meta b/Assets/sound/main(0.5).wav.meta deleted file mode 100644 index f9da932..0000000 --- a/Assets/sound/main(0.5).wav.meta +++ /dev/null @@ -1,22 +0,0 @@ -fileFormatVersion: 2 -guid: c89601ee48d799943a756d1d15cd4954 -AudioImporter: - externalObjects: {} - serializedVersion: 6 - defaultSettings: - loadType: 0 - sampleRateSetting: 0 - sampleRateOverride: 44100 - compressionFormat: 1 - quality: 1 - conversionMode: 0 - platformSettingOverrides: {} - forceToMono: 0 - normalize: 1 - preloadAudioData: 1 - loadInBackground: 0 - ambisonic: 0 - 3D: 1 - userData: - assetBundleName: - assetBundleVariant: