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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ee40f80839af164b8507cf892937394
|
||||
@@ -1,3 +1,4 @@
|
||||
//Oliver
|
||||
using UnityEngine;
|
||||
|
||||
public class EquipmentManager : MonoBehaviour
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
//Oliver
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
|
||||
public class Health : MonoBehaviour
|
||||
{
|
||||
public int maxHP = 100;
|
||||
public int curHP;
|
||||
void Start()
|
||||
{
|
||||
curHP = maxHP;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(curHP <= 0)
|
||||
{
|
||||
die();
|
||||
}
|
||||
}
|
||||
public void die()
|
||||
{
|
||||
Destroy(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a187176846a552d4e8321e8645b42c94
|
||||
@@ -1,5 +1,6 @@
|
||||
//Oliver
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
public class PausenManager : MonoBehaviour
|
||||
{
|
||||
private bool isOn = false;
|
||||
@@ -30,4 +31,21 @@ public class PausenManager : MonoBehaviour
|
||||
Can.SetActive(false);
|
||||
}
|
||||
}
|
||||
public void going()
|
||||
{
|
||||
Can.SetActive(false);
|
||||
show();
|
||||
}
|
||||
public void lobby (string sceneName)
|
||||
{
|
||||
SceneManager.LoadScene(sceneName);
|
||||
}
|
||||
public void Quit()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//Oliver
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class Shoot : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameObject bulletPrefab;
|
||||
|
||||
@@ -14,10 +14,6 @@ public class UIHandler : MonoBehaviour
|
||||
{
|
||||
SceneManager.LoadScene(sceneName);
|
||||
}
|
||||
public void show()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void Quit()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user