added game scene and explosion particle system

This commit is contained in:
louishorlaville 2022-05-15 00:00:48 -04:00
parent b92a798be0
commit a20fa0000b
16 changed files with 33917 additions and 149 deletions

View File

@ -30,7 +30,7 @@ AnimationClip:
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 1
value: {x: 3, y: 3, z: 3}
value: {x: 1, y: 1, z: 1}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
tangentMode: 0
@ -86,7 +86,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 3
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
@ -114,7 +114,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 3
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
@ -142,7 +142,7 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 3
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136

BIN
Assets/Art/Materials/Explosion.mat (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Art/Materials/Explosion.mat.meta (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Art/circle.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Art/circle.png.meta (Stored with Git LFS) Normal file

Binary file not shown.

8
Assets/Particles.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 225162e97d412cc4d81497df1a969ecd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0a208950d4f32da48b5b03e103af591b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -95,7 +95,7 @@ SphereCollider:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5630905120393344806}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5

View File

@ -11,7 +11,6 @@ GameObject:
- component: {fileID: 4834061105045701539}
- component: {fileID: 4834061105045701550}
- component: {fileID: 4834061105045701537}
- component: {fileID: 4834061105045701536}
m_Layer: 0
m_Name: Cube (7)
m_TagString: Untagged
@ -27,11 +26,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4834061105045701538}
m_LocalRotation: {x: -0.31063926, y: 0.14804254, z: -0.010474649, w: 0.9388701}
m_LocalPosition: {x: 0.09, y: -1.04, z: 0.75}
m_LocalPosition: {x: 0.09000015, y: -1.0400009, z: 0.75}
m_LocalScale: {x: 1, y: 1, z: 0.33878884}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4834061106301780288}
m_Father: {fileID: 378992053168571211}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: -35.465, y: 20.444, z: -7.879}
--- !u!33 &4834061105045701550
@ -84,19 +83,6 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &4834061105045701536
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4834061105045701538}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &4834061105164763785
GameObject:
m_ObjectHideFlags: 0
@ -123,11 +109,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4834061105164763785}
m_LocalRotation: {x: -0.31063926, y: 0.14804254, z: -0.010474649, w: 0.9388701}
m_LocalPosition: {x: 2.38, y: -0.69, z: 2.1}
m_LocalPosition: {x: 2.3799992, y: -0.69000053, z: 2.0999985}
m_LocalScale: {x: 1, y: 1, z: 5.8124256}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4834061106301780288}
m_Father: {fileID: 378992053168571211}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!108 &4834061105164763796
@ -223,7 +209,6 @@ GameObject:
- component: {fileID: 4834061105485588897}
- component: {fileID: 4834061105485588908}
- component: {fileID: 4834061105485588911}
- component: {fileID: 4834061105485588910}
m_Layer: 0
m_Name: Cube (3)
m_TagString: Untagged
@ -243,7 +228,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 5.8124256}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4834061106301780288}
m_Father: {fileID: 378992053168571211}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: -35.465, y: 20.444, z: -7.879}
--- !u!33 &4834061105485588908
@ -296,19 +281,6 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &4834061105485588910
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4834061105485588896}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &4834061106125087374
GameObject:
m_ObjectHideFlags: 0
@ -320,7 +292,6 @@ GameObject:
- component: {fileID: 4834061106125087375}
- component: {fileID: 4834061106125087370}
- component: {fileID: 4834061106125087373}
- component: {fileID: 4834061106125087372}
m_Layer: 0
m_Name: Cube (9)
m_TagString: Untagged
@ -336,11 +307,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4834061106125087374}
m_LocalRotation: {x: -0.31063926, y: 0.14804254, z: -0.010474649, w: 0.9388701}
m_LocalPosition: {x: -1.92, y: 0.23, z: 0.55}
m_LocalPosition: {x: -1.9200001, y: 0.22999954, z: 0.54999924}
m_LocalScale: {x: 2.3171, y: 0.22996, z: 0.33878884}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4834061106301780288}
m_Father: {fileID: 378992053168571211}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: -35.465, y: 20.444, z: -7.879}
--- !u!33 &4834061106125087370
@ -393,19 +364,6 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &4834061106125087372
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4834061106125087374}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &4834061106301780291
GameObject:
m_ObjectHideFlags: 0
@ -438,13 +396,8 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4834061105164763798}
- {fileID: 4834061105485588897}
- {fileID: 4834061106792183646}
- {fileID: 4834061105045701539}
- {fileID: 4834061106819148423}
- {fileID: 4834061106125087375}
- {fileID: 1515961868728325797}
- {fileID: 9175352504942883267}
- {fileID: 378992053168571211}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -460,7 +413,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3d66a652767ef0249ae03fc7183790d7, type: 3}
m_Name:
m_EditorClassIdentifier:
explosion: {fileID: 6113853661072388009}
explosionDebris: {fileID: 6704497973935827627}
landingPoint: {fileID: 0}
body: {fileID: 4916962407531476031}
flyingSpeed: 50
--- !u!54 &3119225800646921348
Rigidbody:
@ -518,7 +474,6 @@ GameObject:
- component: {fileID: 4834061106792183646}
- component: {fileID: 4834061106792183645}
- component: {fileID: 4834061106792183644}
- component: {fileID: 4834061106792183647}
m_Layer: 0
m_Name: Cube (6)
m_TagString: Untagged
@ -538,7 +493,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 0.33878884}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4834061106301780288}
m_Father: {fileID: 378992053168571211}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: -35.465, y: 20.444, z: -7.879}
--- !u!33 &4834061106792183645
@ -591,19 +546,6 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &4834061106792183647
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4834061106792183633}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &4834061106819148422
GameObject:
m_ObjectHideFlags: 0
@ -615,7 +557,6 @@ GameObject:
- component: {fileID: 4834061106819148423}
- component: {fileID: 4834061106819148418}
- component: {fileID: 4834061106819148421}
- component: {fileID: 4834061106819148420}
m_Layer: 0
m_Name: Cube (8)
m_TagString: Untagged
@ -631,11 +572,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4834061106819148422}
m_LocalRotation: {x: -0.31063926, y: 0.14804254, z: -0.010474649, w: 0.9388701}
m_LocalPosition: {x: 1.79, y: -0.21, z: -0.51}
m_LocalPosition: {x: 1.789999, y: -0.20999908, z: -0.5099983}
m_LocalScale: {x: 2.3171, y: 0.22996, z: 0.33878884}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4834061106301780288}
m_Father: {fileID: 378992053168571211}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: -35.465, y: 20.444, z: -7.879}
--- !u!33 &4834061106819148418
@ -688,19 +629,44 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &4834061106819148420
BoxCollider:
--- !u!1 &4916962407531476031
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4834061106819148422}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 378992053168571211}
m_Layer: 0
m_Name: Body
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &378992053168571211
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4916962407531476031}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4834061105164763798}
- {fileID: 4834061105485588897}
- {fileID: 4834061106792183646}
- {fileID: 4834061105045701539}
- {fileID: 4834061106819148423}
- {fileID: 4834061106125087375}
- {fileID: 1515961868728325797}
m_Father: {fileID: 4834061106301780288}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7974633672851571803
GameObject:
m_ObjectHideFlags: 0
@ -727,11 +693,11 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7974633672851571803}
m_LocalRotation: {x: -0.31063926, y: 0.14804254, z: -0.010474649, w: 0.9388701}
m_LocalPosition: {x: -2.6, y: 0.01, z: -1.66}
m_LocalPosition: {x: -2.6000004, y: 0.010000229, z: -1.6599998}
m_LocalScale: {x: 1, y: 1, z: 5.8124256}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4834061106301780288}
m_Father: {fileID: 378992053168571211}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!108 &1492897518398264755
@ -816,3 +782,75 @@ MonoBehaviour:
m_ShadowLayerMask: 1
m_LightCookieSize: {x: 1, y: 1}
m_LightCookieOffset: {x: 0, y: 0}
--- !u!1001 &2957969651565829379
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 4834061106301780288}
m_Modifications:
- target: {fileID: 138504292592014834, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_Name
value: Explosion
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
--- !u!198 &6113853661072388009 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 9066894193389433514, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
m_PrefabInstance: {fileID: 2957969651565829379}
m_PrefabAsset: {fileID: 0}
--- !u!198 &6704497973935827627 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 8360924853862332328, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
m_PrefabInstance: {fileID: 2957969651565829379}
m_PrefabAsset: {fileID: 0}
--- !u!4 &9175352504942883267 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6222206415246453952, guid: 0a208950d4f32da48b5b03e103af591b, type: 3}
m_PrefabInstance: {fileID: 2957969651565829379}
m_PrefabAsset: {fileID: 0}

File diff suppressed because it is too large Load Diff

4321
Assets/Scenes/Game.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8bb2bf2697d291f4489c326d05527161
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -42,15 +42,11 @@ public class CannonScript : MonoBehaviour
if (Physics.Raycast(transform.position, lookDir, out hit, Mathf.Infinity))
{
Debug.DrawRay(transform.position, lookDir * hit.distance, Color.yellow);
GameObject hitObject = hit.collider.gameObject;
Debug.Log(hitObject.name);
if (hitObject.tag == "Enemy")
{
hitObject.GetComponent<Enemy>().IsShot();
hitObject.GetComponent<Enemy>().IsShot(hit.distance);
}
}
}

View File

@ -4,12 +4,12 @@ using UnityEngine;
public class Enemy : MonoBehaviour
{
public ParticleSystem explosion;
public ParticleSystem explosionDebris;
public Transform landingPoint;
public GameObject body;
public float flyingSpeed;
Vector3 launchDirection;
private void Update()
{
//Debug.DrawRay(transform.position, launchDirection, Color.red);
@ -18,7 +18,6 @@ public class Enemy : MonoBehaviour
{
this.landingPoint = landingPoint;
gameObject.transform.LookAt(landingPoint);
GetLaunchDirection();
}
@ -27,20 +26,27 @@ public class Enemy : MonoBehaviour
StartCoroutine("Launch", 0.01f);
}
//TODO: find direction between spawn point and landing point
void GetLaunchDirection()
{
this.launchDirection = transform.position - landingPoint.position;
}
IEnumerator Launch()
{
yield return new WaitForSeconds(.1f);
gameObject.GetComponent<Rigidbody>().velocity = gameObject.transform.forward * flyingSpeed;
}
public void IsShot()
public void IsShot(float distance)
{
float destroyDelay = Mathf.Sqrt(distance)/(500/5);
Debug.Log(distance+" : "+destroyDelay);
StartCoroutine(Destroy(destroyDelay));
}
private IEnumerator Destroy(float waitTime)
{
gameObject.GetComponent<Rigidbody>().velocity = gameObject.transform.forward * (flyingSpeed / 3);
yield return new WaitForSeconds(waitTime);
body.SetActive(false);
explosion.Emit(100);
explosionDebris.Emit(40);
yield return new WaitForSeconds(3f);
Destroy(gameObject);
}
}