BulletImpact Particals(noch nicht fertig)
This commit is contained in:
@@ -7,6 +7,8 @@ using UnityEngine;
|
||||
public class BulletScript : MonoBehaviour
|
||||
{
|
||||
public DataBullet dataBullet;
|
||||
|
||||
public GameObject particalClash;
|
||||
|
||||
public float lifetime = 3f;
|
||||
private Rigidbody rb;
|
||||
@@ -30,6 +32,8 @@ public class BulletScript : MonoBehaviour
|
||||
}
|
||||
private void OnCollisionEnter(Collision collision){
|
||||
Debug.Log(collision.gameObject.name);
|
||||
ContactPoint contact = collision.GetContact(0);
|
||||
Instantiate(particalClash,transform.position,Quaternion.LookRotation(contact.normal));
|
||||
GameObject.Destroy(this.gameObject);
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
|
28
Plunderblock/Assets/Scripts/ScriptsKevin/ParticalClash.cs
Normal file
28
Plunderblock/Assets/Scripts/ScriptsKevin/ParticalClash.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ParticalClash : MonoBehaviour
|
||||
{
|
||||
|
||||
public float lifeTime = 2;
|
||||
private float time = 0;
|
||||
|
||||
private void die(float time, float lifeTime){
|
||||
if(time > lifeTime){
|
||||
GameObject.Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
die(time, lifeTime);
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e78e7c61fba07742ae26607d4fa9390
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user