Finished first chapter, added script code up to Enemy 3
This commit is contained in:
parent
b2d02e7133
commit
f1ae5c383e
@ -132,7 +132,7 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 159659455}
|
||||
m_Layer: 0
|
||||
m_Layer: 8
|
||||
m_Name: Cockpit
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -155,103 +155,6 @@ Transform:
|
||||
m_Father: {fileID: 998017459}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 180}
|
||||
--- !u!1 &210074117
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 210074118}
|
||||
- component: {fileID: 210074121}
|
||||
- component: {fileID: 210074120}
|
||||
- component: {fileID: 210074119}
|
||||
m_Layer: 0
|
||||
m_Name: Cockpit
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &210074118
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 210074117}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 2, y: 2, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2121904579}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!135 &210074119
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 210074117}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Radius: 0.5
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &210074120
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 210074117}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &210074121
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 210074117}
|
||||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!1 &563750950
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -264,7 +167,7 @@ GameObject:
|
||||
- component: {fileID: 563750954}
|
||||
- component: {fileID: 563750953}
|
||||
- component: {fileID: 563750952}
|
||||
m_Layer: 0
|
||||
m_Layer: 8
|
||||
m_Name: Cube
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -443,103 +346,6 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!1 &957087006
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 957087007}
|
||||
- component: {fileID: 957087010}
|
||||
- component: {fileID: 957087009}
|
||||
- component: {fileID: 957087008}
|
||||
m_Layer: 0
|
||||
m_Name: Wing
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &957087007
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 957087006}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 5, y: 5, z: 0.5}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2121904579}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!135 &957087008
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 957087006}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Radius: 0.5
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &957087009
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 957087006}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &957087010
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 957087006}
|
||||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!1 &963194225
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -551,6 +357,8 @@ GameObject:
|
||||
- component: {fileID: 963194228}
|
||||
- component: {fileID: 963194227}
|
||||
- component: {fileID: 963194226}
|
||||
- component: {fileID: 963194229}
|
||||
- component: {fileID: 963194230}
|
||||
m_Layer: 0
|
||||
m_Name: _MainCamera
|
||||
m_TagString: MainCamera
|
||||
@ -624,6 +432,43 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &963194229
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a2b7c79b712fe5c9ca22495cdf2f32b7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
radius: 1
|
||||
keepOnScreen: 0
|
||||
isOnScreen: 1
|
||||
camWidth: 0
|
||||
camHeight: 0
|
||||
offRight: 0
|
||||
offLeft: 0
|
||||
offUp: 0
|
||||
offDown: 0
|
||||
--- !u!114 &963194230
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e92a40d35c2c59b9c955492aa4ff067a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
prefabEnemies:
|
||||
- {fileID: 3328938117814550738, guid: f15f1018fc0ceb56abc7f4aedf145178, type: 3}
|
||||
enemySpawnPerSecond: 0.5
|
||||
enemyDefaultPadding: 1.5
|
||||
--- !u!1 &998017458
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -635,9 +480,9 @@ GameObject:
|
||||
- component: {fileID: 998017459}
|
||||
- component: {fileID: 998017461}
|
||||
- component: {fileID: 998017460}
|
||||
m_Layer: 0
|
||||
m_Layer: 8
|
||||
m_Name: _Hero
|
||||
m_TagString: Untagged
|
||||
m_TagString: Hero
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@ -691,7 +536,10 @@ MonoBehaviour:
|
||||
speed: 30
|
||||
rollMult: -45
|
||||
pitchMult: 30
|
||||
shieldLevel: 1
|
||||
gameRestartDelay: 2
|
||||
projectilePrefab: {fileID: 390831642383508558, guid: d58eefa3468510199b6e895172b42b17, type: 3}
|
||||
projectileSpeed: 40
|
||||
_shieldLevel: 1
|
||||
--- !u!1 &1065119440
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -704,7 +552,7 @@ GameObject:
|
||||
- component: {fileID: 1065119444}
|
||||
- component: {fileID: 1065119443}
|
||||
- component: {fileID: 1065119445}
|
||||
m_Layer: 0
|
||||
m_Layer: 8
|
||||
m_Name: Shield
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -784,7 +632,7 @@ SphereCollider:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1065119440}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_IsTrigger: 1
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Radius: 0.5
|
||||
@ -801,7 +649,7 @@ GameObject:
|
||||
- component: {fileID: 1237561515}
|
||||
- component: {fileID: 1237561514}
|
||||
- component: {fileID: 1237561513}
|
||||
m_Layer: 0
|
||||
m_Layer: 8
|
||||
m_Name: Wing
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -886,53 +734,3 @@ MeshFilter:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1237561511}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!1 &2121904578
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2121904579}
|
||||
- component: {fileID: 2121904580}
|
||||
m_Layer: 0
|
||||
m_Name: Enemy_0
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2121904579
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2121904578}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -20, y: 10, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 210074118}
|
||||
- {fileID: 957087007}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!54 &2121904580
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2121904578}
|
||||
serializedVersion: 2
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_UseGravity: 0
|
||||
m_IsKinematic: 1
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 120
|
||||
m_CollisionDetection: 0
|
||||
|
80
Assets/_Materials/Mat_Projectile.mat
Normal file
80
Assets/_Materials/Mat_Projectile.mat
Normal file
@ -0,0 +1,80 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Mat_Projectile
|
||||
m_Shader: {fileID: 4800000, guid: 7a80e71dafe87471ca6aa6d0d4bc61e3, type: 3}
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
8
Assets/_Materials/Mat_Projectile.mat.meta
Normal file
8
Assets/_Materials/Mat_Projectile.mat.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 761f3cf72ecff3f368ff55b834fdea50
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -10,9 +10,11 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 3328938117814550739}
|
||||
- component: {fileID: 3328938117814550740}
|
||||
m_Layer: 0
|
||||
- component: {fileID: -8555271791666490326}
|
||||
- component: {fileID: 438204090}
|
||||
m_Layer: 9
|
||||
m_Name: Enemy_0
|
||||
m_TagString: Untagged
|
||||
m_TagString: Enemy
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@ -50,6 +52,43 @@ Rigidbody:
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 120
|
||||
m_CollisionDetection: 0
|
||||
--- !u!114 &-8555271791666490326
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3328938117814550738}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bf379ee257cd884c58f85b182bc79ba4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
speed: 10
|
||||
fireRate: 0.3
|
||||
health: 10
|
||||
score: 100
|
||||
--- !u!114 &438204090
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3328938117814550738}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a2b7c79b712fe5c9ca22495cdf2f32b7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
radius: -2.5
|
||||
keepOnScreen: 0
|
||||
isOnScreen: 1
|
||||
camWidth: 0
|
||||
camHeight: 0
|
||||
offRight: 0
|
||||
offLeft: 0
|
||||
offUp: 0
|
||||
offDown: 0
|
||||
--- !u!1 &3328938118582946581
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -62,7 +101,7 @@ GameObject:
|
||||
- component: {fileID: 3328938118582946585}
|
||||
- component: {fileID: 3328938118582946584}
|
||||
- component: {fileID: 3328938118582946583}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Cockpit
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -159,7 +198,7 @@ GameObject:
|
||||
- component: {fileID: 3328938118776245298}
|
||||
- component: {fileID: 3328938118776245297}
|
||||
- component: {fileID: 3328938118776245296}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Wing
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
@ -10,9 +10,9 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1800709893527788011}
|
||||
- component: {fileID: 1800709893527788010}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Enemy_1
|
||||
m_TagString: Untagged
|
||||
m_TagString: Enemy
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@ -62,7 +62,7 @@ GameObject:
|
||||
- component: {fileID: 1800709893593984172}
|
||||
- component: {fileID: 1800709893593984173}
|
||||
- component: {fileID: 1800709893593984170}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Cockpit
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -159,7 +159,7 @@ GameObject:
|
||||
- component: {fileID: 1800709894787873078}
|
||||
- component: {fileID: 1800709894787873079}
|
||||
- component: {fileID: 1800709894787873076}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Wing
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
@ -12,7 +12,7 @@ GameObject:
|
||||
- component: {fileID: 1716873588288683972}
|
||||
- component: {fileID: 1716873588288683973}
|
||||
- component: {fileID: 1716873588288683970}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Wing
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -107,9 +107,9 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1716873588767813482}
|
||||
- component: {fileID: 1716873588767813485}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Enemy_2
|
||||
m_TagString: Untagged
|
||||
m_TagString: Enemy
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@ -160,7 +160,7 @@ GameObject:
|
||||
- component: {fileID: 1716873589088778162}
|
||||
- component: {fileID: 1716873589088778163}
|
||||
- component: {fileID: 1716873589088778160}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Cockpit
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -257,7 +257,7 @@ GameObject:
|
||||
- component: {fileID: 1716873589195704725}
|
||||
- component: {fileID: 1716873589195704722}
|
||||
- component: {fileID: 1716873589195704723}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Reactor
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
@ -12,7 +12,7 @@ GameObject:
|
||||
- component: {fileID: 1454311046528656509}
|
||||
- component: {fileID: 1454311046528656498}
|
||||
- component: {fileID: 1454311046528656499}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: CockpitR
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -109,7 +109,7 @@ GameObject:
|
||||
- component: {fileID: 1454311047172196508}
|
||||
- component: {fileID: 1454311047172196509}
|
||||
- component: {fileID: 1454311047172196498}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Wing
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -206,7 +206,7 @@ GameObject:
|
||||
- component: {fileID: 1454311047375885546}
|
||||
- component: {fileID: 1454311047375885547}
|
||||
- component: {fileID: 1454311047375885544}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: CockpitL
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -301,9 +301,9 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1454311047477341967}
|
||||
- component: {fileID: 1454311047477341966}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Enemy_3
|
||||
m_TagString: Untagged
|
||||
m_TagString: Enemy
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
|
@ -10,9 +10,9 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 5688048094632641678}
|
||||
- component: {fileID: 5688048094632641679}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Enemy_4
|
||||
m_TagString: Untagged
|
||||
m_TagString: Enemy
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
@ -64,7 +64,7 @@ GameObject:
|
||||
- component: {fileID: 5688048095306501622}
|
||||
- component: {fileID: 5688048095306501621}
|
||||
- component: {fileID: 5688048095306501620}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: WingR
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -161,7 +161,7 @@ GameObject:
|
||||
- component: {fileID: 5688048095477329005}
|
||||
- component: {fileID: 5688048095477329004}
|
||||
- component: {fileID: 5688048095477329003}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: WingL
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -258,7 +258,7 @@ GameObject:
|
||||
- component: {fileID: 5688048095502189624}
|
||||
- component: {fileID: 5688048095502189623}
|
||||
- component: {fileID: 5688048095502189622}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Fuselage
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@ -355,7 +355,7 @@ GameObject:
|
||||
- component: {fileID: 5688048095870530702}
|
||||
- component: {fileID: 5688048095870530701}
|
||||
- component: {fileID: 5688048095870530700}
|
||||
m_Layer: 0
|
||||
m_Layer: 9
|
||||
m_Name: Cockpit
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
|
151
Assets/_Prefabs/ProjectileHero.prefab
Normal file
151
Assets/_Prefabs/ProjectileHero.prefab
Normal file
@ -0,0 +1,151 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &390831642383508558
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 390831642383508546}
|
||||
- component: {fileID: 390831642383508545}
|
||||
- component: {fileID: 390831642383508544}
|
||||
- component: {fileID: 390831642383508559}
|
||||
- component: {fileID: 390831642383508547}
|
||||
- component: {fileID: 390831642383508548}
|
||||
- component: {fileID: 390831642383508549}
|
||||
m_Layer: 10
|
||||
m_Name: ProjectileHero
|
||||
m_TagString: ProjectileHero
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &390831642383508546
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 390831642383508558}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 10, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.25, y: 1, z: 0.5}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &390831642383508545
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 390831642383508558}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &390831642383508544
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 390831642383508558}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 761f3cf72ecff3f368ff55b834fdea50, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!65 &390831642383508559
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 390831642383508558}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 10}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!54 &390831642383508547
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 390831642383508558}
|
||||
serializedVersion: 2
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_UseGravity: 0
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 120
|
||||
m_CollisionDetection: 1
|
||||
--- !u!114 &390831642383508548
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 390831642383508558}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 74ad9c373a5d2b5e69bdb49a1f50e209, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &390831642383508549
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 390831642383508558}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a2b7c79b712fe5c9ca22495cdf2f32b7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
radius: -1
|
||||
keepOnScreen: 0
|
||||
isOnScreen: 1
|
||||
camWidth: 0
|
||||
camHeight: 0
|
||||
offRight: 0
|
||||
offLeft: 0
|
||||
offUp: 0
|
||||
offDown: 0
|
7
Assets/_Prefabs/ProjectileHero.prefab.meta
Normal file
7
Assets/_Prefabs/ProjectileHero.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d58eefa3468510199b6e895172b42b17
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -10,10 +10,14 @@ public class BoundsCheck : MonoBehaviour
|
||||
{
|
||||
[Header("Set in Inspector")]
|
||||
public float radius = 1f;
|
||||
public bool keepOnScreen = true;
|
||||
|
||||
[Header("Set Dynamically")]
|
||||
public bool isOnScreen = true;
|
||||
public float camWidth;
|
||||
public float camHeight;
|
||||
[HideInInspector]
|
||||
public bool offRight, offLeft, offUp, offDown;
|
||||
|
||||
void Awake() {
|
||||
camHeight = Camera.main.orthographicSize;
|
||||
@ -22,23 +26,33 @@ public class BoundsCheck : MonoBehaviour
|
||||
|
||||
void LateUpdate () {
|
||||
Vector3 pos = transform.position;
|
||||
isOnScreen = true;
|
||||
offRight = offLeft = offUp = offDown = false;
|
||||
|
||||
if (pos.x > camWidth - radius) {
|
||||
pos.x = camWidth - radius;
|
||||
offRight = true;
|
||||
}
|
||||
|
||||
if (pos.x < -camWidth + radius) {
|
||||
pos.x = -camWidth + radius;
|
||||
offLeft = true;
|
||||
}
|
||||
|
||||
if (pos.y > camHeight - radius) {
|
||||
pos.y = camHeight - radius;
|
||||
offUp = true;
|
||||
}
|
||||
if (pos.y < -camHeight + radius) {
|
||||
pos.y = -camHeight + radius;
|
||||
offDown = true;
|
||||
}
|
||||
isOnScreen = !(offRight || offLeft || offUp || offDown);
|
||||
if (keepOnScreen && !isOnScreen) {
|
||||
transform.position = pos;
|
||||
isOnScreen = true;
|
||||
offRight = offLeft = offUp = offDown = false;
|
||||
}
|
||||
|
||||
transform.position = pos;
|
||||
}
|
||||
|
||||
// Draw the bounds in the Scene pane using OnDrawGizmos()
|
||||
|
59
Assets/__Scripts/Enemy.cs
Normal file
59
Assets/__Scripts/Enemy.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Enemy : MonoBehaviour
|
||||
{
|
||||
[Header("Set in Inspector: Enemy")]
|
||||
public float speed = 10f; // The speed in m/s
|
||||
public float fireRate = 0.3f; // Seconds/shot (Unused)
|
||||
public float health = 10;
|
||||
public int score = 100; // Points earned for destroying this
|
||||
protected BoundsCheck bndCheck;
|
||||
|
||||
void Awake() {
|
||||
bndCheck = GetComponent<BoundsCheck>();
|
||||
}
|
||||
|
||||
// This is a Property: A method that acts like a field
|
||||
public Vector3 pos {
|
||||
get {
|
||||
return( this.transform.position );
|
||||
}
|
||||
set {
|
||||
this.transform.position = value;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Move() {
|
||||
Vector3 tempPos = pos;
|
||||
tempPos.y -= speed * Time.deltaTime;
|
||||
pos = tempPos;
|
||||
}
|
||||
|
||||
void OnCollisionEnter(Collision coll) {
|
||||
GameObject otherGO = coll.gameObject;
|
||||
if (otherGO.tag == "ProjectileHero") {
|
||||
Destroy(otherGO); // Destroy the Projectile
|
||||
Destroy(gameObject); // Destroy this Enemy GameObject
|
||||
} else {
|
||||
print("Enemy hit by non-ProjectileHero: " + otherGO.name);
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
Move();
|
||||
if (bndCheck != null && bndCheck.offDown) {
|
||||
// We're off the bottom, so destroy this GameObject
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/__Scripts/Enemy.cs.meta
Normal file
11
Assets/__Scripts/Enemy.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf379ee257cd884c58f85b182bc79ba4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
42
Assets/__Scripts/Enemy_1.cs
Normal file
42
Assets/__Scripts/Enemy_1.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
// Enemy_1 extends the Enemy class
|
||||
public class Enemy_1 : Enemy
|
||||
{
|
||||
[Header("Set in Inspector: Enemy_1")]
|
||||
// # seconds for a full sine wave
|
||||
public float waveFrequency = 2;
|
||||
// sine wave width in meters
|
||||
public float waveWidth = 4;
|
||||
public float waveRotY = 45;
|
||||
private float x0; // The initial x value of pos
|
||||
private float birthTime;
|
||||
|
||||
// Start works well because it's not used by the Enemy superclass
|
||||
void Start() {
|
||||
// Set x0 to the initial x position of Enemy_1
|
||||
x0 = pos.x;
|
||||
birthTime = Time.time;
|
||||
}
|
||||
|
||||
// Override the Move function on Enemy
|
||||
public override void Move() {
|
||||
// Because pos is a property, you can't directly set pos.x
|
||||
// so get the pos as an editable Vector3
|
||||
Vector3 tempPos = pos;
|
||||
// theta adjusts based on time
|
||||
float age = Time.time - birthTime;
|
||||
float theta = Mathf.PI * 2 * age / waveFrequency;
|
||||
float sin = Mathf.Sin(theta);
|
||||
tempPos.x = x0 + waveWidth * sin;
|
||||
pos = tempPos;
|
||||
// rotate a bit about y
|
||||
Vector3 rot = new Vector3(0, sin*waveRotY, 0);
|
||||
this.transform.rotation = Quaternion.Euler(rot);
|
||||
// base.Move() still handles the movement down in y
|
||||
base.Move();
|
||||
// print(bndCheck.isOnScreen);
|
||||
}
|
||||
}
|
11
Assets/__Scripts/Enemy_1.cs.meta
Normal file
11
Assets/__Scripts/Enemy_1.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67239b4e04039f3d28db4ea469fb531c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
48
Assets/__Scripts/Enemy_2.cs
Normal file
48
Assets/__Scripts/Enemy_2.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Enemy_2 : Enemy
|
||||
{
|
||||
[Header("Set in Inspector: Enemy_2")]
|
||||
// Determines how much the Sine wave will affect movement
|
||||
public float sinEccentricity = 0.6f;
|
||||
public float lifeTime = 10;
|
||||
[Header("Set Dynamically: Enemy_2")]
|
||||
// Enemy_2 uses a Sin wave to modify a 2-point linear interpolation
|
||||
public Vector3 p0;
|
||||
public Vector3 p1;
|
||||
public float birthTime;
|
||||
void Start() {
|
||||
// Pick any point on the left side of the screen
|
||||
p0 = Vector3.zero;
|
||||
p0.x = -bndCheck.camWidth - bndCheck.radius;
|
||||
p0.y = Random.Range(-bndCheck.camHeight, bndCheck.camHeight);
|
||||
// Pick any point on the right side of the screen
|
||||
p1 = Vector3.zero;
|
||||
p1.x = bndCheck.camWidth + bndCheck.radius;
|
||||
p1.y = Random.Range(-bndCheck.camHeight, bndCheck.camHeight);
|
||||
// Possibly swap sides
|
||||
if (Random.value > 0.5f) {
|
||||
// Setting the .x of each point to its negative will move it to
|
||||
// the other side of the screen
|
||||
p0.x *= -1;
|
||||
p1.x *= -1;
|
||||
}
|
||||
// Set the birthTime to the current time
|
||||
birthTime = Time.time;
|
||||
}
|
||||
public override void Move() {
|
||||
// Bezier curves work based on a u value between 0 & 1
|
||||
float u = (Time.time - birthTime) / lifeTime;
|
||||
// If u>1, then it has been longer than lifeTime since birthTime
|
||||
if (u > 1) {
|
||||
// This Enemy_2 has finished its life
|
||||
Destroy(this.gameObject);
|
||||
return;
|
||||
}
|
||||
// Adjust u by adding a U Curve based on a Sine wave
|
||||
u = u + sinEccentricity*(Mathf.Sin(u*Mathf.PI*2));
|
||||
pos = (1-u)*p0 + u*p1;
|
||||
}
|
||||
}
|
11
Assets/__Scripts/Enemy_2.cs.meta
Normal file
11
Assets/__Scripts/Enemy_2.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8424fdbcb6a86d74f860fe068d094d3b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
50
Assets/__Scripts/Enemy_3.cs
Normal file
50
Assets/__Scripts/Enemy_3.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Enemy_3 : Enemy
|
||||
{
|
||||
// Enemy_3 will move following a Bezier curve, which is a linear
|
||||
// interpolation between more than two points.
|
||||
[Header("Set in Inspector: Enemy_3")]
|
||||
public float lifeTime = 5;
|
||||
[Header("Set Dynamically: Enemy_3")]
|
||||
public Vector3[] points;
|
||||
public float birthTime;
|
||||
// Again, Start works well because its not used by the Enemy superclass
|
||||
void Start() {
|
||||
points = new Vector3[3]; // Initialize points
|
||||
// The start position has already been set by Main.SpawnEnemy()
|
||||
points[0] = pos;
|
||||
// Set xMin and xMax that same way that Main.SpawnEnemy() does
|
||||
float xMin = -bndCheck.camWidth + bndCheck.radius;
|
||||
float xMax = bndCheck.camWidth - bndCheck.radius;
|
||||
Vector3 v = Vector3.zero;
|
||||
// Pick a random middle position in the bottom half of the screen;
|
||||
v.x = Random.Range(xMin, xMax);
|
||||
v.y = -bndCheck.camHeight * Random.Range(2.75f, 2);
|
||||
points[1] = v;
|
||||
// Pick a random final position above the top of the screen
|
||||
v = Vector3.zero;
|
||||
v.y = pos.y;
|
||||
v.x = Random.Range(xMin, xMax);
|
||||
points[2] = v;
|
||||
// Set the birthTime to the current time
|
||||
birthTime = Time.time;
|
||||
}
|
||||
public override void Move() {
|
||||
// Bezier curves work based on a u value between 0 & 1
|
||||
float u = (Time.time - birthTime) / lifeTime;
|
||||
if (u > 1) {
|
||||
// This Enemy_3 has finished its life
|
||||
Destroy(this.gameObject);
|
||||
return;
|
||||
}
|
||||
// Interpolate the three Bezier cruve points
|
||||
Vector3 p01, p12;
|
||||
u = u - 0.2f*Mathf.Sin(u * Mathf.PI * 2);
|
||||
p01 = (1-u)*points[0] + u*points[1];
|
||||
p12 = (1-u)*points[1] + u*points[2];
|
||||
pos = (1-u)*p01 + u*p12;
|
||||
}
|
||||
}
|
11
Assets/__Scripts/Enemy_3.cs.meta
Normal file
11
Assets/__Scripts/Enemy_3.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 949d50caf3a9277bd80ee88fcc10bf9a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
18
Assets/__Scripts/Enemy_4.cs
Normal file
18
Assets/__Scripts/Enemy_4.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Enemy_4 : Enemy
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/__Scripts/Enemy_4.cs.meta
Normal file
11
Assets/__Scripts/Enemy_4.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 890512b9c88f600408f25130d273807b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -11,9 +11,14 @@ public class Hero : MonoBehaviour
|
||||
public float speed = 30;
|
||||
public float rollMult = -45;
|
||||
public float pitchMult = 30;
|
||||
public float gameRestartDelay = 2f;
|
||||
public GameObject projectilePrefab;
|
||||
public float projectileSpeed = 40;
|
||||
|
||||
[Header("Set Dynamically")]
|
||||
public float shieldLevel = 1;
|
||||
public float _shieldLevel = 1;
|
||||
// This variables holds a reference to the last triggering GameObject
|
||||
private GameObject lastTriggerGo = null;
|
||||
|
||||
void Awake() {
|
||||
if (S == null) {
|
||||
@ -44,5 +49,47 @@ public class Hero : MonoBehaviour
|
||||
|
||||
// Rotate the ship to make it feel more dynamic
|
||||
transform.rotation = Quaternion.Euler(yAxis*pitchMult,xAxis*rollMult,0);
|
||||
// Allow the ship to fire
|
||||
if (Input.GetKeyDown(KeyCode.Space)) {
|
||||
TempFire();
|
||||
}
|
||||
}
|
||||
|
||||
void TempFire() {
|
||||
GameObject projGO = Instantiate<GameObject>(projectilePrefab);
|
||||
projGO.transform.position = transform.position;
|
||||
Rigidbody rigidB = projGO.GetComponent<Rigidbody>();
|
||||
rigidB.velocity = Vector3.up * projectileSpeed;
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider other) {
|
||||
Transform rootT = other.gameObject.transform.root;
|
||||
GameObject go = rootT.gameObject;
|
||||
//print("Triggered: " + go.name);
|
||||
// Make sure it's not the same triggering go as last time
|
||||
if (go == lastTriggerGo) {
|
||||
return;
|
||||
}
|
||||
lastTriggerGo = go;
|
||||
if (go.tag == "Enemy") {
|
||||
shieldLevel--;
|
||||
Destroy(go);
|
||||
} else {
|
||||
print("Triggered by non-Enemy: " + go.name);
|
||||
}
|
||||
}
|
||||
public float shieldLevel {
|
||||
get {
|
||||
return(_shieldLevel);
|
||||
}
|
||||
set {
|
||||
_shieldLevel = Mathf.Min(value, 4);
|
||||
// If the shield is going to be set to less than zero
|
||||
if (value < 0) {
|
||||
Destroy(this.gameObject);
|
||||
// Tell Main.S to restart the game after a delay
|
||||
Main.S.DelayedRestart(gameRestartDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
51
Assets/__Scripts/Main.cs
Normal file
51
Assets/__Scripts/Main.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Main : MonoBehaviour
|
||||
{
|
||||
static public Main S;
|
||||
[Header("Set in Inspector")]
|
||||
public GameObject[] prefabEnemies;
|
||||
public float enemySpawnPerSecond = 0.5f;
|
||||
public float enemyDefaultPadding = 1.5f;
|
||||
private BoundsCheck bndCheck;
|
||||
|
||||
void Awake() {
|
||||
S = this;
|
||||
// Set bndCheck to reference the BoundsCheck component of this GameObject
|
||||
bndCheck = GetComponent<BoundsCheck>();
|
||||
// Invoke SpawnEnemy() once (in 2 seconds, based on default values)
|
||||
Invoke("SpawnEnemy", 1f/enemySpawnPerSecond);
|
||||
}
|
||||
|
||||
public void SpawnEnemy() {
|
||||
// Pick a random Enemy prefab to instantiate
|
||||
int ndx = Random.Range(0, prefabEnemies.Length);
|
||||
GameObject go = Instantiate<GameObject>(prefabEnemies[ndx]);
|
||||
// Position the Enemy above the screen with a random x position
|
||||
float enemyPadding = enemyDefaultPadding;
|
||||
if (go.GetComponent<BoundsCheck>() != null) {
|
||||
enemyPadding = Mathf.Abs(go.GetComponent<BoundsCheck>().radius);
|
||||
}
|
||||
// Set the initial position for the spawned Enemy
|
||||
Vector3 pos = Vector3.zero;
|
||||
float xMin = -bndCheck.camWidth + enemyPadding;
|
||||
float xMax = bndCheck.camWidth - enemyPadding;
|
||||
pos.x = Random.Range(xMin, xMax);
|
||||
pos.y = bndCheck.camHeight + enemyPadding;
|
||||
go.transform.position = pos;
|
||||
// Invoke SpawnEnemy() again
|
||||
Invoke("SpawnEnemy", 1f/enemySpawnPerSecond);
|
||||
}
|
||||
|
||||
public void DelayedRestart(float delay) {
|
||||
// Invoke the Restart() method in delay seconds
|
||||
Invoke("Restart", delay);
|
||||
}
|
||||
public void Restart() {
|
||||
// Reload _Scene_0 to restart the game
|
||||
SceneManager.LoadScene("_Scene_0");
|
||||
}
|
||||
}
|
11
Assets/__Scripts/Main.cs.meta
Normal file
11
Assets/__Scripts/Main.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e92a40d35c2c59b9c955492aa4ff067a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/__Scripts/Projectile.cs
Normal file
26
Assets/__Scripts/Projectile.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Projectile : MonoBehaviour
|
||||
{
|
||||
private BoundsCheck bndCheck;
|
||||
|
||||
void Awake() {
|
||||
bndCheck = GetComponent<BoundsCheck>();
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (bndCheck.offUp) {
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/__Scripts/Projectile.cs.meta
Normal file
11
Assets/__Scripts/Projectile.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74ad9c373a5d2b5e69bdb49a1f50e209
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -3,10 +3,11 @@
|
||||
--- !u!55 &1
|
||||
PhysicsManager:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
serializedVersion: 13
|
||||
m_Gravity: {x: 0, y: -9.81, z: 0}
|
||||
m_DefaultMaterial: {fileID: 0}
|
||||
m_BounceThreshold: 2
|
||||
m_DefaultMaxDepenetrationVelocity: 10
|
||||
m_SleepThreshold: 0.005
|
||||
m_DefaultContactOffset: 0.01
|
||||
m_DefaultSolverIterations: 6
|
||||
@ -17,11 +18,12 @@ PhysicsManager:
|
||||
m_ClothInterCollisionDistance: 0
|
||||
m_ClothInterCollisionStiffness: 0
|
||||
m_ContactsGeneration: 1
|
||||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
m_LayerCollisionMatrix: ffe0ffffffe0ffffffe0ffffffffffffffe0ffffffe0ffffffffffffffffffffc8faffffc8e5ffffc8e2ffffc8e1ffffc8e1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
m_AutoSimulation: 1
|
||||
m_AutoSyncTransforms: 0
|
||||
m_ReuseCollisionCallbacks: 1
|
||||
m_ClothInterCollisionSettingsToggle: 0
|
||||
m_ClothGravity: {x: 0, y: -9.81, z: 0}
|
||||
m_ContactPairsMode: 0
|
||||
m_BroadphaseType: 0
|
||||
m_WorldBounds:
|
||||
@ -31,4 +33,6 @@ PhysicsManager:
|
||||
m_FrictionType: 0
|
||||
m_EnableEnhancedDeterminism: 0
|
||||
m_EnableUnifiedHeightmaps: 1
|
||||
m_DefaultMaxAngluarSpeed: 7
|
||||
m_ImprovedPatchFriction: 0
|
||||
m_SolverType: 0
|
||||
m_DefaultMaxAngularSpeed: 7
|
||||
|
@ -3,7 +3,13 @@
|
||||
--- !u!78 &1
|
||||
TagManager:
|
||||
serializedVersion: 2
|
||||
tags: []
|
||||
tags:
|
||||
- Hero
|
||||
- Enemy
|
||||
- ProjectileEnemy
|
||||
- PowerUp
|
||||
- ProjectileHero
|
||||
- PowerUpBox
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
@ -13,11 +19,11 @@ TagManager:
|
||||
- UI
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
- Hero
|
||||
- Enemy
|
||||
- ProjectileHero
|
||||
- ProjectileEnemy
|
||||
- PowerUp
|
||||
-
|
||||
-
|
||||
-
|
||||
|
Loading…
Reference in New Issue
Block a user