Waffen Prefab fix Game map spielbar mit Charakter waffe kann schießen pause maneger und Equiepment bearbeitet und health skript hinzugefügt
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
//Oliver
|
||||
using UnityEngine;
|
||||
|
||||
public class Bullet : MonoBehaviour
|
||||
{
|
||||
public float speed;
|
||||
public int damage;
|
||||
private Vector3 position = Vector3.forward;
|
||||
private Rigidbody rb;
|
||||
void Start()
|
||||
{
|
||||
GetComponent<Rigidbody>();
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.Translate(position.normalized * speed * Time.deltaTime);
|
||||
}
|
||||
private void OnCollisionEnter(Collision collision)
|
||||
{
|
||||
if (collision.gameObject.tag == "Enemy")
|
||||
{
|
||||
Destroy(collision.gameObject);
|
||||
}
|
||||
else if(collision.gameObject.tag == "Wall")
|
||||
{
|
||||
Destroy(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user