├── .gitignore ├── Assets ├── Ace Missiles │ ├── Audio.meta │ ├── Audio │ │ ├── HardpointRelease.ogg │ │ ├── HardpointRelease.ogg.meta │ │ ├── MissileExplosion.ogg │ │ ├── MissileExplosion.ogg.meta │ │ ├── MissileFire.ogg │ │ ├── MissileFire.ogg.meta │ │ ├── MissileFireHeavy.ogg │ │ ├── MissileFireHeavy.ogg.meta │ │ ├── MissileLoop.ogg │ │ └── MissileLoop.ogg.meta │ ├── Demo.meta │ ├── Demo │ │ ├── Drone.meta │ │ ├── Drone │ │ │ ├── SelectBox.png │ │ │ └── SelectBox.png.meta │ │ ├── MissileFlight.meta │ │ ├── MissileFlight.unity │ │ ├── MissileFlight.unity.meta │ │ ├── MissileFlight │ │ │ ├── LightingData.asset │ │ │ ├── LightingData.asset.meta │ │ │ ├── ReflectionProbe-0.exr │ │ │ └── ReflectionProbe-0.exr.meta │ │ ├── Scenery.meta │ │ ├── Scenery │ │ │ ├── Grid.psd │ │ │ ├── Grid.psd.meta │ │ │ ├── Ground.mat │ │ │ └── Ground.mat.meta │ │ ├── Scripts.meta │ │ └── Scripts │ │ │ ├── AirToAirDrone.cs │ │ │ ├── AirToAirDrone.cs.meta │ │ │ ├── Drone.cs │ │ │ ├── Drone.cs.meta │ │ │ ├── DroneTurret.cs │ │ │ ├── DroneTurret.cs.meta │ │ │ ├── LookAt.cs │ │ │ ├── LookAt.cs.meta │ │ │ ├── PlayerDrone.cs │ │ │ ├── PlayerDrone.cs.meta │ │ │ ├── SceneRestarter.cs │ │ │ └── SceneRestarter.cs.meta │ ├── Documentation.meta │ ├── Documentation │ │ ├── Ace Arcade Missiles Manual.pdf │ │ ├── Ace Arcade Missiles Manual.pdf.meta │ │ ├── AudioLicenses.txt │ │ ├── AudioLicenses.txt.meta │ │ ├── Changelog.txt │ │ ├── Changelog.txt.meta │ │ ├── License.txt │ │ └── License.txt.meta │ ├── Effects.meta │ ├── Effects │ │ ├── Particle.meta │ │ ├── Particle │ │ │ ├── AdditiveFlame.mat │ │ │ ├── AdditiveFlame.mat.meta │ │ │ ├── ExplosionFlame.mat │ │ │ ├── ExplosionFlame.mat.meta │ │ │ ├── ExplosionSmoke.mat │ │ │ ├── ExplosionSmoke.mat.meta │ │ │ ├── ShadedSmoke.dds │ │ │ ├── ShadedSmoke.dds.meta │ │ │ ├── SmokeFlame.mat │ │ │ ├── SmokeFlame.mat.meta │ │ │ ├── SmokeTrail.mat │ │ │ ├── SmokeTrail.mat.meta │ │ │ ├── smoke.tif │ │ │ ├── smoke.tif.meta │ │ │ ├── smokecore.dds │ │ │ ├── smokecore.dds.meta │ │ │ ├── smokesoft.tif │ │ │ └── smokesoft.tif.meta │ │ ├── Trail.meta │ │ └── Trail │ │ │ ├── SimpleTrail.mat │ │ │ ├── SimpleTrail.mat.meta │ │ │ ├── smokeytrail.png │ │ │ └── smokeytrail.png.meta │ ├── Prefabs.meta │ ├── Prefabs │ │ ├── Effects.meta │ │ ├── Effects │ │ │ ├── FlameTrail.prefab │ │ │ ├── FlameTrail.prefab.meta │ │ │ ├── JitteredFlameTrail.prefab │ │ │ ├── JitteredFlameTrail.prefab.meta │ │ │ ├── MissileExplosion.prefab │ │ │ ├── MissileExplosion.prefab.meta │ │ │ ├── RibbonTrail.prefab │ │ │ ├── RibbonTrail.prefab.meta │ │ │ ├── RocketFlameTrail.prefab │ │ │ └── RocketFlameTrail.prefab.meta │ │ ├── Launchers.meta │ │ ├── Launchers │ │ │ ├── DoubleRailStandard.prefab │ │ │ ├── DoubleRailStandard.prefab.meta │ │ │ ├── Rocket Pod.prefab │ │ │ ├── Rocket Pod.prefab.meta │ │ │ ├── SingleHardpointLongRange.prefab │ │ │ └── SingleHardpointLongRange.prefab.meta │ │ ├── Missiles.meta │ │ └── Missiles │ │ │ ├── LongRangeMissile.prefab │ │ │ ├── LongRangeMissile.prefab.meta │ │ │ ├── Rocket.prefab │ │ │ ├── Rocket.prefab.meta │ │ │ ├── StandardMissile.prefab │ │ │ └── StandardMissile.prefab.meta │ ├── Scripts.meta │ └── Scripts │ │ ├── AAEnableLightOnEffectPlay.cs │ │ ├── AAEnableLightOnEffectPlay.cs.meta │ │ ├── AAHardpoint.cs │ │ ├── AAHardpoint.cs.meta │ │ ├── AAJitterDirection.cs │ │ ├── AAJitterDirection.cs.meta │ │ ├── AALauncher.cs │ │ ├── AALauncher.cs.meta │ │ ├── AAMissile.cs │ │ ├── AAMissile.cs.meta │ │ ├── AAMissileEffects.cs │ │ ├── AAMissileEffects.cs.meta │ │ ├── AAPod.cs │ │ ├── AAPod.cs.meta │ │ ├── AARemoveEffect.cs │ │ ├── AARemoveEffect.cs.meta │ │ ├── AAScrollingTrail.cs │ │ └── AAScrollingTrail.cs.meta ├── FloatingOrigin │ ├── FloatingOrigin.cs │ └── FloatingOrigin.cs.meta ├── FreeCamera │ └── FreeCamera.cs ├── MoveAndRotate │ ├── Mover.cs │ └── Rotator.cs ├── OrbitCamera │ ├── Code │ │ └── OrbitCamera.cs │ └── OrbitCameraRig.prefab ├── RandomAreaSpawner │ ├── Code │ │ └── RandomAreaSpawner.cs │ └── Prefabs │ │ ├── AsteroidCube.prefab │ │ └── AsteroidSpawner.prefab └── ShipPhysics │ └── ShipPhysics.cs └── Packages ├── AceArcadeMissilesV1.0.unitypackage ├── EffectsDeleter.unitypackage ├── FloatingOrigin.unitypackage ├── FreeCamera.unitypackage ├── Freelancer Ships.unitypackage ├── MoveAndRotateUtilities.unitypackage ├── OrbitCamera.unitypackage ├── RandomAreaSpawner.unitypackage ├── ShipPhysics.unitypackage └── SmartClip Sprite.unitypackage /.gitignore: -------------------------------------------------------------------------------- 1 | Packages/Ace Missiles WIP.unitypackage 2 | Packages/Drone.unitypackage 3 | Packages/FighterHUD.unitypackage 4 | Packages/UnrealSmoke.TGA 5 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 623fc439b64086f438130e553c8ba4cf 3 | folderAsset: yes 4 | timeCreated: 1440043424 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio/HardpointRelease.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Audio/HardpointRelease.ogg -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio/HardpointRelease.ogg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd52e41386b1b03499bdcf688cb660bf 3 | timeCreated: 1440045589 4 | licenseType: Free 5 | AudioImporter: 6 | serializedVersion: 6 7 | defaultSettings: 8 | loadType: 0 9 | sampleRateSetting: 0 10 | sampleRateOverride: 44100 11 | compressionFormat: 1 12 | quality: 1 13 | conversionMode: 0 14 | platformSettingOverrides: {} 15 | forceToMono: 0 16 | normalize: 1 17 | preloadAudioData: 1 18 | loadInBackground: 0 19 | 3D: 1 20 | userData: 21 | assetBundleName: 22 | assetBundleVariant: 23 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio/MissileExplosion.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Audio/MissileExplosion.ogg -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio/MissileExplosion.ogg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2240071e81f3f51438b75123620477f8 3 | timeCreated: 1440383018 4 | licenseType: Free 5 | AudioImporter: 6 | serializedVersion: 6 7 | defaultSettings: 8 | loadType: 0 9 | sampleRateSetting: 0 10 | sampleRateOverride: 44100 11 | compressionFormat: 1 12 | quality: 1 13 | conversionMode: 0 14 | platformSettingOverrides: {} 15 | forceToMono: 0 16 | normalize: 1 17 | preloadAudioData: 1 18 | loadInBackground: 0 19 | 3D: 1 20 | userData: 21 | assetBundleName: 22 | assetBundleVariant: 23 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio/MissileFire.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Audio/MissileFire.ogg -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio/MissileFire.ogg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a8a51cd9a54ff1c4f8d8578ca479fa03 3 | timeCreated: 1440046603 4 | licenseType: Free 5 | AudioImporter: 6 | serializedVersion: 6 7 | defaultSettings: 8 | loadType: 0 9 | sampleRateSetting: 0 10 | sampleRateOverride: 44100 11 | compressionFormat: 1 12 | quality: 1 13 | conversionMode: 0 14 | platformSettingOverrides: {} 15 | forceToMono: 0 16 | normalize: 1 17 | preloadAudioData: 1 18 | loadInBackground: 0 19 | 3D: 1 20 | userData: 21 | assetBundleName: 22 | assetBundleVariant: 23 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio/MissileFireHeavy.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Audio/MissileFireHeavy.ogg -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio/MissileFireHeavy.ogg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87444d04163f42e43b027b5536bd85ca 3 | timeCreated: 1440051916 4 | licenseType: Free 5 | AudioImporter: 6 | serializedVersion: 6 7 | defaultSettings: 8 | loadType: 0 9 | sampleRateSetting: 0 10 | sampleRateOverride: 44100 11 | compressionFormat: 1 12 | quality: 1 13 | conversionMode: 0 14 | platformSettingOverrides: {} 15 | forceToMono: 0 16 | normalize: 1 17 | preloadAudioData: 1 18 | loadInBackground: 0 19 | 3D: 1 20 | userData: 21 | assetBundleName: 22 | assetBundleVariant: 23 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio/MissileLoop.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Audio/MissileLoop.ogg -------------------------------------------------------------------------------- /Assets/Ace Missiles/Audio/MissileLoop.ogg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25359635208d1dd4cb7640f713805805 3 | timeCreated: 1440048167 4 | licenseType: Free 5 | AudioImporter: 6 | serializedVersion: 6 7 | defaultSettings: 8 | loadType: 0 9 | sampleRateSetting: 0 10 | sampleRateOverride: 44100 11 | compressionFormat: 1 12 | quality: 1 13 | conversionMode: 0 14 | platformSettingOverrides: {} 15 | forceToMono: 0 16 | normalize: 1 17 | preloadAudioData: 1 18 | loadInBackground: 0 19 | 3D: 1 20 | userData: 21 | assetBundleName: 22 | assetBundleVariant: 23 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdbde992516ec7b448fbc60b07e3f832 3 | folderAsset: yes 4 | timeCreated: 1439685228 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Drone.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb9d6803cff117c428a43495ab0c3206 3 | folderAsset: yes 4 | timeCreated: 1439684349 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Drone/SelectBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Demo/Drone/SelectBox.png -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Drone/SelectBox.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5e02fb6b89149d42be23d7726b1690e 3 | timeCreated: 1439954548 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 0 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | spriteMode: 1 41 | spriteExtrude: 1 42 | spriteMeshType: 1 43 | alignment: 0 44 | spritePivot: {x: .5, y: .5} 45 | spriteBorder: {x: 3, y: 3, z: 3, w: 3} 46 | spritePixelsToUnits: 10 47 | alphaIsTransparency: 1 48 | textureType: 8 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/MissileFlight.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 671bba519e612cd4f8b03dedf5230414 3 | folderAsset: yes 4 | timeCreated: 1502587956 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/MissileFlight.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Demo/MissileFlight.unity -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/MissileFlight.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c2ffefcc2f3c36243bdc0838769a668a 3 | timeCreated: 1439684215 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/MissileFlight/LightingData.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Demo/MissileFlight/LightingData.asset -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/MissileFlight/LightingData.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 39ac9e2fcc3d0f346a3a2f9d630b1b72 3 | timeCreated: 1502587957 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 25800000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/MissileFlight/ReflectionProbe-0.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Demo/MissileFlight/ReflectionProbe-0.exr -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/MissileFlight/ReflectionProbe-0.exr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4b3da23e33241c41b3d61d3610625d6 3 | timeCreated: 1502587957 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: 7 | 8900000: generatedCubemap 8 | serializedVersion: 4 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | sRGBTexture: 1 13 | linearTexture: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 1 27 | seamlessCubemap: 1 28 | textureFormat: 1 29 | maxTextureSize: 2048 30 | textureSettings: 31 | filterMode: 2 32 | aniso: 0 33 | mipBias: 0 34 | wrapMode: 1 35 | nPOTScale: 1 36 | lightmap: 0 37 | compressionQuality: 50 38 | spriteMode: 0 39 | spriteExtrude: 1 40 | spriteMeshType: 1 41 | alignment: 0 42 | spritePivot: {x: 0.5, y: 0.5} 43 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 44 | spritePixelsToUnits: 100 45 | alphaUsage: 1 46 | alphaIsTransparency: 0 47 | spriteTessellationDetail: -1 48 | textureType: 0 49 | textureShape: 2 50 | maxTextureSizeSet: 0 51 | compressionQualitySet: 0 52 | textureFormatSet: 0 53 | platformSettings: 54 | - buildTarget: DefaultTexturePlatform 55 | maxTextureSize: 2048 56 | textureFormat: -1 57 | textureCompression: 1 58 | compressionQuality: 100 59 | crunchedCompression: 0 60 | allowsAlphaSplitting: 0 61 | overridden: 0 62 | spriteSheet: 63 | serializedVersion: 2 64 | sprites: [] 65 | outline: [] 66 | spritePackingTag: 67 | userData: 68 | assetBundleName: 69 | assetBundleVariant: 70 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scenery.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: abab124be2e39b048b596e7580d9a912 3 | folderAsset: yes 4 | timeCreated: 1439684732 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scenery/Grid.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Demo/Scenery/Grid.psd -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scenery/Grid.psd.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b046c1ce95ff7f4d92593dc1d26b74e 3 | timeCreated: 1439684825 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapMode: -1 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | spriteMode: 0 41 | spriteExtrude: 1 42 | spriteMeshType: 1 43 | alignment: 0 44 | spritePivot: {x: .5, y: .5} 45 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 46 | spritePixelsToUnits: 100 47 | alphaIsTransparency: 0 48 | textureType: -1 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scenery/Ground.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Demo/Scenery/Ground.mat -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scenery/Ground.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0f452fcf147b1d4f899587132649063 3 | timeCreated: 1439684738 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68d19b13014fa4047be4f279e28e7002 3 | folderAsset: yes 4 | timeCreated: 1439686137 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/AirToAirDrone.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class AirToAirDrone : MonoBehaviour 4 | { 5 | AALauncher launcher; 6 | 7 | public Transform target; 8 | public float turnRate = 15.0f; 9 | public float speed = 50.0f; 10 | 11 | float wait; 12 | float startTime; 13 | 14 | void Start() 15 | { 16 | startTime = Time.time; 17 | wait = Random.Range(2.0f, 10.0f); 18 | 19 | launcher = GetComponentInChildren(); 20 | } 21 | 22 | void FixedUpdate() 23 | { 24 | transform.Translate(0.0f, 0.0f, speed * Time.deltaTime); 25 | 26 | if (target != null) 27 | { 28 | // Look at the target. 29 | transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.LookRotation(target.position - transform.position, transform.up), turnRate * Time.deltaTime); 30 | 31 | // Fire missile. 32 | if (Time.time - startTime > wait) 33 | launcher.Launch(target, transform.forward * speed); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/AirToAirDrone.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b547a91006310049810c50fafb69ff2 3 | timeCreated: 1440389850 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/Drone.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class Drone : MonoBehaviour 4 | { 5 | public bool turn = true; 6 | public float speed; 7 | public float turnRate; 8 | 9 | public bool useFixedUpdate = false; 10 | 11 | // Update is called once per frame 12 | void Update() 13 | { 14 | if (!useFixedUpdate) 15 | { 16 | if (turn) 17 | transform.Rotate(0.0f, turnRate * Time.deltaTime, 0.0f); 18 | 19 | transform.Translate(0.0f, 0.0f, speed * Time.deltaTime); 20 | } 21 | } 22 | 23 | void FixedUpdate() 24 | { 25 | if (useFixedUpdate) 26 | { 27 | if (turn) 28 | transform.Rotate(0.0f, turnRate * Time.deltaTime, 0.0f); 29 | 30 | transform.Translate(0.0f, 0.0f, speed * Time.deltaTime); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/Drone.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e05fddcad384334aaa6877780da30e0 3 | timeCreated: 1439684356 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/DroneTurret.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class DroneTurret : MonoBehaviour 4 | { 5 | AALauncher launcher; 6 | Transform launchTransform; 7 | 8 | public Transform target; 9 | 10 | float wait; 11 | float startTime; 12 | 13 | void Start() 14 | { 15 | startTime = Time.time; 16 | wait = Random.Range(2.0f, 10.0f); 17 | 18 | launcher = GetComponentInChildren(); 19 | launchTransform = launcher.GetComponent(); 20 | } 21 | 22 | void Update() 23 | { 24 | if (target != null) 25 | { 26 | // Look at the target. 27 | launchTransform.rotation = Quaternion.LookRotation(target.position - transform.position, Vector3.up); 28 | 29 | if (Time.time - startTime > wait) 30 | launcher.Launch(target); 31 | } 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/DroneTurret.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0cce4f83087bb4042a079e9b0b5d02ec 3 | timeCreated: 1440387819 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/LookAt.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class LookAt : MonoBehaviour 4 | { 5 | public Transform target; 6 | 7 | private void Update() 8 | { 9 | if (target != null) 10 | { 11 | transform.LookAt(target); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/LookAt.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c79d33feb6b7e84dab458578e25d01b 3 | timeCreated: 1502664961 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/PlayerDrone.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using System.Collections.Generic; 4 | 5 | public class PlayerDrone : MonoBehaviour 6 | { 7 | public Transform target; 8 | 9 | public float thrust; 10 | public float yaw; 11 | public float pitch; 12 | 13 | public Text msl; 14 | public Text xma; 15 | public Text rcl; 16 | public Text spd; 17 | 18 | public Image selectMSL; 19 | public Image selectXMA; 20 | public Image selectRCL; 21 | 22 | new Rigidbody rigidbody; 23 | 24 | const float FORCEMULT = 100.0f; 25 | 26 | int selectedLauncherGroup = 0; 27 | 28 | Queue[] launchers; 29 | AALauncher[] allLaunchers; 30 | 31 | void Awake() 32 | { 33 | rigidbody = GetComponent(); 34 | 35 | launchers = new Queue[3]; 36 | for (int i=0; i<3; i++) 37 | launchers[i] = new Queue(); 38 | } 39 | 40 | void Start() 41 | { 42 | allLaunchers = GetComponentsInChildren(); 43 | 44 | // Register all the launchers in their appropriate slots so they can be switched between. 45 | foreach (AALauncher launcher in allLaunchers) 46 | { 47 | if (launcher.name.StartsWith("MSL")) 48 | { 49 | launchers[0].Enqueue(launcher); 50 | } 51 | 52 | else if (launcher.name.StartsWith("XMA")) 53 | { 54 | launchers[1].Enqueue(launcher); 55 | } 56 | 57 | else if (launcher.name.StartsWith("RCL")) 58 | { 59 | launchers[2].Enqueue(launcher); 60 | } 61 | } 62 | } 63 | 64 | void Update() 65 | { 66 | // Cycle launcher groups. 67 | if (Input.GetButtonDown("Fire2")) 68 | { 69 | selectedLauncherGroup++; 70 | if (selectedLauncherGroup >= 3) 71 | selectedLauncherGroup = 0; 72 | } 73 | 74 | // Fire selected launcher group. 75 | // Rockets allowed to hold fire down. 76 | if (selectedLauncherGroup == 2) 77 | { 78 | if (Input.GetButton("Fire1")) 79 | FireWeapon(); 80 | } 81 | else 82 | { 83 | if (Input.GetButtonDown("Fire1")) 84 | FireWeapon(); 85 | } 86 | 87 | // Reset all weapons. 88 | if (Input.GetKeyDown(KeyCode.X)) 89 | { 90 | foreach (AALauncher launcher in allLaunchers) 91 | launcher.ResetLauncher(); 92 | } 93 | 94 | UpdateAmmoCounters(); 95 | spd.text = string.Format("{0:000}", rigidbody.velocity.magnitude); 96 | } 97 | 98 | void FixedUpdate() 99 | { 100 | float inPitch = Input.GetAxis("Vertical"); 101 | float inYaw = Input.GetAxis("Horizontal"); 102 | 103 | rigidbody.AddRelativeForce(0.0f, 0.0f, thrust * FORCEMULT * Time.deltaTime); 104 | 105 | rigidbody.AddRelativeTorque(inPitch * pitch * FORCEMULT * Time.deltaTime, 106 | inYaw * yaw * FORCEMULT * Time.deltaTime, 107 | -inYaw * yaw * FORCEMULT * 0.5f * Time.deltaTime); 108 | } 109 | 110 | private void FireWeapon() 111 | { 112 | // Fire the next launcher, then put it back at the end of the queue. 113 | if (launchers[selectedLauncherGroup].Count > 0) 114 | { 115 | AALauncher temp = launchers[selectedLauncherGroup].Dequeue(); 116 | temp.Launch(target, rigidbody.velocity); 117 | launchers[selectedLauncherGroup].Enqueue(temp); 118 | } 119 | } 120 | 121 | private void UpdateAmmoCounters() 122 | { 123 | // Update the ammo counters. 124 | int missileCount = 0; 125 | int xmaCount = 0; 126 | int rocketCount = 0; 127 | int rocketMagazine = 0; 128 | 129 | // This whole method is pretty inefficient, especially because it's in the update, but 130 | // this is just for the sake of demo. 131 | foreach (AALauncher launcher in allLaunchers) 132 | { 133 | if (launcher.name.StartsWith("MSL")) 134 | missileCount += launcher.missileCount; 135 | else if (launcher.name.StartsWith("XMA")) 136 | xmaCount += launcher.missileCount; 137 | else if (launcher.name.StartsWith("RCL")) 138 | { 139 | rocketCount += launcher.missileCount; 140 | rocketMagazine += launcher.MagazineCount; 141 | } 142 | } 143 | 144 | msl.text = string.Format("{0:00}", missileCount); 145 | xma.text = string.Format("{0:00}", xmaCount); 146 | rcl.text = string.Format("{0:00}-{1:00}", rocketCount, rocketMagazine); 147 | 148 | selectMSL.enabled = (selectedLauncherGroup == 0) ? true : false; 149 | selectXMA.enabled = (selectedLauncherGroup == 1) ? true : false; 150 | selectRCL.enabled = (selectedLauncherGroup == 2) ? true : false; 151 | } 152 | } -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/PlayerDrone.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ac65155ec66729f45bafebd08ab5a7fc 3 | timeCreated: 1439748371 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/SceneRestarter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class SceneRestarter : MonoBehaviour 4 | { 5 | void Update() 6 | { 7 | if (Input.GetKeyDown(KeyCode.R)) 8 | { 9 | UnityEngine.SceneManagement.SceneManager.LoadScene(0); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Demo/Scripts/SceneRestarter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98af563c5ee4546419649e40cf3bb888 3 | timeCreated: 1502586031 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Documentation.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68e2ec962d7d13347bbae6606cf06102 3 | folderAsset: yes 4 | timeCreated: 1502645256 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Documentation/Ace Arcade Missiles Manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Documentation/Ace Arcade Missiles Manual.pdf -------------------------------------------------------------------------------- /Assets/Ace Missiles/Documentation/Ace Arcade Missiles Manual.pdf.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 65fe8bfb28a6b1a4390df4877280cc3d 3 | timeCreated: 1502645278 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Documentation/AudioLicenses.txt: -------------------------------------------------------------------------------- 1 | Several sounds cropped and edited from "Rocket Launch.mp3" by mensageirocs 2 | https://freesound.org/people/mensageirocs/sounds/232680/ 3 | 4 | Licensed under Creative Commons Attribution 3.0 Unported 5 | http://creativecommons.org/licenses/by/3.0/ -------------------------------------------------------------------------------- /Assets/Ace Missiles/Documentation/AudioLicenses.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 30545585d2775c749ab1b3710ce2c49b 3 | timeCreated: 1501971370 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Documentation/Changelog.txt: -------------------------------------------------------------------------------- 1 | ============================================================ 2 | Ace Arcade Missiles Changelog 3 | ============================================================ 4 | 5 | v1.0 (08/13/2017) 6 | 7 | - Initial release -------------------------------------------------------------------------------- /Assets/Ace Missiles/Documentation/Changelog.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eca34c707e304014b969f3a77060872f 3 | timeCreated: 1502671796 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Documentation/License.txt: -------------------------------------------------------------------------------- 1 | Copyright 2017 Brian Hernandez 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | The Software, nor a derivate, shall be uploaded to or sold on the Unity Asset Store. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Assets/Ace Missiles/Documentation/License.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ef754961d821ad48bbbbf2b2c440662 3 | timeCreated: 1502645278 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52892591121590b4590dd6135821b50a 3 | folderAsset: yes 4 | timeCreated: 1439686046 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdaa2906bfc6c7847a661ea95209c8f5 3 | folderAsset: yes 4 | timeCreated: 1439699008 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/AdditiveFlame.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Particle/AdditiveFlame.mat -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/AdditiveFlame.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e02d17b9a025e0842b93a95a99ce449c 3 | timeCreated: 1501022694 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 2100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/ExplosionFlame.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Particle/ExplosionFlame.mat -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/ExplosionFlame.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70f069a81a584e64eb2f72242e5b6442 3 | timeCreated: 1440379692 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/ExplosionSmoke.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Particle/ExplosionSmoke.mat -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/ExplosionSmoke.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b676cf43823dc914ebc76d4118360015 3 | timeCreated: 1440379549 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/ShadedSmoke.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Particle/ShadedSmoke.dds -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/ShadedSmoke.dds.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 39d7d475a4ab3d9419dd22fd591c138c 3 | timeCreated: 1439737025 4 | licenseType: Free 5 | DDSImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/SmokeFlame.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Particle/SmokeFlame.mat -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/SmokeFlame.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0f168fd6d17d8e4ab4dabc211f38fab 3 | timeCreated: 1439707346 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/SmokeTrail.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Particle/SmokeTrail.mat -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/SmokeTrail.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f92b9cf95a7b5b24cbc15ea1e6a4d0ed 3 | timeCreated: 1439699123 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/smoke.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Particle/smoke.tif -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/smoke.tif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b867c698f4a09c84d81d9d286e03a0fe 3 | timeCreated: 1439706927 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapMode: -1 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | spriteMode: 0 41 | spriteExtrude: 1 42 | spriteMeshType: 1 43 | alignment: 0 44 | spritePivot: {x: .5, y: .5} 45 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 46 | spritePixelsToUnits: 100 47 | alphaIsTransparency: 0 48 | textureType: -1 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/smokecore.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Particle/smokecore.dds -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/smokecore.dds.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e76fdbe94c9823b4c9f20698d3cafe0e 3 | timeCreated: 1439707075 4 | licenseType: Free 5 | DDSImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/smokesoft.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Particle/smokesoft.tif -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Particle/smokesoft.tif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7e5b5c56a5343545b417f88947eb39a 3 | timeCreated: 1439707798 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapMode: -1 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | spriteMode: 0 41 | spriteExtrude: 1 42 | spriteMeshType: 1 43 | alignment: 0 44 | spritePivot: {x: .5, y: .5} 45 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 46 | spritePixelsToUnits: 100 47 | alphaIsTransparency: 0 48 | textureType: -1 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Trail.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3983091fe90adc846b6ac7b152636c2a 3 | folderAsset: yes 4 | timeCreated: 1439686054 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Trail/SimpleTrail.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Trail/SimpleTrail.mat -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Trail/SimpleTrail.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 42d76631706f6f24ba3b86f791d98d6b 3 | timeCreated: 1439686063 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Trail/smokeytrail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Effects/Trail/smokeytrail.png -------------------------------------------------------------------------------- /Assets/Ace Missiles/Effects/Trail/smokeytrail.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0af3ae56f09a5e468f94a24916fe935 3 | timeCreated: 1439740681 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapMode: -1 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | spriteMode: 0 41 | spriteExtrude: 1 42 | spriteMeshType: 1 43 | alignment: 0 44 | spritePivot: {x: .5, y: .5} 45 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 46 | spritePixelsToUnits: 100 47 | alphaIsTransparency: 0 48 | textureType: -1 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8857fb468a17b3b4485185b0e945df83 3 | folderAsset: yes 4 | timeCreated: 1439734906 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1567f84761daa9143be1bebc1a5afb39 3 | folderAsset: yes 4 | timeCreated: 1439869659 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects/FlameTrail.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Effects/FlameTrail.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects/FlameTrail.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 71b61d81887e2d24aa707e7dc069d8da 3 | timeCreated: 1439734913 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects/JitteredFlameTrail.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Effects/JitteredFlameTrail.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects/JitteredFlameTrail.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ceb5b5561666c8448c6bec4a08bdb8c 3 | timeCreated: 1500847799 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: -1 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects/MissileExplosion.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Effects/MissileExplosion.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects/MissileExplosion.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3972534d344f3684697472572a92ed84 3 | timeCreated: 1440380849 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects/RibbonTrail.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Effects/RibbonTrail.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects/RibbonTrail.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e60de0e84ce42e0489a9e9e6df9746ec 3 | timeCreated: 1439741582 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects/RocketFlameTrail.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Effects/RocketFlameTrail.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Effects/RocketFlameTrail.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79e5cbccf196da54580b4decbfdd495e 3 | timeCreated: 1439958691 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Launchers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02b3bcd648e9dd14d869f41996027df0 3 | folderAsset: yes 4 | timeCreated: 1501040590 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Launchers/DoubleRailStandard.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Launchers/DoubleRailStandard.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Launchers/DoubleRailStandard.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95ce2445efa7c3441abd789fb4b0cf80 3 | timeCreated: 1501040594 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Launchers/Rocket Pod.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Launchers/Rocket Pod.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Launchers/Rocket Pod.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab8292f7fba08ec4d939cac54314da73 3 | timeCreated: 1501040673 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Launchers/SingleHardpointLongRange.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Launchers/SingleHardpointLongRange.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Launchers/SingleHardpointLongRange.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4dcaf428164ae8c4ebbb10e661cf9279 3 | timeCreated: 1501040616 4 | licenseType: Free 5 | NativeFormatImporter: 6 | mainObjectFileID: 100100000 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Missiles.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e11df738da8221b48ad3bbf64f1fe18c 3 | folderAsset: yes 4 | timeCreated: 1440387402 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Missiles/LongRangeMissile.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Missiles/LongRangeMissile.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Missiles/LongRangeMissile.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f171319a71e676b4d83a445f36c5a17a 3 | timeCreated: 1439963357 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Missiles/Rocket.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Missiles/Rocket.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Missiles/Rocket.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bf9734e880e27246ae332bc1c7f1c99 3 | timeCreated: 1439957350 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Missiles/StandardMissile.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/Ace Missiles/Prefabs/Missiles/StandardMissile.prefab -------------------------------------------------------------------------------- /Assets/Ace Missiles/Prefabs/Missiles/StandardMissile.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1955ce2c17043e4e98f79d54764c834 3 | timeCreated: 1439755834 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c1b3d211cf4a2344b2421ae0b83c52c 3 | folderAsset: yes 4 | timeCreated: 1439685187 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAEnableLightOnEffectPlay.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public enum AAEffectType 4 | { 5 | Trail, 6 | Particle 7 | } 8 | 9 | /// 10 | /// When attached to a light, this will cause the light to shine only when the effect is playing. 11 | /// To work correctly, this script requires the parent of this light to be a particle system. 12 | /// 13 | public class AAEnableLightOnEffectPlay : MonoBehaviour 14 | { 15 | public AAEffectType effectTypeToReference = AAEffectType.Particle; 16 | 17 | TrailRenderer trail; 18 | ParticleSystem ps_Trail; 19 | 20 | new Light light; 21 | 22 | void Awake() 23 | { 24 | if (effectTypeToReference == AAEffectType.Trail) 25 | trail = GetComponentInParent(); 26 | 27 | else if (effectTypeToReference == AAEffectType.Particle) 28 | ps_Trail = GetComponentInParent(); 29 | 30 | light = GetComponent(); 31 | } 32 | 33 | void Update() 34 | { 35 | if (effectTypeToReference == AAEffectType.Trail) 36 | { 37 | if (trail != null && trail.enabled) 38 | light.enabled = true; 39 | else 40 | light.enabled = false; 41 | } 42 | 43 | else if (effectTypeToReference == AAEffectType.Particle) 44 | { 45 | if (ps_Trail != null && ps_Trail.isPlaying) 46 | light.enabled = true; 47 | else 48 | light.enabled = false; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAEnableLightOnEffectPlay.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 669940e14d3f6ab40a497949437c10e4 3 | timeCreated: 1440138296 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAHardpoint.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | 4 | public class AAHardpoint : AALauncher 5 | { 6 | Queue stations; 7 | int initialMisCount = 1; 8 | int spawnedMissiles = 0; 9 | 10 | /// 11 | /// Get the magazine count of a pod launcher. Hardpoints don't have magazines, so they 12 | /// will always return 1. 13 | /// 14 | public override int MagazineCount { get { return 1; } } 15 | 16 | protected override void Awake() 17 | { 18 | base.Awake(); 19 | stations = new Queue(launchPoints.Count); 20 | } 21 | 22 | private void Start() 23 | { 24 | initialMisCount = missileCount; 25 | InitializeStations(); 26 | } 27 | 28 | private void Update() 29 | { 30 | // Station updates handle reloading. Don't run the reload timers if all the missiles 31 | // have been spawned. Account for the full set of missiles that is spawned on Start. 32 | if (spawnedMissiles < initialMisCount) 33 | { 34 | foreach (HardpointStation sta in stations) 35 | { 36 | // Station update returns true when a new missile was created. 37 | if (sta.Update(Time.deltaTime)) 38 | spawnedMissiles++; 39 | } 40 | } 41 | } 42 | 43 | /// 44 | /// Launches a spawned missile at the given target. 45 | /// 46 | /// If no target is given, the missile will fire without guidance. 47 | public override void Launch(Transform target) 48 | { 49 | Launch(target, Vector3.zero); 50 | } 51 | 52 | /// 53 | /// Launches a spawned missile at the given target. 54 | /// 55 | /// If no target is given, the missile will fire without guidance. 56 | /// Used to give a missile with a drop delay an initial velocity. Typical 57 | /// use case would be passing in the velocity of the launching platform. 58 | public override void Launch(Transform target, Vector3 velocity) 59 | { 60 | // Peek instead of dequeue so that failed launch commands don't cycle the stations. 61 | HardpointStation launchingStation = stations.Peek(); 62 | 63 | if (launchingStation != null) 64 | { 65 | bool launchSuccessful = launchingStation.Launch(target, velocity); 66 | 67 | if (launchSuccessful) 68 | { 69 | if (fireSource != null) 70 | fireSource.Play(); 71 | 72 | // Put this station back at the end of the queue after a launch. 73 | stations.Dequeue(); 74 | stations.Enqueue(launchingStation); 75 | 76 | missileCount--; 77 | } 78 | } 79 | } 80 | 81 | /// 82 | /// If the missile prefab has changed, calling this function will delete the currently loaded 83 | /// missiles and replace them with the new ones. 84 | /// 85 | /// initialized with. 86 | [ContextMenu("Reset Launcher")] 87 | public override void ResetLauncher() 88 | { 89 | missileCount = initialMisCount; 90 | 91 | foreach (HardpointStation station in stations) 92 | station.ClearHardpoint(); 93 | 94 | InitializeStations(); 95 | } 96 | 97 | /// 98 | /// Rebuilds the stations queue. 99 | /// 100 | private void InitializeStations() 101 | { 102 | stations.Clear(); 103 | spawnedMissiles = 0; 104 | 105 | // Spawn missiles on each of the launchpoints. 106 | // Note that if the missile count is less than launch points, this will cause funniness. 107 | foreach (Transform point in launchPoints) 108 | { 109 | HardpointStation newStation = new HardpointStation(fireDelay, missilePrefabToLaunch, point, ownShip); 110 | stations.Enqueue(newStation); 111 | spawnedMissiles++; 112 | } 113 | } 114 | 115 | /// 116 | /// Helper class that spawns missiles at the ready and launches them on command. 117 | /// 118 | internal class HardpointStation 119 | { 120 | public AAMissile loadedMissile; 121 | 122 | AAMissile prefab; 123 | Transform launchPoint; 124 | Transform ownShip; 125 | 126 | float reloadTime = 1.0f; 127 | float cooldown = 0.0f; 128 | 129 | /// Time to reload the station with a new missile. 130 | /// Missile to spawn. 131 | /// Point where the spawned missile will attach to. 132 | /// Launching object. Used to prevent missile colliding with self. 133 | public HardpointStation(float reloadTime, AAMissile missilePrefab, Transform launchPoint, Transform ownShip) 134 | { 135 | prefab = missilePrefab; 136 | this.reloadTime = reloadTime; 137 | this.launchPoint = launchPoint; 138 | this.ownShip = ownShip; 139 | cooldown = 0.0f; 140 | 141 | loadedMissile = CreateMissile(launchPoint); 142 | } 143 | 144 | /// 145 | /// Automatically reloads missiles based on a cooldown. 146 | /// 147 | /// Time between frames. Usually Time.DeltaTime. 148 | /// True when a missile was spawned on this frame. 149 | public bool Update(float deltaTime) 150 | { 151 | bool spawnedNewMissle = false; 152 | 153 | if (loadedMissile == null) 154 | { 155 | cooldown -= deltaTime; 156 | 157 | // Finished reloading, spawn new missile. 158 | if (cooldown <= 0.0f) 159 | { 160 | loadedMissile = CreateMissile(launchPoint); 161 | spawnedNewMissle = true; 162 | } 163 | } 164 | 165 | return spawnedNewMissle; 166 | } 167 | 168 | /// If no target is given, the missile will fire without guidance. 169 | /// Used to give a missile with a drop delay an initial velocity. Typical 170 | /// use case would be passing in the velocity of the launching platform. 171 | public bool Launch(Transform target, Vector3 inheritedVelocity) 172 | { 173 | bool successfulLaunch = false; 174 | 175 | if (loadedMissile != null) 176 | { 177 | loadedMissile.Launch(target, inheritedVelocity); 178 | loadedMissile = null; 179 | cooldown = reloadTime; 180 | 181 | successfulLaunch = true; 182 | } 183 | 184 | return successfulLaunch; 185 | } 186 | 187 | public void ClearHardpoint() 188 | { 189 | if (loadedMissile != null) 190 | { 191 | Destroy(loadedMissile.gameObject); 192 | loadedMissile = null; 193 | } 194 | 195 | cooldown = 0.0f; 196 | } 197 | 198 | /// 199 | /// Spawns a missile on a station. 200 | /// 201 | /// Point where the missile will be attached to. 202 | /// 203 | private AAMissile CreateMissile(Transform newParent) 204 | { 205 | AAMissile mis = Instantiate(prefab, newParent); 206 | mis.ownShip = ownShip; 207 | 208 | // Attach the missile to the hardpoint by its attach point if possible. 209 | if (mis.attachPoint != null) 210 | { 211 | mis.transform.localPosition = -mis.attachPoint.localPosition; 212 | mis.transform.localEulerAngles = -mis.attachPoint.localEulerAngles; 213 | } 214 | else 215 | { 216 | mis.transform.localPosition = Vector3.zero; 217 | mis.transform.localEulerAngles = Vector3.zero; 218 | } 219 | 220 | return mis; 221 | } 222 | } 223 | } -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAHardpoint.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1eae25a54260274ba7300975c91efb3 3 | timeCreated: 1500952626 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAJitterDirection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | 4 | public class AAJitterDirection : MonoBehaviour 5 | { 6 | [Tooltip("Speed at which the jitter's angle moves towards a new angle.")] 7 | public float jitterSpeed = 90.0f; 8 | 9 | [Tooltip("Maximum angle a new target jitter can be.")] 10 | [Range(0.0f, 90.0f)] 11 | public float jitterAngleMax = 5.0f; 12 | 13 | [Tooltip("How often a new angle for the jitter to move to is created.")] 14 | public float jitterRefreshRate = 15.0f; 15 | 16 | private Vector3 startingEulers; 17 | private Vector3 newJitterRot; 18 | private Vector3 jitterRot = Vector3.zero; 19 | 20 | // Use this for initialization 21 | private void Start() 22 | { 23 | startingEulers = transform.localEulerAngles; 24 | StartCoroutine(NewRotationTarget()); 25 | } 26 | 27 | // Update is called once per frame 28 | private void Update() 29 | { 30 | jitterRot = Vector3.MoveTowards(jitterRot, newJitterRot, jitterSpeed * Time.deltaTime); 31 | transform.localEulerAngles = startingEulers + jitterRot; 32 | } 33 | 34 | private IEnumerator NewRotationTarget() 35 | { 36 | while (true) 37 | { 38 | newJitterRot.x = Random.Range(-jitterAngleMax, jitterAngleMax); 39 | newJitterRot.y = Random.Range(-jitterAngleMax, jitterAngleMax); 40 | newJitterRot.z = Random.Range(-jitterAngleMax, jitterAngleMax); 41 | 42 | // Prevent division by zero. 43 | if (jitterSpeed <= 0.0f) 44 | jitterSpeed = 1.0f; 45 | 46 | yield return new WaitForSeconds(1.0f / jitterRefreshRate); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAJitterDirection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cce534d13f56e294b89da5c7f60be7f9 3 | timeCreated: 1500847755 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AALauncher.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | 4 | public abstract class AALauncher : MonoBehaviour 5 | { 6 | new Transform transform; 7 | 8 | [Header("General launcher options:")] 9 | 10 | [Tooltip("Assign this to prevent the launcher and missile from colliding with whatever launched/owns it. Especially important for missile pod launchers.")] 11 | public Transform ownShip; 12 | 13 | [Tooltip("Missile prefab that gets shot by the launcher.")] 14 | public AAMissile missilePrefabToLaunch; 15 | 16 | [Tooltip("How many missiles this launcher carries.")] 17 | public int missileCount = 1; 18 | 19 | [Tooltip("Time between successive shots.")] 20 | public float fireDelay = 6.0f; 21 | 22 | [Tooltip("Array of Transforms used as reference positions for the missile to launch.\n\nIf unassigned, list will be autopopulated with child Game Objects that follow the naming scheme \"Hp1\", \"Hp2\", \"Hp3\", etc. If none are found, a single launch point will automatically be created at the launcher's center.\n\nOn a hardpoint style launcher, only the first launchpoint is used.\n\nOn a pod style launcher, all launch points are used.")] 23 | public List launchPoints; 24 | 25 | protected float reloadCooldown = 0.0f; 26 | protected float magazineReloadCooldown = 0.0f; 27 | 28 | [Header("Audio")] 29 | [Tooltip("Associates the generated audio sources with the specified mixer group.")] 30 | public UnityEngine.Audio.AudioMixerGroup mixerGroup; 31 | 32 | [Tooltip("Fire sound for this launcher. Will automatically create an AudioSource if not null.")] 33 | public AudioClip fireClip; 34 | public float fireVolume = 1.0f; 35 | public float minDistance = 10.0f; 36 | public float maxDistance = 200.0f; 37 | protected AudioSource fireSource; 38 | 39 | abstract public int MagazineCount { get; } 40 | 41 | protected virtual void Awake() 42 | { 43 | transform = GetComponent(); 44 | 45 | // If the list wasn't assigned, manually populate it. 46 | if (launchPoints.Count == 0) 47 | { 48 | Transform[] potentialHPs = GetComponentsInChildren(); 49 | for (int i = 0; i < potentialHPs.Length; i++) 50 | { 51 | if (potentialHPs[i].name.StartsWith("Hp")) 52 | launchPoints.Add(potentialHPs[i]); 53 | } 54 | 55 | // If nothing was found, let the user know that it's going to just spawn them 56 | // directly on the launcher. 57 | if (launchPoints.Count == 0) 58 | { 59 | Debug.Log("No missile hardpoints found on " + transform.name + " , using launcher position instead."); 60 | launchPoints.Add(transform); 61 | } 62 | } 63 | 64 | if (fireClip != null) 65 | { 66 | fireSource = gameObject.AddComponent(); 67 | fireSource.clip = fireClip; 68 | fireSource.minDistance = minDistance; 69 | fireSource.maxDistance = maxDistance; 70 | fireSource.loop = false; 71 | fireSource.dopplerLevel = 0.0f; 72 | fireSource.spatialBlend = 1.0f; 73 | fireSource.volume = fireVolume; 74 | fireSource.pitch = UnityEngine.Random.Range(0.9f, 1.3f); 75 | fireSource.outputAudioMixerGroup = mixerGroup ?? null; 76 | fireSource.Stop(); 77 | } 78 | 79 | if (ownShip == null) 80 | { 81 | Debug.LogWarning(name + " has no Ownship assigned."); 82 | } 83 | } 84 | 85 | /// 86 | /// Launches a spawned missile at the given target. 87 | /// 88 | /// If no target is given, the missile will fire without guidance. 89 | abstract public void Launch(Transform target); 90 | 91 | /// 92 | /// Launches a spawned missile at the given target. 93 | /// 94 | /// If no target is given, the missile will fire without guidance. 95 | /// Used to give a missile with a drop delay an initial velocity. Typical 96 | /// use case would be passing in the velocity of the launching platform. 97 | abstract public void Launch(Transform target, Vector3 velocity); 98 | 99 | /// 100 | /// If the missile prefab has changed, calling this function will delete the currently loaded 101 | /// missiles and replace them with the new ones. Also resets the ammo count. 102 | /// 103 | /// initialized with. 104 | abstract public void ResetLauncher(); 105 | } -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AALauncher.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7e2e418d5894f84997521314b35646f 3 | timeCreated: 1439869366 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAMissile.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public enum GuidanceType 5 | { 6 | Pursuit, 7 | Lead 8 | } 9 | 10 | public enum UpdateType 11 | { 12 | FixedUpdate, 13 | Update 14 | } 15 | 16 | [RequireComponent(typeof(Rigidbody))] 17 | [RequireComponent(typeof(CapsuleCollider))] 18 | [RequireComponent(typeof(AAMissileEffects))] 19 | public class AAMissile : MonoBehaviour 20 | { 21 | new Transform transform; 22 | new Rigidbody rigidbody; 23 | new CapsuleCollider collider; 24 | 25 | [Header("General Parameters:")] 26 | [Tooltip("Run movement code in fixed update versus update.\n\nIf you notice jittery movement, try changing this. Fixed Update is typically used for rigidbody based projects.")] 27 | public UpdateType movementUpdateCycle = UpdateType.Update; 28 | 29 | [Tooltip("Run guidance code in fixed update versus update.\n\nIf your target has a rigidbody and moved through physics, set this to Fixed.")] 30 | public UpdateType targetUpdateCycle = UpdateType.Update; 31 | 32 | [Tooltip("Transform of the target. Typically assigned by launcher that shot the missile, but can be manually assigned for a missile already in the scene. If null on launch, the missile will have no guidance.")] 33 | public Transform target; 34 | 35 | [Tooltip("Launching object. Typically assigned by the launcher and only needs to be assigned if manually launching a missile already in the scene. When assigned, this will prevent the missile from colliding with whatever launched it.")] 36 | public Transform ownShip; 37 | 38 | [Tooltip("Position where this missile attaches to hardpoint style launchers. If not assigned, this will automatically search for a GameObject named \"Attach\". If no such GameObject, then the missile will attach at its origin.")] 39 | public Transform attachPoint; 40 | 41 | [Header("Missile parameters:")] 42 | 43 | [Tooltip("Pursuit flies directly towards the target. Lead will fly ahead to intercept, making it significantly more difficult to dodge.")] 44 | public GuidanceType guidanceType = GuidanceType.Pursuit; 45 | 46 | [Tooltip("How far off boresight the missile can see the target. Also restricts how far the missile can lead.")] 47 | public float seekerCone = 45.0f; 48 | 49 | [Tooltip("How far off boresight the missile can see the target. Also restricts how far the missile can lead.")] 50 | public float seekerRange = 5000.0f; 51 | 52 | [Tooltip("When true, initial speed will be taken from either the velocity passed into the Launch function, or from the forward velocity of the missile after a drop launch if a drop delay is used. This is useful for missiles that you want to inherit their start speed from their launchers.")] 53 | public bool overrideInitialSpeed = false; 54 | 55 | [Tooltip("Velocity that the missile has immediately on ignition.")] 56 | public float initialSpeed = 0.0f; 57 | 58 | [Tooltip("How long the missile will accelerate. After this, the missile maintains a constant speed.")] 59 | public float motorLifetime = 3.0f; 60 | 61 | [Tooltip("How much speed per second the missile will gain after launch.")] 62 | public float acceleration = 15.0f; 63 | 64 | [Tooltip("How many degrees per second the missile can turn.")] 65 | public float turnRate = 45.0f; 66 | 67 | [Tooltip("After this time, the missile will self-destruct. Timer starts on launch, not motor activation.")] 68 | public float timeToLive = 15.0f; 69 | 70 | [Header("Drop options:")] 71 | 72 | [Tooltip("If greater than 0, missile will free fall for this many seconds and then activate after this many seconds have elapsed.")] 73 | public float dropDelay = 0.0f; 74 | 75 | [Tooltip("Velocity (in local space) at which the missile will be ejected from its launch point.")] 76 | public Vector3 ejectVelocity = Vector3.zero; 77 | 78 | [Tooltip("Whether or not the missile should have gravity when dropping.")] 79 | public bool gravity = true; 80 | 81 | AAMissileEffects missileEffect; 82 | private Vector3 launchVelocity = Vector3.zero; 83 | 84 | private float launchTime = 0.0f; 85 | private float activateTime = 0.0f; 86 | private float missileSpeed = 0.0f; 87 | 88 | private bool isLaunched = false; 89 | private bool missileActive = false; 90 | private bool motorActive = false; 91 | private bool targetTracking = true; 92 | 93 | private Vector3 targetPosLastFrame; 94 | private Quaternion guidedRotation; 95 | 96 | // Used to prevent lead markers from getting huge when missiles are very slow. 97 | private const float MINIMUM_GUIDE_SPEED = 1.0f; 98 | 99 | public bool MissileLaunched { get { return isLaunched; } } 100 | public bool MotorActive { get { return motorActive; } } 101 | 102 | private void Awake() 103 | { 104 | transform = GetComponent(); 105 | rigidbody = GetComponent(); 106 | collider = GetComponent(); 107 | missileEffect = GetComponent(); 108 | } 109 | 110 | private void Start() 111 | { 112 | // Sets it so that missile cannot collide with the thing that launched it. 113 | if (ownShip != null) 114 | { 115 | foreach (Collider col in ownShip.GetComponentsInChildren()) 116 | Physics.IgnoreCollision(collider, col); 117 | } 118 | 119 | // Find attach point if necessary. 120 | if (attachPoint == null) 121 | { 122 | Transform[] potentialAttach = GetComponentsInChildren(); 123 | foreach (Transform xform in potentialAttach) 124 | if (xform.name == "Attach") 125 | attachPoint = xform; 126 | 127 | if (attachPoint == null) 128 | Debug.Log("No attach point found for missile " + transform.name + ". Using missile center instead."); 129 | } 130 | 131 | // If this hasn't already been launched, make sure it's kinematic so that it can be mounted on 132 | // stuff. When a missile is spawned and then launched immediately, Launch happens before start. 133 | if (!isLaunched) 134 | rigidbody.isKinematic = true; 135 | } 136 | 137 | private void Update() 138 | { 139 | if (missileActive && target != null && targetUpdateCycle == UpdateType.Update) 140 | MissileGuidance(); 141 | 142 | if (movementUpdateCycle == UpdateType.Update) 143 | RunMissile(); 144 | } 145 | 146 | private void FixedUpdate() 147 | { 148 | if (missileActive && target != null && targetUpdateCycle == UpdateType.FixedUpdate) 149 | MissileGuidance(); 150 | 151 | if (movementUpdateCycle == UpdateType.FixedUpdate) 152 | RunMissile(); 153 | } 154 | 155 | private void OnCollisionEnter(Collision collision) 156 | { 157 | // Prevent missile from exploding if it hasn't activated yet. 158 | if (isLaunched && TimeSince(launchTime) > dropDelay) 159 | { 160 | // This is a good place to apply damage based on what was collided with. 161 | DestroyMissile(true); 162 | } 163 | } 164 | 165 | /// 166 | /// Launch the missile at the given target. If the missile has a drop delay, use the Launch function 167 | /// with inherited velocity for the correct drop behavior. 168 | /// 169 | /// If no target is given, the missile will fire without guidance. 170 | public void Launch(Transform newTarget) 171 | { 172 | Launch(newTarget, Vector3.zero); 173 | } 174 | 175 | /// 176 | /// Launch the missile at the given target with an inherited velocity for correct drop behavior. 177 | /// It's recommended to use this function in general as it will work for missiles with and without 178 | /// drop delays. 179 | /// 180 | /// /// If no target is given, the missile will fire without guidance. 181 | /// Typically this is the velocity of the launching plane. 182 | public void Launch(Transform newTarget, Vector3 inheritedVelocity) 183 | { 184 | if (!isLaunched) 185 | { 186 | isLaunched = true; 187 | launchTime = Time.time; 188 | transform.parent = null; 189 | target = newTarget; 190 | launchVelocity = inheritedVelocity; 191 | rigidbody.isKinematic = false; 192 | 193 | if (dropDelay > 0.0f) 194 | { 195 | rigidbody.useGravity = gravity; 196 | rigidbody.velocity = inheritedVelocity + transform.TransformDirection(ejectVelocity); 197 | } 198 | else 199 | ActivateMissile(); 200 | } 201 | } 202 | 203 | private void RunMissile() 204 | { 205 | if (isLaunched) 206 | { 207 | // Don't start moving under own power until drop delay has passed (if applicable). 208 | if (!missileActive && dropDelay > 0.0f && TimeSince(launchTime) > dropDelay) 209 | ActivateMissile(); 210 | 211 | // Missile active, move it and guide it in. 212 | if (missileActive) 213 | { 214 | // Motor is only active for the duration of its lifetime (if applicable). 215 | if (motorLifetime > 0.0f && TimeSince(activateTime) > motorLifetime) 216 | motorActive = false; 217 | else 218 | motorActive = true; 219 | 220 | // Accelerate missile while motor is active. 221 | if (motorActive) 222 | missileSpeed += acceleration * Time.deltaTime; 223 | 224 | // Rotate missile to target vector. 225 | if (targetTracking) 226 | transform.rotation = Quaternion.RotateTowards(transform.rotation, guidedRotation, turnRate * Time.deltaTime); 227 | 228 | // Move missile forwards. 229 | // If this is designed to use the fixed update, take advantage of the rigidbody and 230 | // update its velocity instead. This allows for rigidbody.velocity to be used accurately. 231 | // E.g., distance emitters for particle systems to work correctly. 232 | if (movementUpdateCycle == UpdateType.Update) 233 | transform.Translate(transform.forward * missileSpeed * Time.deltaTime, Space.World); 234 | else if (movementUpdateCycle == UpdateType.FixedUpdate) 235 | rigidbody.velocity = transform.forward * missileSpeed; 236 | } 237 | 238 | if (TimeSince(launchTime) > timeToLive) 239 | DestroyMissile(false); 240 | } 241 | } 242 | 243 | private void MissileGuidance() 244 | { 245 | // Get a vector to the target, use it to find angle to target for seeker cone check. 246 | Vector3 relPos = target.position - transform.position; 247 | float angleToTarget = Mathf.Abs(Vector3.Angle(transform.forward.normalized, relPos.normalized)); 248 | float dist = Vector3.Distance(target.position, transform.position); 249 | 250 | // When the target gets out of line of sight of the seeker's FOV or out of range, it can no longer track. 251 | if (angleToTarget > seekerCone || dist > seekerRange) 252 | targetTracking = false; 253 | 254 | // Only turn the missile if the target is still within the seeker's limits. 255 | if (targetTracking) 256 | { 257 | // Pursuit guidance 258 | if (guidanceType == GuidanceType.Pursuit) 259 | { 260 | relPos = target.position - transform.position; 261 | guidedRotation = Quaternion.LookRotation(relPos, transform.up); 262 | } 263 | 264 | // Lead guidance 265 | else 266 | { 267 | // Get where target will be in one second. 268 | Vector3 targetVelocity = target.position - targetPosLastFrame; 269 | targetVelocity /= Time.deltaTime; 270 | 271 | //===================================================== 272 | 273 | // Figure out time to impact based on distance. 274 | //float dist = Mathf.Max(Vector3.Distance(target.position, transform.position), missileSpeed); 275 | float predictedSpeed = Mathf.Min(initialSpeed + acceleration * motorLifetime, missileSpeed + acceleration * TimeSince(activateTime)); 276 | float timeToImpact = dist / Mathf.Max(predictedSpeed, MINIMUM_GUIDE_SPEED); 277 | 278 | // Create lead position based on target velocity and time to impact. 279 | Vector3 leadPos = target.position + targetVelocity * timeToImpact; 280 | Vector3 leadVec = leadPos - transform.position; 281 | 282 | //print(leadVec.magnitude.ToString()); 283 | 284 | //===================================================== 285 | 286 | // It's very easy for the lead position to be outside of the seeker head. To prevent 287 | // this, only allow the target direction to be 90% of the seeker head's limit. 288 | relPos = Vector3.RotateTowards(relPos.normalized, leadVec.normalized, seekerCone * Mathf.Deg2Rad * 0.9f, 0.0f); 289 | guidedRotation = Quaternion.LookRotation(relPos, transform.up); 290 | 291 | //Debug.DrawRay(target.position, targetVelocity * timeToImpact, Color.red); 292 | //Debug.DrawRay(target.position, targetVelocity * timeToHit, Color.red); 293 | //Debug.DrawRay(transform.position, leadVec, Color.red); 294 | 295 | targetPosLastFrame = target.position; 296 | } 297 | } 298 | } 299 | 300 | private void ActivateMissile() 301 | { 302 | if (overrideInitialSpeed) 303 | { 304 | if (dropDelay > 0.0f) 305 | { 306 | // When dropping, used the forward speed of the currently free-falling missile. 307 | float localForwardSpeed = transform.InverseTransformDirection(rigidbody.velocity).z; 308 | initialSpeed = localForwardSpeed; 309 | } 310 | else 311 | { 312 | // When launching off the rail, use forward speed of the launcher's given speed. 313 | float localForwardSpeed = transform.InverseTransformDirection(launchVelocity).z; 314 | initialSpeed = localForwardSpeed; 315 | } 316 | } 317 | 318 | rigidbody.useGravity = false; 319 | rigidbody.velocity = Vector3.zero; 320 | missileActive = true; 321 | 322 | // If no motor lifetime is present, then the motor will just always be active. 323 | if (motorLifetime <= 0.0f) 324 | motorActive = true; 325 | 326 | activateTime = Time.time; 327 | missileSpeed = initialSpeed; 328 | 329 | if (target != null) 330 | targetPosLastFrame = target.transform.position; 331 | } 332 | 333 | private void DestroyMissile(bool impact) 334 | { 335 | Destroy(gameObject); 336 | 337 | if (missileEffect.playExplosionOnSelfDestruct) 338 | missileEffect.Explode(); 339 | 340 | else if (impact) 341 | missileEffect.Explode(); 342 | } 343 | 344 | private float TimeSince(float since) 345 | { 346 | return Time.time - since; 347 | } 348 | } 349 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAMissile.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aec935f11d6d5af4f85c7ef8dcc1f023 3 | timeCreated: 1439685193 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAMissileEffects.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | [RequireComponent(typeof(AAMissile))] 4 | public class AAMissileEffects : MonoBehaviour 5 | { 6 | new Transform transform; 7 | 8 | [Tooltip("Trail remains on whether or not the motor is running. For most games using this kind of arcade missile, this looks/works best.")] 9 | public bool trailAlwaysOn = true; 10 | 11 | [Tooltip("Position to attach either a particle system or trailrenderer prefab. If not assigned, this will automatically search for a GameObject named \"TrailFx\".")] 12 | public Transform trailFxPoint; 13 | 14 | [Tooltip("TrailRenderer played at missile's attach point.")] 15 | public TrailRenderer trailPrefab; 16 | 17 | [Tooltip("ParticleSystem played at missile's attach point.")] 18 | public ParticleSystem particleTrailPrefab; 19 | 20 | [Tooltip("Effect spawened when missile explodes.")] 21 | public ParticleSystem explosionFXPrefab; 22 | public bool playExplosionOnSelfDestruct = false; 23 | 24 | [Header("Audio")] 25 | [Tooltip("Associates the generated audio sources with the specified mixer group.")] 26 | public UnityEngine.Audio.AudioMixerGroup mixerGroup; 27 | 28 | [Tooltip("Sound played when motor ignites. Will automatically create an AudioSource with these specs.")] 29 | public AudioClip fireClip; 30 | public float fireVolume = 1.0f; 31 | public float fireMinDistance = 25.0f; 32 | public float fireMaxDistance = 500.0f; 33 | protected AudioSource fireSource; 34 | 35 | [Tooltip("Loop sound of the missile motor. Will automatically create an AudioSource with these specs.")] 36 | public AudioClip loopClip; 37 | public float loopVolume = 1.0f; 38 | public float loopMinDistance = 30.0f; 39 | public float loopMaxDistance = 500.0f; 40 | protected AudioSource loopSource; 41 | 42 | TrailRenderer trail; 43 | ParticleSystem particleTrail; 44 | 45 | AAMissile missile; 46 | AARemoveEffect effectRemover; 47 | 48 | bool motorHasActivated = false; 49 | 50 | private void Awake() 51 | { 52 | transform = GetComponent(); 53 | missile = GetComponent(); 54 | 55 | if (fireClip != null) 56 | { 57 | fireSource = gameObject.AddComponent(); 58 | fireSource.clip = fireClip; 59 | fireSource.minDistance = fireMinDistance; 60 | fireSource.maxDistance = fireMaxDistance; 61 | fireSource.loop = false; 62 | fireSource.dopplerLevel = 0.0f; 63 | fireSource.spatialBlend = 1.0f; 64 | fireSource.volume = fireVolume; 65 | fireSource.pitch = Random.Range(0.9f, 1.3f); 66 | fireSource.outputAudioMixerGroup = mixerGroup ?? null; 67 | fireSource.Stop(); 68 | } 69 | 70 | if (loopClip != null) 71 | { 72 | loopSource = gameObject.AddComponent(); 73 | loopSource.clip = loopClip; 74 | loopSource.minDistance = loopMinDistance; 75 | loopSource.maxDistance = loopMaxDistance; 76 | loopSource.loop = true; 77 | loopSource.dopplerLevel = 1.0f; 78 | loopSource.volume = loopVolume; 79 | loopSource.spatialBlend = 1.0f; 80 | loopSource.outputAudioMixerGroup = mixerGroup ?? null; 81 | loopSource.Stop(); 82 | } 83 | } 84 | 85 | private void Start() 86 | { 87 | // First make sure that an effect was assigned at all. 88 | if (trailPrefab != null || particleTrailPrefab != null) 89 | { 90 | // Make sure there is a reference point for where to spawn the trail. 91 | if (trailFxPoint == null) 92 | { 93 | // There isn't an already assigned one. Check to see if one already exists. 94 | trailFxPoint = transform.Find("TrailFx"); 95 | 96 | // Still haven't found one, just make a new one. 97 | if (trailFxPoint == null) 98 | { 99 | trailFxPoint = transform; 100 | Debug.Log("No trail effect point given, or child object named \"TrailFx\" to place the missile trail effect on " + name + ". Using object origin instead."); 101 | } 102 | } 103 | 104 | // Instantiate the TrailRenderer trail. 105 | if (trailPrefab != null) 106 | { 107 | trail = Instantiate(trailPrefab, trailFxPoint); 108 | trail.transform.localPosition = Vector3.zero; 109 | trail.transform.localEulerAngles = Vector3.zero; 110 | 111 | trail.enabled = false; 112 | } 113 | 114 | // Instantiate the ParticleSystem trail. 115 | if (particleTrailPrefab != null) 116 | { 117 | particleTrail = Instantiate(particleTrailPrefab, trailFxPoint); 118 | particleTrail.transform.localPosition = Vector3.zero; 119 | particleTrail.transform.localEulerAngles = Vector3.zero; 120 | 121 | particleTrail.Stop(); 122 | 123 | // Ensure that the effect remover is on the gameobject to prevent undeleted particle effects. 124 | if (particleTrail.GetComponent() == null) 125 | effectRemover = particleTrail.gameObject.AddComponent(); 126 | } 127 | } 128 | } 129 | 130 | private void Update() 131 | { 132 | // When motor gets activated, start playing effects. 133 | if (!motorHasActivated && missile.MotorActive) 134 | { 135 | motorHasActivated = true; 136 | 137 | if (fireSource != null) 138 | fireSource.Play(); 139 | if (loopSource != null) 140 | loopSource.Play(); 141 | 142 | if (trail != null) 143 | trail.enabled = true; 144 | else if (particleTrail != null) 145 | particleTrail.Play(); 146 | else 147 | Debug.LogWarning("No TrailRenderer or ParticleSystem prefabs assigned for missile trail FX on " + transform.name + "."); 148 | } 149 | 150 | // Detach the trail when motor shuts off. (If applicable.) 151 | if (!trailAlwaysOn && motorHasActivated && !missile.MotorActive) 152 | { 153 | DetachTrail(); 154 | } 155 | } 156 | 157 | /// 158 | /// Trigger the explosion effect and automatically detach any spawned trail effects. 159 | /// 160 | public void Explode() 161 | { 162 | // If particle systems or trails are destroyed, their trail/particles do not persist. 163 | // Unparenting them before destruction prevents this. The missile calls this function 164 | // when it gets destroyed. 165 | DetachTrail(); 166 | 167 | if (explosionFXPrefab != null) 168 | { 169 | ParticleSystem explode = GameObject.Instantiate(explosionFXPrefab); 170 | explode.transform.position = transform.position; 171 | explode.transform.rotation = transform.rotation; 172 | 173 | // Give the explosion particle system the component to destroy itself after it finished playing. 174 | AARemoveEffect remove = explode.GetComponent(); 175 | if (remove == null) 176 | remove = explode.gameObject.AddComponent(); 177 | 178 | remove.readyToDestroy = true; 179 | } 180 | else 181 | Debug.LogWarning("No ParticleSystem prefab assigned for explosions on missile " + transform.name + "."); 182 | } 183 | 184 | /// 185 | /// Detaches all trail effects. 186 | /// 187 | private void DetachTrail() 188 | { 189 | if (fireSource != null) 190 | fireSource.Stop(); 191 | if (loopSource != null) 192 | loopSource.Stop(); 193 | 194 | if (trail != null) 195 | { 196 | // If the trail was disabled, just delete it straight up. 197 | if (trail.gameObject.activeSelf) 198 | { 199 | trail.transform.parent = null; 200 | trail.autodestruct = true; 201 | } 202 | else 203 | GameObject.Destroy(trail); 204 | } 205 | 206 | if (particleTrail != null) 207 | { 208 | // If the trail was disabled, just delete it straight up. 209 | if (particleTrail.gameObject.activeSelf) 210 | { 211 | particleTrail.transform.parent = null; 212 | particleTrail.Stop(); 213 | effectRemover.readyToDestroy = true; 214 | } 215 | else 216 | GameObject.Destroy(particleTrail); 217 | } 218 | } 219 | } -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAMissileEffects.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6dfb4573a6f9c0b479845cc5a2d91d76 3 | timeCreated: 1439693783 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAPod.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class AAPod : AALauncher 4 | { 5 | [Header("Missile pod specific options:")] 6 | 7 | [Tooltip("Randomized angle at which the missile comes out of the pod at. Higher numbers mean a bigger spread.")] 8 | public float dispersionAngle = 0.0f; 9 | 10 | [Tooltip("Number of times the pod can additionally reload after all missiles have been fired from the first salvo or a manual reload is triggered.")] 11 | public int magazineCount = 1; 12 | 13 | [Tooltip("Time to reload a missile pod magazine.\n\nAll missiles must be depleted to start a reload. Alternatively, you can manually call the \"ReloadPod\" function.")] 14 | public float magazineReloadTime = 6.0f; 15 | 16 | int tubeCount = 0; 17 | int initialMissileCount = 1; 18 | int initialMagCount = 1; 19 | 20 | private void Start() 21 | { 22 | initialMissileCount = missileCount; 23 | initialMagCount = magazineCount; 24 | } 25 | 26 | private void Update() 27 | { 28 | // In the middle of a cooldown. 29 | if (reloadCooldown > 0.0f) 30 | { 31 | reloadCooldown -= Time.deltaTime; 32 | if (reloadCooldown <= 0.0f) 33 | reloadCooldown = 0.0f; 34 | } 35 | 36 | // In the middle of a magazine reload. 37 | if (magazineCount > 0 && magazineReloadCooldown > 0.0f) 38 | { 39 | magazineReloadCooldown -= Time.deltaTime; 40 | 41 | // Finished reloading. 42 | if (magazineReloadCooldown <= 0.0f) 43 | { 44 | missileCount = initialMissileCount; 45 | reloadCooldown = 0.0f; 46 | magazineCount--; 47 | } 48 | } 49 | } 50 | 51 | /// 52 | /// Launches a spawned missile at the given target. 53 | /// 54 | /// If no target is given, the missile will fire without guidance. 55 | public override void Launch(Transform target) 56 | { 57 | Launch(target, Vector3.zero); 58 | } 59 | 60 | /// 61 | /// Launches a spawned missile at the given target. 62 | /// 63 | /// If no target is given, the missile will fire without guidance. 64 | /// Used to give a missile with a drop delay an initial velocity. Typical 65 | /// use case would be passing in the velocity of the launching platform. 66 | public override void Launch(Transform target, Vector3 velocity) 67 | { 68 | if (missileCount > 0 && reloadCooldown <= 0.0f && magazineReloadCooldown <= 0.0f) 69 | { 70 | if (fireSource != null) 71 | fireSource.Play(); 72 | 73 | // Random deviation. 74 | Vector3 deviation = UnityEngine.Random.insideUnitCircle * (dispersionAngle * Mathf.Deg2Rad); 75 | deviation = launchPoints[tubeCount].TransformDirection(deviation); 76 | Vector3 randomizedForward = launchPoints[tubeCount].forward + deviation; 77 | Quaternion randomizedRotation = Quaternion.LookRotation(randomizedForward); 78 | 79 | AAMissile missile = CreateMissile(launchPoints[tubeCount].position, randomizedRotation); 80 | missile.target = target; 81 | missile.Launch(target, velocity); 82 | reloadCooldown = fireDelay; 83 | 84 | missileCount--; 85 | 86 | // Cycle through launch points. 87 | tubeCount++; 88 | if (tubeCount >= launchPoints.Count) 89 | tubeCount = 0; 90 | 91 | // Reload magazine if all out of missiles. 92 | if (missileCount <= 0) 93 | ReloadMagazine(); 94 | } 95 | } 96 | 97 | /// 98 | /// Used to reset the ammo on a rocket pod. Intended to be used when the missile prefab is changed. 99 | /// 100 | public override void ResetLauncher() 101 | { 102 | reloadCooldown = 0.0f; 103 | magazineReloadCooldown = 0.0f; 104 | missileCount = initialMissileCount; 105 | magazineCount = initialMagCount; 106 | 107 | // Missile pods don't actually have anything to worry about in terms of the missile 108 | // itself because it's spawned dynamically anyway. Only the hardpoint has to despawn 109 | // the old missile and recreate it. 110 | } 111 | 112 | /// 113 | /// Tell the missile launcher to manually load the next magazine. Note that any missiles left 114 | /// in this magazine will be discarded. 115 | /// 116 | public void ReloadMagazine() 117 | { 118 | magazineReloadCooldown = magazineReloadTime; 119 | } 120 | 121 | /// 122 | /// Get the magazine count of a pod launcher. Hardpoints don't have magazines, so they 123 | /// will always return 1. 124 | /// 125 | /// Number of magazines left in this rocket pod. 126 | public override int MagazineCount 127 | { 128 | get 129 | { 130 | return magazineCount; 131 | } 132 | } 133 | 134 | /// 135 | /// Spawns and fires a missile. 136 | /// 137 | /// Where the missile spawns. 138 | /// Initial rotation of the missile. 139 | /// 140 | private AAMissile CreateMissile(Vector3 position, Quaternion rotation) 141 | { 142 | AAMissile mis = Instantiate(missilePrefabToLaunch) as AAMissile; 143 | mis.ownShip = ownShip; 144 | mis.transform.position = position; 145 | mis.transform.rotation = rotation; 146 | 147 | return mis; 148 | } 149 | } -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAPod.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9deb75d019dcfa147a0f4b412c6df9e2 3 | timeCreated: 1439950902 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AARemoveEffect.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | [DisallowMultipleComponent] 4 | public class AARemoveEffect : MonoBehaviour 5 | { 6 | ParticleSystem[] particles; 7 | public bool readyToDestroy = false; 8 | 9 | float effectStartTime = 0.0f; 10 | 11 | void OnEnable() 12 | { 13 | particles = GetComponentsInChildren(); 14 | effectStartTime = Time.time; 15 | } 16 | 17 | // Update is called once per frame 18 | void Update() 19 | { 20 | bool allParticlesCountZero = true; 21 | foreach (ParticleSystem ps in particles) 22 | { 23 | if (ps.particleCount > 0) 24 | { 25 | allParticlesCountZero = false; 26 | break; 27 | } 28 | } 29 | 30 | // Only work this if the effect has been alive for longer than a second. Prevents effects from 31 | // destroying themselves before they can even start. 32 | if (readyToDestroy && allParticlesCountZero && Time.time - effectStartTime > 1.0f) 33 | Destroy(gameObject); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AARemoveEffect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ed21a52c1ce5ed469ee6807c81b25b6 3 | timeCreated: 1439701268 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAScrollingTrail.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class AAScrollingTrail : MonoBehaviour 4 | { 5 | public float speed; 6 | 7 | TrailRenderer trail; 8 | Material trailMat; 9 | 10 | void Start() 11 | { 12 | trail = GetComponentInChildren(); 13 | trailMat = trail.material; 14 | } 15 | 16 | void Update() 17 | { 18 | Vector2 offset = trailMat.mainTextureOffset; 19 | 20 | offset.x -= Time.deltaTime * speed / 60.0f; 21 | if (offset.x < -1f) 22 | offset.x = 1f; 23 | 24 | trailMat.mainTextureOffset = offset; 25 | } 26 | } -------------------------------------------------------------------------------- /Assets/Ace Missiles/Scripts/AAScrollingTrail.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 014aa0921ce49004dab928f810bea625 3 | timeCreated: 1439741014 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FloatingOrigin/FloatingOrigin.cs: -------------------------------------------------------------------------------- 1 | // FloatingOrigin.cs 2 | // Written by Peter Stirling 3 | // 11 November 2010 4 | // Uploaded to Unify Community Wiki on 11 November 2010 5 | // Updated to Unity 5.x particle system by Tony Lovell 14 January, 2016 6 | // fix to ensure ALL particles get moved by Tony Lovell 8 September, 2016 7 | // URL: http://wiki.unity3d.com/index.php/Floating_Origin 8 | using UnityEngine; 9 | using System.Collections; 10 | 11 | [RequireComponent(typeof(Camera))] 12 | public class FloatingOrigin : MonoBehaviour 13 | { 14 | [Tooltip("Max distance from origin allowed.")] 15 | public float threshold = 1000.0f; 16 | [Tooltip("Distance at which physics stop being simulated.")] 17 | public float physicsThreshold = 10000.0f; // Set to zero to disable 18 | 19 | public float defaultSleepThreshold = 0.14f; 20 | 21 | ParticleSystem.Particle[] parts = null; 22 | 23 | void LateUpdate() 24 | { 25 | Vector3 cameraPosition = gameObject.transform.position; 26 | if (cameraPosition.magnitude > threshold) 27 | { 28 | Object[] objects = FindObjectsOfType(); 29 | foreach (Object o in objects) 30 | { 31 | Transform t = (Transform)o; 32 | if (t.parent == null) 33 | { 34 | t.position -= cameraPosition; 35 | } 36 | } 37 | 38 | // new particles... very similar to old version above 39 | objects = FindObjectsOfType(); 40 | foreach (Object o in objects) 41 | { 42 | ParticleSystem sys = (ParticleSystem)o; 43 | 44 | if (sys.main.simulationSpace != ParticleSystemSimulationSpace.World) 45 | continue; 46 | 47 | int particlesNeeded = sys.main.maxParticles; 48 | 49 | if (particlesNeeded <= 0) 50 | continue; 51 | 52 | bool wasPaused = sys.isPaused; 53 | bool wasPlaying = sys.isPlaying; 54 | 55 | if (!wasPaused) 56 | sys.Pause(); 57 | 58 | // ensure a sufficiently large array in which to store the particles 59 | if (parts == null || parts.Length < particlesNeeded) 60 | { 61 | parts = new ParticleSystem.Particle[particlesNeeded]; 62 | } 63 | 64 | // now get the particles 65 | int num = sys.GetParticles(parts); 66 | 67 | for (int i = 0; i < num; i++) 68 | { 69 | parts[i].position -= cameraPosition; 70 | } 71 | 72 | sys.SetParticles(parts, num); 73 | 74 | if (wasPlaying) 75 | sys.Play(); 76 | } 77 | 78 | // Clear trail renderers. Very inelegant, but better than the alternative. 79 | objects = FindObjectsOfType(); 80 | foreach (Object o in objects) 81 | { 82 | TrailRenderer trail = (TrailRenderer)o; 83 | trail.Clear(); 84 | } 85 | 86 | // Move the segments of a line renderer 87 | objects = FindObjectsOfType(typeof(LineRenderer)); 88 | foreach (Object o in objects) 89 | { 90 | LineRenderer line = (LineRenderer)o; 91 | 92 | Vector3[] positions = new Vector3[line.positionCount]; 93 | line.GetPositions(positions); 94 | 95 | for (int i = 0; i < positions.Length; ++i) 96 | positions[i] -= cameraPosition; 97 | 98 | line.SetPositions(positions); 99 | } 100 | 101 | if (physicsThreshold > 0f) 102 | { 103 | float physicsThreshold2 = physicsThreshold * physicsThreshold; // simplify check on threshold 104 | objects = FindObjectsOfType(typeof(Rigidbody)); 105 | foreach (Object o in objects) 106 | { 107 | Rigidbody r = (Rigidbody)o; 108 | if (r.gameObject.transform.position.sqrMagnitude > physicsThreshold2) 109 | { 110 | r.sleepThreshold = float.MaxValue; 111 | } 112 | else 113 | { 114 | r.sleepThreshold = defaultSleepThreshold; 115 | } 116 | } 117 | } 118 | 119 | print("Moved origin"); 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /Assets/FloatingOrigin/FloatingOrigin.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b733a00c4b0b3c843b9f99932a25053c 3 | timeCreated: 1502067577 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/FreeCamera/FreeCamera.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class FreeCamera : MonoBehaviour 4 | { 5 | public bool useFixedUpdate = false; 6 | 7 | public bool invert = true; 8 | 9 | public float sensitivity = 20f; 10 | 11 | public float speed = 20f; 12 | public float modSpeed = 60f; 13 | public float zoomFov = 20.0f; 14 | 15 | public bool visible = true; 16 | 17 | private Camera cam; 18 | 19 | private float shift = 1f; 20 | private float lastX, lastY = 0f; 21 | private float x, y; 22 | private float startingFov; 23 | 24 | private bool useModSpeed = false; 25 | 26 | private void Start() 27 | { 28 | cam = GetComponent(); 29 | startingFov = cam.fieldOfView; 30 | } 31 | 32 | private void Update() 33 | { 34 | if (Input.GetMouseButtonDown(0)) 35 | { 36 | visible = !visible; 37 | 38 | if (visible) 39 | { 40 | Cursor.lockState = CursorLockMode.None; 41 | Cursor.visible = true; 42 | } 43 | else 44 | { 45 | Cursor.lockState = CursorLockMode.Locked; 46 | Cursor.visible = false; 47 | } 48 | } 49 | 50 | if (Input.GetMouseButtonDown(1)) 51 | { 52 | useModSpeed = !useModSpeed; 53 | } 54 | 55 | if (cam != null) 56 | { 57 | float targetFov = startingFov; 58 | if (Input.GetMouseButton(2)) 59 | targetFov = zoomFov; 60 | 61 | cam.fieldOfView = Mathf.Lerp(cam.fieldOfView, targetFov, 10.0f * Time.deltaTime); 62 | } 63 | 64 | if (!useFixedUpdate) 65 | MouseLookMovement(); 66 | } 67 | 68 | private void FixedUpdate() 69 | { 70 | if (useFixedUpdate) 71 | MouseLookMovement(); 72 | } 73 | 74 | private void MouseLookMovement() 75 | { 76 | float trueSpeed = (useModSpeed) ? modSpeed : speed; 77 | 78 | if (!visible) 79 | { 80 | x = Input.GetAxis("Mouse X") + lastX * 0.9f; 81 | 82 | if (invert) 83 | y = -Input.GetAxis("Mouse Y") + lastY * 0.9f; 84 | else 85 | y = Input.GetAxis("Mouse Y") + lastY * 0.9f; 86 | 87 | float targetShift = (Input.GetKey(KeyCode.LeftShift)) ? 2f : 1f; 88 | shift = Mathf.Lerp(shift, targetShift, trueSpeed * Time.deltaTime); 89 | 90 | lastX = x; 91 | lastY = y; 92 | 93 | transform.Rotate(sensitivity * y * Time.deltaTime, sensitivity * x * Time.deltaTime, 0f); 94 | } 95 | 96 | Vector3 upright = transform.eulerAngles; 97 | upright.z = 0f; 98 | transform.eulerAngles = upright; 99 | 100 | transform.Translate(trueSpeed * shift * Input.GetAxis("Horizontal") * Time.deltaTime, 101 | 0f, 102 | trueSpeed * shift * Input.GetAxis("Vertical") * Time.deltaTime); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Assets/MoveAndRotate/Mover.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class Mover : MonoBehaviour 4 | { 5 | public Vector3 move; 6 | public bool useFixed = false; 7 | 8 | new Rigidbody rigidbody; 9 | 10 | public void Awake() 11 | { 12 | rigidbody = GetComponent(); 13 | } 14 | 15 | void FixedUpdate() 16 | { 17 | if (useFixed) 18 | MoveObject(); 19 | } 20 | 21 | // Update is called once per frame 22 | void Update() 23 | { 24 | if (!useFixed) 25 | MoveObject(); 26 | } 27 | 28 | void MoveObject() 29 | { 30 | if (rigidbody) 31 | rigidbody.velocity = transform.TransformDirection(move); 32 | else 33 | transform.Translate(move * Time.deltaTime, Space.Self); 34 | } 35 | } -------------------------------------------------------------------------------- /Assets/MoveAndRotate/Rotator.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class Rotator : MonoBehaviour 4 | { 5 | public Vector3 rate; 6 | public bool useFixed = false; 7 | 8 | new Rigidbody rigidbody; 9 | 10 | public void Awake() 11 | { 12 | rigidbody = GetComponent(); 13 | } 14 | 15 | // Update is called once per frame 16 | void Update() 17 | { 18 | if (!useFixed) 19 | Rotate(); 20 | } 21 | 22 | void FixedUpdate() 23 | { 24 | if (useFixed) 25 | Rotate(); 26 | } 27 | 28 | void Rotate() 29 | { 30 | if (rigidbody) 31 | rigidbody.angularVelocity = rate * Time.deltaTime; 32 | else 33 | transform.Rotate(rate * Time.deltaTime, Space.Self); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Assets/OrbitCamera/Code/OrbitCamera.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class OrbitCamera : MonoBehaviour 4 | { 5 | public float height = 6.0f; 6 | public float distance = 20.0f; 7 | public float mouseSensitivity = 10.0f; 8 | public float scrollSpeed = 20.0f; 9 | 10 | public bool invertVertical = true; 11 | public bool maintainHorizon = true; 12 | 13 | [Tooltip("Target to orbit around. Defaults to whatever the object is parented to at game start if not specified.")] 14 | public Transform orbitTarget; 15 | 16 | Camera cam; 17 | 18 | float orbitAzimuth, orbitElevation; 19 | 20 | void Awake() 21 | { 22 | cam = GetComponentInChildren(); 23 | } 24 | 25 | void Start() 26 | { 27 | if (transform.parent != null) 28 | { 29 | orbitTarget = transform.parent; 30 | transform.SetParent(null); 31 | } 32 | } 33 | 34 | // Update is called once per frame 35 | void Update() 36 | { 37 | if (cam != null) 38 | { 39 | // Scroll camera in and out using mousewheel. Scroll faster with distance. 40 | distance -= Input.GetAxis("Mouse ScrollWheel") * scrollSpeed * (distance * 0.02f); 41 | distance = Mathf.Clamp(distance, 1.0f, float.MaxValue); 42 | 43 | // Offset the camera from the reference point. 44 | cam.transform.localPosition = new Vector3(0.0f, height, -distance); 45 | 46 | // Follow the orbit target. 47 | if (orbitTarget != null) 48 | { 49 | transform.position = orbitTarget.position; 50 | } 51 | 52 | 53 | if (maintainHorizon) 54 | { 55 | // Rotate using manually tracked euler angles. 56 | orbitAzimuth += Input.GetAxis("Mouse X") * mouseSensitivity; 57 | orbitElevation += Input.GetAxis("Mouse Y") * mouseSensitivity * ((invertVertical) ? -1.0f : 1.0f); 58 | orbitElevation = Mathf.Clamp(orbitElevation, -70.0f, 70.0f); 59 | 60 | transform.rotation = Quaternion.Euler(new Vector3(orbitElevation, orbitAzimuth, 0.0f)); 61 | } 62 | else 63 | { 64 | // Just let the engine handle the rotations completely on its own. 65 | float vertical = Input.GetAxis("Mouse Y"); 66 | vertical *= (invertVertical) ? -1.0f : 1.0f; 67 | transform.Rotate(new Vector3(vertical, Input.GetAxis("Mouse X"), 0.0f) * mouseSensitivity, Space.Self); 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/OrbitCamera/OrbitCameraRig.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/OrbitCamera/OrbitCameraRig.prefab -------------------------------------------------------------------------------- /Assets/RandomAreaSpawner/Code/RandomAreaSpawner.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public enum RandomSpawnerShape 4 | { 5 | Box, 6 | Sphere, 7 | } 8 | 9 | // Used mostly for testing to provide stuff to fly around and into. 10 | public class RandomAreaSpawner : MonoBehaviour 11 | { 12 | [Header("General settings:")] 13 | 14 | [Tooltip("Prefab to spawn.")] 15 | public Transform prefab; 16 | 17 | [Tooltip("Shape to spawn the prefabs in.")] 18 | public RandomSpawnerShape spawnShape = RandomSpawnerShape.Sphere; 19 | 20 | [Tooltip("Multiplier for the spawn shape in each axis.")] 21 | public Vector3 shapeModifiers = Vector3.one; 22 | 23 | [Tooltip("How many prefab to spawn.")] 24 | public int asteroidCount = 50; 25 | 26 | [Tooltip("Distance from the center of the gameobject that prefabs will spawn")] 27 | public float range = 1000.0f; 28 | 29 | [Tooltip("Should prefab have a random rotation applied to it.")] 30 | public bool randomRotation = true; 31 | 32 | [Tooltip("Random min/max scale to apply.")] 33 | public Vector2 scaleRange = new Vector2(1.0f, 3.0f); 34 | 35 | [Header("Rigidbody settings:")] 36 | 37 | [Tooltip("Apply a velocity from 0 to this value in a random direction.")] 38 | public float velocity = 0.0f; 39 | 40 | [Tooltip("Apply an angular velocity (deg/s) from 0 to this value in a random direction.")] 41 | public float angularVelocity = 0.0f; 42 | 43 | [Tooltip("If true, raise the mass of the object based on its scale.")] 44 | public bool scaleMass = true; 45 | 46 | // Use this for initialization 47 | void Start() 48 | { 49 | if (prefab != null) 50 | { 51 | for (int i = 0; i < asteroidCount; i++) 52 | CreateAsteroid(); 53 | } 54 | } 55 | 56 | private void CreateAsteroid() 57 | { 58 | Vector3 spawnPos = Vector3.zero; 59 | 60 | // Create random position based on specified shape and range. 61 | if (spawnShape == RandomSpawnerShape.Box) 62 | { 63 | spawnPos.x = Random.Range(-range, range) * shapeModifiers.x; 64 | spawnPos.y = Random.Range(-range, range) * shapeModifiers.y; 65 | spawnPos.z = Random.Range(-range, range) * shapeModifiers.z; 66 | } 67 | else if (spawnShape == RandomSpawnerShape.Sphere) 68 | { 69 | spawnPos = Random.insideUnitSphere * range; 70 | spawnPos.x *= shapeModifiers.x; 71 | spawnPos.y *= shapeModifiers.y; 72 | spawnPos.z *= shapeModifiers.z; 73 | } 74 | 75 | // Offset position to match position of the parent gameobject. 76 | spawnPos += transform.position; 77 | 78 | // Apply a random rotation if necessary. 79 | Quaternion spawnRot = (randomRotation) ? Random.rotation : Quaternion.identity; 80 | 81 | // Create the object and set the parent to this gameobject for scene organization. 82 | Transform t = Instantiate(prefab, spawnPos, spawnRot) as Transform; 83 | t.SetParent(transform); 84 | 85 | // Apply scaling. 86 | float scale = Random.Range(scaleRange.x, scaleRange.y); 87 | t.localScale = Vector3.one * scale; 88 | 89 | // Apply rigidbody values. 90 | Rigidbody r = t.GetComponent(); 91 | if (r) 92 | { 93 | if (scaleMass) 94 | r.mass *= scale * scale * scale; 95 | 96 | r.AddRelativeForce(Random.insideUnitSphere * velocity, ForceMode.VelocityChange); 97 | r.AddRelativeTorque(Random.insideUnitSphere * angularVelocity * Mathf.Deg2Rad, ForceMode.VelocityChange); 98 | } 99 | } 100 | 101 | public void CreateNewAstroid() 102 | { 103 | CreateAsteroid(); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /Assets/RandomAreaSpawner/Prefabs/AsteroidCube.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/RandomAreaSpawner/Prefabs/AsteroidCube.prefab -------------------------------------------------------------------------------- /Assets/RandomAreaSpawner/Prefabs/AsteroidSpawner.prefab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Assets/RandomAreaSpawner/Prefabs/AsteroidSpawner.prefab -------------------------------------------------------------------------------- /Assets/ShipPhysics/ShipPhysics.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | /// 4 | /// Applies linear and angular forces to a ship. 5 | /// 6 | public class ShipPhysics : MonoBehaviour 7 | { 8 | [Header("Thrust")] 9 | [Tooltip("X: Lateral thrust\nY: Vertical thrust\nZ: Longitudinal Thrust")] 10 | public Vector3 linearForce = new Vector3(100.0f, 100.0f, 100.0f); 11 | 12 | [Tooltip("X: Pitch\nY: Yaw\nZ: Roll")] 13 | public Vector3 angularForce = new Vector3(100.0f, 100.0f, 100.0f); 14 | 15 | [Range(0.0f, 1.0f)] 16 | [Tooltip("Multiplier for longitudinal thrust when reverse thrust is requested.")] 17 | public float reverseMultiplier = 1.0f; 18 | 19 | [Tooltip("Multiplier for all forces. Can be used to keep force numbers smaller and more readable.")] 20 | public float forceMultiplier = 100.0f; 21 | 22 | Vector3 appliedLinearForce = Vector3.zero; 23 | Vector3 appliedAngularForce = Vector3.zero; 24 | 25 | Rigidbody rbody; 26 | 27 | // Use this for initialization 28 | void Awake() 29 | { 30 | rbody = GetComponent(); 31 | if (rbody == null) 32 | { 33 | Debug.LogWarning(name + ": ShipPhysics has no rigidbody."); 34 | } 35 | } 36 | 37 | void FixedUpdate() 38 | { 39 | if (rbody != null) 40 | { 41 | rbody.AddRelativeForce(appliedLinearForce * forceMultiplier, ForceMode.Force); 42 | rbody.AddRelativeTorque(appliedAngularForce * forceMultiplier, ForceMode.Force); 43 | } 44 | } 45 | 46 | /// 47 | /// Sets the input for how much of linearForce and angularForce are applied 48 | /// to the ship. Each component of the input vectors is assumed to be scaled 49 | /// from -1 to 1, but is not clamped. 50 | /// 51 | public void SetPhysicsInput(Vector3 linearInput, Vector3 angularInput) 52 | { 53 | appliedLinearForce = MultiplyByComponent(linearInput, linearForce); 54 | appliedAngularForce = MultiplyByComponent(angularInput, angularForce); 55 | } 56 | 57 | /// 58 | /// Returns a Vector3 where each component of Vector A is multiplied by the equivalent component of Vector B. 59 | /// 60 | private Vector3 MultiplyByComponent(Vector3 a, Vector3 b) 61 | { 62 | Vector3 ret; 63 | 64 | ret.x = a.x * b.x; 65 | ret.y = a.y * b.y; 66 | ret.z = a.z * b.z; 67 | 68 | return ret; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Packages/AceArcadeMissilesV1.0.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Packages/AceArcadeMissilesV1.0.unitypackage -------------------------------------------------------------------------------- /Packages/EffectsDeleter.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Packages/EffectsDeleter.unitypackage -------------------------------------------------------------------------------- /Packages/FloatingOrigin.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Packages/FloatingOrigin.unitypackage -------------------------------------------------------------------------------- /Packages/FreeCamera.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Packages/FreeCamera.unitypackage -------------------------------------------------------------------------------- /Packages/Freelancer Ships.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Packages/Freelancer Ships.unitypackage -------------------------------------------------------------------------------- /Packages/MoveAndRotateUtilities.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Packages/MoveAndRotateUtilities.unitypackage -------------------------------------------------------------------------------- /Packages/OrbitCamera.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Packages/OrbitCamera.unitypackage -------------------------------------------------------------------------------- /Packages/RandomAreaSpawner.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Packages/RandomAreaSpawner.unitypackage -------------------------------------------------------------------------------- /Packages/ShipPhysics.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Packages/ShipPhysics.unitypackage -------------------------------------------------------------------------------- /Packages/SmartClip Sprite.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/brihernandez/UnityCommon/138b4d2c3afd5eaf2d784c4eb1614b0925a7df9f/Packages/SmartClip Sprite.unitypackage --------------------------------------------------------------------------------