diff --git a/Assets/Art/Spaceflash/Audio/Explosion.mp3 b/Assets/Art/Spaceflash/Audio/Explosion.mp3 new file mode 100644 index 0000000..b7e2a00 Binary files /dev/null and b/Assets/Art/Spaceflash/Audio/Explosion.mp3 differ diff --git a/Assets/Art/Spaceflash/Audio/Explosion.mp3.meta b/Assets/Art/Spaceflash/Audio/Explosion.mp3.meta new file mode 100644 index 0000000..92614c2 --- /dev/null +++ b/Assets/Art/Spaceflash/Audio/Explosion.mp3.meta @@ -0,0 +1,36 @@ +fileFormatVersion: 2 +guid: d06da90cbfe0b4bcaba30113c7884745 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 0 + quality: 1 + conversionMode: 0 + platformSettingOverrides: + 4: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 3 + quality: 1 + conversionMode: 0 + 7: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Art/Spaceflash/Prefabs/Asteriod.prefab b/Assets/Art/Spaceflash/Prefabs/Asteriod.prefab old mode 100755 new mode 100644 index bc3e592..154f71d --- a/Assets/Art/Spaceflash/Prefabs/Asteriod.prefab +++ b/Assets/Art/Spaceflash/Prefabs/Asteriod.prefab @@ -10,6 +10,7 @@ GameObject: m_Component: - component: {fileID: 8655281296514194416} - component: {fileID: 4117437747758533196} + - component: {fileID: 48242469928638506} m_Layer: 0 m_Name: Asteriod m_TagString: Asteroid @@ -45,6 +46,23 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 3.354509, y: 3.6238613, z: 5.9825916} m_Center: {x: 0, y: 0, z: 0} +--- !u!114 &48242469928638506 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8512000840424516683} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2c5411b0ad49a4da3bcf44266abd36d9, type: 3} + m_Name: + m_EditorClassIdentifier: + maxSpeed: 10 + minSpeed: 2 + movementDirection: {x: -1, y: 0, z: 0} + rotationSpeedMin: 15 + rotationSpeedMax: 60 --- !u!1001 &2996188979316244303 PrefabInstance: m_ObjectHideFlags: 0 @@ -52,6 +70,26 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 8655281296514194416} m_Modifications: + - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, + type: 3} + propertyPath: m_LocalScale.x + value: 4 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, + type: 3} + propertyPath: m_LocalScale.y + value: 4 + objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, + type: 3} + propertyPath: m_LocalScale.z + value: 4 + objectReference: {fileID: 0} - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, type: 3} propertyPath: m_LocalPosition.x @@ -67,6 +105,11 @@ PrefabInstance: propertyPath: m_LocalPosition.z value: 0.014762365 objectReference: {fileID: 0} + - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, + type: 3} + propertyPath: m_LocalRotation.w + value: 0.5000007 + objectReference: {fileID: 0} - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, type: 3} propertyPath: m_LocalRotation.x @@ -82,16 +125,6 @@ PrefabInstance: propertyPath: m_LocalRotation.z value: 0.4999993 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, - type: 3} - propertyPath: m_LocalRotation.w - value: 0.5000007 - objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, - type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, type: 3} propertyPath: m_LocalEulerAnglesHint.x @@ -107,21 +140,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 90.00001 objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, - type: 3} - propertyPath: m_LocalScale.x - value: 4 - objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, - type: 3} - propertyPath: m_LocalScale.y - value: 4 - objectReference: {fileID: 0} - - target: {fileID: -4216859302048453862, guid: 97707c929e9dfc1448093f7c04548bf8, - type: 3} - propertyPath: m_LocalScale.z - value: 4 - objectReference: {fileID: 0} - target: {fileID: -927199367670048503, guid: 97707c929e9dfc1448093f7c04548bf8, type: 3} propertyPath: m_Name diff --git a/Assets/Art/Spaceflash/Prefabs/AsteroidExplosion.prefab b/Assets/Art/Spaceflash/Prefabs/AsteroidExplosion.prefab old mode 100755 new mode 100644 index 0d60425..2ba5767 --- a/Assets/Art/Spaceflash/Prefabs/AsteroidExplosion.prefab +++ b/Assets/Art/Spaceflash/Prefabs/AsteroidExplosion.prefab @@ -12,6 +12,7 @@ GameObject: - component: {fileID: 5587333519594629068} - component: {fileID: 5587333519594629071} - component: {fileID: -1802887091160970665} + - component: {fileID: 4491038419746127814} m_Layer: 0 m_Name: AsteroidExplosion m_TagString: Untagged @@ -4768,8 +4769,7 @@ ParticleSystemRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 9f1012b44bf7c9c409be087f912f219a, type: 2} - - {fileID: 0} + - {fileID: 2100000, guid: c7457e486f0a7f8488f3028cde24b3d4, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -4823,7 +4823,7 @@ AudioSource: m_Enabled: 1 serializedVersion: 4 OutputAudioMixerGroup: {fileID: 0} - m_audioClip: {fileID: 8300000, guid: 5129f432896945d47871c249c8b1b1f2, type: 3} + m_audioClip: {fileID: 8300000, guid: d06da90cbfe0b4bcaba30113c7884745, type: 3} m_PlayOnAwake: 1 m_Volume: 1 m_Pitch: 1 @@ -4909,3 +4909,15 @@ AudioSource: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 +--- !u!114 &4491038419746127814 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5587333519594629070} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fecf93e2f296e4bbabb07d9c6f571015, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Art/Spaceflash/Prefabs/LaserBeam.prefab b/Assets/Art/Spaceflash/Prefabs/LaserBeam.prefab index 282201a..19a1d6c 100644 --- a/Assets/Art/Spaceflash/Prefabs/LaserBeam.prefab +++ b/Assets/Art/Spaceflash/Prefabs/LaserBeam.prefab @@ -12,7 +12,8 @@ GameObject: - component: {fileID: 4016273362745119835} - component: {fileID: 4016273362745119832} - component: {fileID: 7209580359779057127} - m_Layer: 11 + - component: {fileID: 8765992322732253982} + m_Layer: 9 m_Name: LaserBeam m_TagString: Laser m_Icon: {fileID: 0} @@ -75,6 +76,21 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 60ae9d957d9ab475daf02452944f087b, type: 3} m_Name: m_EditorClassIdentifier: + thrust: 80 +--- !u!114 &8765992322732253982 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4016273362745119833} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cb2ca0be1e6b0438a84cac6ef3e9853d, type: 3} + m_Name: + m_EditorClassIdentifier: + asteroidExplosion: {fileID: 5587333519594629070, guid: c34c359c899647148a75c1c18db29282, + type: 3} --- !u!1 &4016273363007671781 GameObject: m_ObjectHideFlags: 0 @@ -86,7 +102,7 @@ GameObject: - component: {fileID: 4016273363007671784} - component: {fileID: 4016273363007671785} - component: {fileID: 4016273363007671782} - m_Layer: 11 + m_Layer: 9 m_Name: LaserBeam m_TagString: Untagged m_Icon: {fileID: 0} diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 1809cd0..68c7485 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -1123,6 +1123,36 @@ Transform: type: 3} m_PrefabInstance: {fileID: 1577488433} m_PrefabAsset: {fileID: 0} +--- !u!1 &622706891 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 622706892} + m_Layer: 0 + m_Name: SpawnedAsteroids + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &622706892 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 622706891} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 30.755936, y: 12.858216, z: 36.610245} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1095336557} + m_RootOrder: 20 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &625036178 stripped Transform: m_CorrespondingSourceObject: {fileID: 9121549893462604010, guid: efe086015070f38468ea90fd0968a1b9, @@ -1872,6 +1902,7 @@ Transform: - {fileID: 817567045} - {fileID: 613983433} - {fileID: 1945224172} + - {fileID: 622706892} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -3092,3 +3123,51 @@ Transform: m_Father: {fileID: 1095336557} m_RootOrder: 19 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2075448541 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2075448543} + - component: {fileID: 2075448542} + m_Layer: 0 + m_Name: AsteroidSpawner + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2075448542 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2075448541} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f1fcbf533bc0e454cae04c84167b8a4d, type: 3} + m_Name: + m_EditorClassIdentifier: + size: {x: 20, y: 10, z: 80} + spawnRate: 0.3 + asteroidModel: {fileID: 8512000840424516683, guid: 87b3e627d564e3a4e93019febe1473e9, + type: 3} + asteroidParent: {fileID: 622706892} +--- !u!4 &2075448543 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2075448541} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 115.02, y: 23.61, z: 153.92} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/AsteroidCollison.cs b/Assets/Scripts/AsteroidCollison.cs new file mode 100644 index 0000000..1463cbe --- /dev/null +++ b/Assets/Scripts/AsteroidCollison.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class AsteroidCollison : MonoBehaviour +{ + [SerializeField] private GameObject asteroidExplosion; + public void OnCollisionEnter(Collision collision) + { + if (collision.gameObject.tag == "Asteroid") + { + Destroy(collision.gameObject); + + Instantiate(asteroidExplosion, collision.transform.position, collision.transform.rotation); + + Destroy(gameObject); + } else { + Destroy(gameObject); + } + } +} diff --git a/Assets/Scripts/AsteroidCollison.cs.meta b/Assets/Scripts/AsteroidCollison.cs.meta new file mode 100644 index 0000000..74e9d46 --- /dev/null +++ b/Assets/Scripts/AsteroidCollison.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cb2ca0be1e6b0438a84cac6ef3e9853d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/AsteroidKillzone.cs b/Assets/Scripts/AsteroidKillzone.cs new file mode 100644 index 0000000..ff75bfc --- /dev/null +++ b/Assets/Scripts/AsteroidKillzone.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class AsteroidKillzone : MonoBehaviour +{ + + public void OnTriggerEnter(Collider other) + { + if (other.gameObject.tag == "Asteroid") + { + Destroy(other.gameObject); + } + } +} diff --git a/Assets/Scripts/AsteroidKillzone.cs.meta b/Assets/Scripts/AsteroidKillzone.cs.meta new file mode 100644 index 0000000..32e7266 --- /dev/null +++ b/Assets/Scripts/AsteroidKillzone.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b39da8fd11dad42e2a48c7437e633c44 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/AsteroidMovement.cs b/Assets/Scripts/AsteroidMovement.cs new file mode 100644 index 0000000..02e4f63 --- /dev/null +++ b/Assets/Scripts/AsteroidMovement.cs @@ -0,0 +1,34 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class AsteroidMovement : MonoBehaviour +{ + public float maxSpeed, minSpeed; + public Vector3 movementDirection; + + public float rotationSpeedMin, rotationSpeedMax; + private float rotationSpeed, xAngle, yAngle, zAngle; + + private float _asteroidSpeed = 10f; + // Start is called before the first frame update + void Start() + { + _asteroidSpeed = Random.Range(minSpeed, maxSpeed); + + xAngle = Random.Range(0, 360); + yAngle = Random.Range(0, 360); + zAngle = Random.Range(0, 360); + + transform.GetChild(0).transform.Rotate(xAngle, yAngle, zAngle, Space.Self); + + rotationSpeed = Random.Range(rotationSpeedMin, rotationSpeedMax); + } + + // Update is called once per frame + void Update() + { + transform.Translate(movementDirection * Time.deltaTime * _asteroidSpeed); + transform.GetChild(0).transform.Rotate(Vector3.up * Time.deltaTime * rotationSpeed); + } +} diff --git a/Assets/Scripts/AsteroidMovement.cs.meta b/Assets/Scripts/AsteroidMovement.cs.meta new file mode 100644 index 0000000..0c5da44 --- /dev/null +++ b/Assets/Scripts/AsteroidMovement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c5411b0ad49a4da3bcf44266abd36d9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/AsteroidSpawner.cs b/Assets/Scripts/AsteroidSpawner.cs new file mode 100644 index 0000000..4b408ca --- /dev/null +++ b/Assets/Scripts/AsteroidSpawner.cs @@ -0,0 +1,46 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class AsteroidSpawner : MonoBehaviour +{ + [Header("Size of the Spawn Area")] + public Vector3 size; + + [Header("Rate of Asteroid Spawning")] + public float spawnRate = 1f; + + [Header("Asteroid Prefab")] + public GameObject asteroidModel; + + [Header("Asteroid Parent")] + public Transform asteroidParent; + private float nextSpawnTime = 0; + + private void OnDrawGizmos() { + Gizmos.color = new Color(0, 1, 0, 0.5f); + Gizmos.DrawCube(transform.position, size); + } + + private void Update() { + if (Time.time > nextSpawnTime) { + nextSpawnTime = Time.time + spawnRate; + + SpawnAsteroid(); + } + } + + private void SpawnAsteroid() { + Vector3 spawnPoint = transform.position + new Vector3( + Random.Range(-size.x / 2, size.x / 2), + Random.Range(-size.y / 2, size.y / 2), + Random.Range(-size.z / 2, size.z / 2) + ); + + // Quaternion asteroidRotation = Quaternion.Euler(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360)); + + GameObject asteroid = Instantiate(asteroidModel, spawnPoint, transform.rotation); + + asteroid.transform.SetParent(asteroidParent); + } +} diff --git a/Assets/Scripts/AsteroidSpawner.cs.meta b/Assets/Scripts/AsteroidSpawner.cs.meta new file mode 100644 index 0000000..33825e0 --- /dev/null +++ b/Assets/Scripts/AsteroidSpawner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1fcbf533bc0e454cae04c84167b8a4d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/DestroyAfterTime.cs b/Assets/Scripts/DestroyAfterTime.cs new file mode 100644 index 0000000..d2fdefe --- /dev/null +++ b/Assets/Scripts/DestroyAfterTime.cs @@ -0,0 +1,17 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class DestroyAfterTime : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + Invoke("DestroyGameObject", 2f); + } + + void DestroyGameObject() + { + Destroy(gameObject); + } +} diff --git a/Assets/Scripts/DestroyAfterTime.cs.meta b/Assets/Scripts/DestroyAfterTime.cs.meta new file mode 100644 index 0000000..487501c --- /dev/null +++ b/Assets/Scripts/DestroyAfterTime.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fecf93e2f296e4bbabb07d9c6f571015 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: