Fertiges Game hochgeladen
This commit is contained in:
8
Assets/Scripts/Gegner.meta
Normal file
8
Assets/Scripts/Gegner.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d14dc7965824344ea2cb8069e449ef3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
77
Assets/Scripts/Gegner/Bullet Movement CDM.cs
Normal file
77
Assets/Scripts/Gegner/Bullet Movement CDM.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Bullet_movement_Enemy : MonoBehaviour
|
||||
{
|
||||
[SerializeField] float dmg = 0.0f;
|
||||
[SerializeField] private float verticalSpeed = 15.0f;
|
||||
public float remainInAir = 1.0f;
|
||||
private float counter = 0f;
|
||||
private Slider slider;
|
||||
private GameObject uiElement;
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
slider = FindObjectOfType<Slider>(); //Findet den ersten slider in der scene - hier den Healthbar
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
Movement();
|
||||
}
|
||||
|
||||
private void Movement()
|
||||
{
|
||||
transform.Translate(Vector3.up * Time.deltaTime * verticalSpeed); // bullet geschwindigkeit
|
||||
counter += Time.deltaTime;
|
||||
|
||||
if (counter >= remainInAir)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (other.CompareTag("Starship"))
|
||||
{
|
||||
Destroy(gameObject); // berechnet den dmg
|
||||
slider.value -= dmg;
|
||||
}
|
||||
|
||||
if (other.CompareTag("Starship") && slider.value <= 0f) // zerst<73>rt das Starship bei 0hp oder weniger
|
||||
{
|
||||
other.gameObject.GetComponent<OnPlayerDeath>().onDeathUI();
|
||||
Destroy(other.gameObject);
|
||||
|
||||
if(other.gameObject.CompareTag("Dead"))
|
||||
{
|
||||
uiElement.SetActive(true);
|
||||
}
|
||||
if (other.gameObject.CompareTag("Score"))
|
||||
{
|
||||
uiElement.SetActive(false);
|
||||
}
|
||||
if (other.gameObject.CompareTag("Highscore"))
|
||||
{
|
||||
uiElement.SetActive(false);
|
||||
}
|
||||
if (other.gameObject.CompareTag("RoundCounter"))
|
||||
{
|
||||
uiElement.SetActive(false);
|
||||
}
|
||||
if (other.gameObject.CompareTag("EnemiesLeft"))
|
||||
{
|
||||
uiElement.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Gegner/Bullet Movement CDM.cs.meta
Normal file
11
Assets/Scripts/Gegner/Bullet Movement CDM.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34ed6738e5d4a1f418356839c4de80d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
67
Assets/Scripts/Gegner/Enemie_Movement.cs
Normal file
67
Assets/Scripts/Gegner/Enemie_Movement.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Enemie_Movement : MonoBehaviour
|
||||
{
|
||||
public float speed = 3f; // Bewegungsgeschwindigkeit
|
||||
public float shootingInterval = 2f; // Schuss-Intervall
|
||||
public int life = 5;
|
||||
public GameObject CDM_Enemy_LASER_bullet; // Projektil-Objekt
|
||||
public Transform firePoint; // Punkt, von dem die Kugeln abgefeuert werden
|
||||
Enemie_Spawn_System enemie_Spawn_System;
|
||||
private Transform player; // Referenz auf den Spieler
|
||||
|
||||
void Start()
|
||||
{
|
||||
// Spieler-Objekt finden
|
||||
player = GameObject.FindGameObjectWithTag("Starship").transform;
|
||||
enemie_Spawn_System = GameObject.Find("Enemie_Spawner_System").GetComponent<Enemie_Spawn_System>();
|
||||
|
||||
// Starte das Schie<69>en in Intervallen
|
||||
InvokeRepeating(nameof(Shoot), shootingInterval, shootingInterval);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (player == null) return; // Falls kein Spieler gefunden wurde, nichts tun
|
||||
|
||||
// 1. Richtung zum Spieler berechnen
|
||||
Vector2 direction = (player.position - transform.position).normalized;
|
||||
|
||||
// 2. Gegner drehen (damit er den Spieler anvisiert)
|
||||
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
transform.rotation = Quaternion.Euler(0, 0, angle - 90);
|
||||
|
||||
// 3. Bewegung zum Spieler
|
||||
transform.position = Vector2.MoveTowards(transform.position, player.position, speed * Time.deltaTime);
|
||||
}
|
||||
|
||||
void Shoot()
|
||||
{
|
||||
if (CDM_Enemy_LASER_bullet != null && firePoint != null)
|
||||
{
|
||||
Instantiate(CDM_Enemy_LASER_bullet, firePoint.position, firePoint.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (other.CompareTag("Player Bullet"))
|
||||
{
|
||||
Bullet_movement bulletScript = other.gameObject.GetComponent<Bullet_movement>();
|
||||
|
||||
if (bulletScript != null)
|
||||
{
|
||||
life--;
|
||||
Debug.Log("Gegner Getroffen! -1");
|
||||
|
||||
if (life <= 0)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
enemie_Spawn_System.ChangeEnemyCounter(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Gegner/Enemie_Movement.cs.meta
Normal file
11
Assets/Scripts/Gegner/Enemie_Movement.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50d5009d91c76fd4ea7a6210a0a958ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
76
Assets/Scripts/Gegner/Enemie_Movement_Kamikaze.cs
Normal file
76
Assets/Scripts/Gegner/Enemie_Movement_Kamikaze.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Enemie_Movement_Kamikaze : MonoBehaviour
|
||||
{
|
||||
public float speed = 3f; // Bewegungsgeschwindigkeit
|
||||
private Transform player; // Referenz auf den Spieler
|
||||
public int life = 2;
|
||||
private Slider slider;
|
||||
public GameObject uiElement;
|
||||
Enemie_Spawn_System enemie_Spawn_System;
|
||||
[SerializeField] float dmg = 0.0f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
// Spieler-Objekt finden
|
||||
player = GameObject.FindGameObjectWithTag("Starship").transform;
|
||||
slider = FindObjectOfType<Slider>();
|
||||
enemie_Spawn_System = GameObject.Find("Enemie_Spawner_System").GetComponent<Enemie_Spawn_System>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (player == null) return; // Falls kein Spieler gefunden wurde, nichts tun
|
||||
|
||||
// 1. Richtung zum Spieler berechnen
|
||||
Vector2 direction = (player.position - transform.position).normalized;
|
||||
|
||||
// 2. Gegner drehen (damit er den Spieler anvisiert)
|
||||
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
transform.rotation = Quaternion.Euler(0, 0, angle - 90);
|
||||
|
||||
// 3. Bewegung zum Spieler
|
||||
transform.position = Vector2.MoveTowards(transform.position, player.position, speed * Time.deltaTime);
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (other.CompareTag("Player Bullet"))
|
||||
{
|
||||
Bullet_movement bulletScript = other.gameObject.GetComponent<Bullet_movement>();
|
||||
|
||||
if (bulletScript != null)
|
||||
{
|
||||
life--;
|
||||
Debug.Log("Gegner Getroffen! -2");
|
||||
|
||||
if (life <= 0)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
enemie_Spawn_System.ChangeEnemyCounter(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (other.CompareTag("Starship"))
|
||||
{
|
||||
Destroy(gameObject);
|
||||
enemie_Spawn_System.ChangeEnemyCounter(-1);
|
||||
slider.value -= dmg;
|
||||
}
|
||||
|
||||
if (other.CompareTag("Starship") && slider.value <= 0f) // zerst<73>rt das Starship bei 0hp oder weniger
|
||||
{
|
||||
Destroy(other.gameObject);
|
||||
//ChangeEnemyCounter(-1);
|
||||
|
||||
if (other.CompareTag("Dead"))
|
||||
{
|
||||
uiElement.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Gegner/Enemie_Movement_Kamikaze.cs.meta
Normal file
11
Assets/Scripts/Gegner/Enemie_Movement_Kamikaze.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c57218c54d536546a8fb5f4f36bd912
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
75
Assets/Scripts/Gegner/Enemie_Movement_Panzer.cs
Normal file
75
Assets/Scripts/Gegner/Enemie_Movement_Panzer.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class Enemie_Movement_Panzer : MonoBehaviour
|
||||
{
|
||||
public float speed = 3f; // Bewegungsgeschwindigkeit
|
||||
public float shootingInterval = 2f; // Schuss-Intervall
|
||||
public GameObject bulletPrefab; // Projektil-Objekt
|
||||
public Transform firePointA; // Punkt, von dem die Kugeln abgefeuert werden
|
||||
public Transform firePointB;
|
||||
public Transform firePointC;
|
||||
public int life = 20;
|
||||
Enemie_Spawn_System enemie_Spawn_System;
|
||||
|
||||
private Transform player; // Referenz auf den Spieler
|
||||
|
||||
void Start()
|
||||
{
|
||||
// Spieler-Objekt finden
|
||||
player = GameObject.FindGameObjectWithTag("Starship").transform;
|
||||
|
||||
// Starte das Schie<69>en in Intervallen
|
||||
InvokeRepeating(nameof(Shoot), shootingInterval, shootingInterval);
|
||||
enemie_Spawn_System = GameObject.Find("Enemie_Spawner_System").GetComponent<Enemie_Spawn_System>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (player == null) return; // Falls kein Spieler gefunden wurde, nichts tun
|
||||
|
||||
// 1. Richtung zum Spieler berechnen
|
||||
Vector2 direction = (player.position - transform.position).normalized;
|
||||
|
||||
// 2. Gegner drehen (damit er den Spieler anvisiert)
|
||||
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
transform.rotation = Quaternion.Euler(0, 0, angle - 90);
|
||||
|
||||
// 3. Bewegung zum Spieler
|
||||
transform.position = Vector2.MoveTowards(transform.position, player.position, speed * Time.deltaTime);
|
||||
|
||||
}
|
||||
|
||||
void Shoot()
|
||||
{
|
||||
if (bulletPrefab != null && firePointA != null && firePointB != null && firePointC != null)
|
||||
{
|
||||
Instantiate(bulletPrefab, firePointA.position, firePointA.rotation);
|
||||
Instantiate(bulletPrefab, firePointB.position, firePointB.rotation);
|
||||
Instantiate(bulletPrefab, firePointC.position, firePointC.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (other.CompareTag("Player Bullet"))
|
||||
{
|
||||
Bullet_movement bulletScript = other.gameObject.GetComponent<Bullet_movement>();
|
||||
|
||||
if (bulletScript != null)
|
||||
{
|
||||
life--;
|
||||
Debug.Log("Gegner Getroffen! -2");
|
||||
|
||||
if (life <= 0)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
enemie_Spawn_System.ChangeEnemyCounter(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} //chat gpt modified, nicht komplett generiert
|
||||
11
Assets/Scripts/Gegner/Enemie_Movement_Panzer.cs.meta
Normal file
11
Assets/Scripts/Gegner/Enemie_Movement_Panzer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 586d848e69270f345b886282bdda8735
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/Menüs.meta
Normal file
8
Assets/Scripts/Menüs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a42ac5addf35ab4093b1c4473e932a5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Assets/Scripts/Menüs/Haupt_Menü.cs
Normal file
17
Assets/Scripts/Menüs/Haupt_Menü.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Haupt_Menü : MonoBehaviour
|
||||
{
|
||||
public void StarteSpiel()
|
||||
{
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex +1);
|
||||
}
|
||||
|
||||
public void VerlasseSpiel()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Menüs/Haupt_Menü.cs.meta
Normal file
11
Assets/Scripts/Menüs/Haupt_Menü.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbcbe4ebdc142f641ae18af3bd622ed3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/Scripts/Menüs/Load Open World.cs
Normal file
31
Assets/Scripts/Menüs/Load Open World.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class LoadOpenWorld : MonoBehaviour
|
||||
{
|
||||
private KeyCode loadMeToOpWo = KeyCode.Mouse0;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
ActionToLoadOpWo();
|
||||
}
|
||||
|
||||
private void ActionToLoadOpWo()
|
||||
{
|
||||
if (Input.GetKeyDown(loadMeToOpWo))
|
||||
{
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
//https://www.youtube.com/watch?v=ztJPnBpae_0&t=470s
|
||||
|
||||
11
Assets/Scripts/Menüs/Load Open World.cs.meta
Normal file
11
Assets/Scripts/Menüs/Load Open World.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 666b6272125f93a4699b053b2289b3a1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
48
Assets/Scripts/Menüs/Ui Text Fade.cs
Normal file
48
Assets/Scripts/Menüs/Ui Text Fade.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
|
||||
public class UIFadeText : MonoBehaviour
|
||||
{
|
||||
public Text uiText; // Das UI-Text-Element
|
||||
public float fadeDuration = 1.5f; // Dauer des Fade-Effekts
|
||||
public float waitTime = 1.0f; // Wartezeit zwischen Fade-Out und Fade-In
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (uiText == null)
|
||||
{
|
||||
uiText = GetComponent<Text>(); // Falls kein Text zugewiesen ist, wird dieser gesucht.
|
||||
}
|
||||
StartCoroutine(FadeTextLoop());
|
||||
}
|
||||
|
||||
private IEnumerator FadeTextLoop()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return StartCoroutine(FadeText(1, 0)); // Text ausblenden
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
yield return StartCoroutine(FadeText(0, 1)); // Text einblenden
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator FadeText(float startAlpha, float endAlpha)
|
||||
{
|
||||
float elapsedTime = 0;
|
||||
Color textColor = uiText.color;
|
||||
|
||||
while (elapsedTime < fadeDuration)
|
||||
{
|
||||
elapsedTime += Time.deltaTime;
|
||||
float newAlpha = Mathf.Lerp(startAlpha, endAlpha, elapsedTime / fadeDuration);
|
||||
uiText.color = new Color(textColor.r, textColor.g, textColor.b, newAlpha);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
uiText.color = new Color(textColor.r, textColor.g, textColor.b, endAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
//https://chatgpt.com
|
||||
11
Assets/Scripts/Menüs/Ui Text Fade.cs.meta
Normal file
11
Assets/Scripts/Menüs/Ui Text Fade.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f576dac274966fe488e0e9bfadf2eb36
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/Player.meta
Normal file
8
Assets/Scripts/Player.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80c7e4ea3ad54ce4da63ec04489daebd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/Scripts/Player/Bullet_movement Starship.cs
Normal file
46
Assets/Scripts/Player/Bullet_movement Starship.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class Bullet_movement : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float verticalSpeed = 15.0f;
|
||||
[SerializeField] private float remainInAir = 1.0f;
|
||||
private float counter = 0f;
|
||||
public GameObject player;
|
||||
private PlayerMovement playerMovement;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
player = GameObject.FindWithTag("Starship");
|
||||
playerMovement = player.GetComponent<PlayerMovement>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
Movement();
|
||||
}
|
||||
|
||||
private void Movement()
|
||||
{
|
||||
transform.Translate(Vector3.up * Time.deltaTime * verticalSpeed);
|
||||
counter += Time.deltaTime;
|
||||
|
||||
if (counter >= remainInAir)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (other.CompareTag("Enemy"))
|
||||
{
|
||||
playerMovement.score += 1f;
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Player/Bullet_movement Starship.cs.meta
Normal file
11
Assets/Scripts/Player/Bullet_movement Starship.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46ad55f1ca916ab4181702851302ed61
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/Scripts/Player/Menü_Rotation.cs
Normal file
20
Assets/Scripts/Player/Menü_Rotation.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
public class Menü_Rotation : MonoBehaviour
|
||||
{
|
||||
|
||||
void Update()
|
||||
{
|
||||
Movement();
|
||||
}
|
||||
private void Movement()
|
||||
{
|
||||
Vector3 mousePosition = Input.mousePosition;
|
||||
mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
|
||||
Vector2 direction = new Vector2(mousePosition.x - transform.position.x, mousePosition.y - transform.position.y);
|
||||
transform.up = direction;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Player/Menü_Rotation.cs.meta
Normal file
11
Assets/Scripts/Player/Menü_Rotation.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27b46396c158a514596bd2267b42702b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
24
Assets/Scripts/Player/OnPlayerDeath.cs
Normal file
24
Assets/Scripts/Player/OnPlayerDeath.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class OnPlayerDeath : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private UnityEngine.UI.Image DeathScreen;
|
||||
[SerializeField] private TMP_Text Score;
|
||||
[SerializeField] private TMP_Text Highscore;
|
||||
[SerializeField] private TMP_Text RoundCounter;
|
||||
[SerializeField] private TMP_Text Verbleibend;
|
||||
// Start is called before the first frame update
|
||||
|
||||
public void onDeathUI()
|
||||
{
|
||||
DeathScreen.gameObject.SetActive(true);
|
||||
Score.gameObject.SetActive(false);
|
||||
Highscore.gameObject.SetActive(false);
|
||||
RoundCounter.gameObject.SetActive(false);
|
||||
Verbleibend.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Player/OnPlayerDeath.cs.meta
Normal file
11
Assets/Scripts/Player/OnPlayerDeath.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0968f69075fa284c84b3e1486927770
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/Scripts/Player/Player Rotation.cs
Normal file
20
Assets/Scripts/Player/Player Rotation.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerRotation : MonoBehaviour
|
||||
{
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
Vector3 mousePosition = Input.mousePosition;
|
||||
mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
|
||||
|
||||
Vector2 direction = new Vector2(mousePosition.x - transform.position.x, mousePosition.y - transform.position.y);
|
||||
|
||||
transform.up = direction;
|
||||
|
||||
//https://www.youtube.com/watch?v=9_i6S_rDZuA script von hier
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Player/Player Rotation.cs.meta
Normal file
11
Assets/Scripts/Player/Player Rotation.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1003146b57994ee4a8c8daa2f402e5b2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
Assets/Scripts/Player/Player Shooting_Laser.cs
Normal file
40
Assets/Scripts/Player/Player Shooting_Laser.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerShooting_Laser : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private KeyCode shootingKeyCode = KeyCode.Mouse0;
|
||||
[SerializeField] private float shootDelay = 1;
|
||||
private float timer = 0;
|
||||
public GameObject Starship_LASER_bullet;
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
HandleShooting();
|
||||
}
|
||||
|
||||
private void HandleShooting()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
if (Input.GetKey(shootingKeyCode) && timer >= shootDelay)
|
||||
{
|
||||
timer = 0;
|
||||
|
||||
if (Starship_LASER_bullet != null)
|
||||
{
|
||||
GameObject newBullet = Instantiate(Starship_LASER_bullet, transform.position, Quaternion.identity);
|
||||
newBullet.transform.up = transform.up;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Player/Player Shooting_Laser.cs.meta
Normal file
11
Assets/Scripts/Player/Player Shooting_Laser.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e5c8d566bc786b449eed3963ad241d8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
41
Assets/Scripts/Player/Player Shooting_Plasma.cs
Normal file
41
Assets/Scripts/Player/Player Shooting_Plasma.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Shooting_Plasma : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private KeyCode shootingKeyCode = KeyCode.Mouse1;
|
||||
public GameObject Plasma_Prefab;
|
||||
public bool isUnlocked = false; // Bool wird durch den Shop ge<67>ndert
|
||||
[SerializeField] private float shootDelay = 1;
|
||||
private float timer = 0;
|
||||
|
||||
void Update()
|
||||
{
|
||||
HandleShootingPlasma();
|
||||
}
|
||||
|
||||
private void HandleShootingPlasma()
|
||||
{
|
||||
if (!isUnlocked) return;
|
||||
|
||||
timer += Time.deltaTime;
|
||||
if (Input.GetKey(shootingKeyCode) && timer >= shootDelay)
|
||||
{
|
||||
|
||||
timer = 0;
|
||||
|
||||
if (Plasma_Prefab != null)
|
||||
{
|
||||
GameObject newBullet = Instantiate(Plasma_Prefab, transform.position, Quaternion.identity);
|
||||
newBullet.transform.up = transform.up;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UnlockPlasma()
|
||||
{
|
||||
isUnlocked = true;
|
||||
Debug.Log("Plasma wurde freigeschaltet!");
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Player/Player Shooting_Plasma.cs.meta
Normal file
11
Assets/Scripts/Player/Player Shooting_Plasma.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d33c17e45801d64ea35302100d3722b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
42
Assets/Scripts/Player/Player Shooting_Rockets.cs
Normal file
42
Assets/Scripts/Player/Player Shooting_Rockets.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Shooting_Rockets : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private KeyCode shootingKeyCode = KeyCode.Mouse1;
|
||||
public GameObject Rockets_Prefab;
|
||||
public bool isUnlocked = false; // Bool wird durch den Shop ge<67>ndert
|
||||
[SerializeField] private float shootDelay = 1;
|
||||
private float timer = 0;
|
||||
|
||||
void Update()
|
||||
{
|
||||
HandleShootingRockets();
|
||||
}
|
||||
|
||||
private void HandleShootingRockets()
|
||||
{
|
||||
if (!isUnlocked) return;
|
||||
|
||||
timer += Time.deltaTime;
|
||||
|
||||
if (Input.GetKeyDown(shootingKeyCode) && timer >= shootDelay)
|
||||
{
|
||||
|
||||
timer = 0;
|
||||
|
||||
if (Rockets_Prefab != null)
|
||||
{
|
||||
GameObject newBullet = Instantiate(Rockets_Prefab, transform.position, Quaternion.identity);
|
||||
newBullet.transform.up = transform.up;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UnlockWeapon()
|
||||
{
|
||||
isUnlocked = true;
|
||||
Debug.Log("Raketenwerfer wurde freigeschaltet!");
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Player/Player Shooting_Rockets.cs.meta
Normal file
11
Assets/Scripts/Player/Player Shooting_Rockets.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b697fc4a72c5844191456f4c72be874
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
111
Assets/Scripts/Player/PlayerMovement.cs
Normal file
111
Assets/Scripts/Player/PlayerMovement.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
public float score = 0f;
|
||||
public Vector3 moveVector;
|
||||
public GameObject character;
|
||||
private Rigidbody2D rb;
|
||||
public GameObject uiElement;
|
||||
public TextMeshProUGUI scoreText;
|
||||
public TextMeshProUGUI highscoreText;
|
||||
[SerializeField] private float minXCoordinate = -8.0f;
|
||||
[SerializeField] private float maxXCoordinate = 8.0f;
|
||||
[SerializeField] private float minYCoordinate = -5.0f;
|
||||
[SerializeField] private float maxYCoordinate = 5.0f;
|
||||
[SerializeField] private float horizontalSpeed = 5;
|
||||
[SerializeField] private float verticalSpeed = 5;
|
||||
|
||||
void Start()
|
||||
{
|
||||
rb = GetComponent<Rigidbody2D>();
|
||||
moveVector = Vector3.zero;
|
||||
highscoreText.text = PlayerPrefs.GetFloat("HighScore").ToString();
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
handleMovement();
|
||||
ScorePanel();
|
||||
}
|
||||
|
||||
private void handleMovement()
|
||||
{
|
||||
// Aufgabe:
|
||||
// 1. Abfragen der Vertical Axis
|
||||
// 2. Wert in movementDirection setzen
|
||||
// 3. Neue Grenzen f<>r oben und unten anlegen
|
||||
// 4. Position des Spieler auf neue Grenzen testen
|
||||
// und ggf. zur<75>cksetzen
|
||||
|
||||
Vector3 movementDirection;
|
||||
|
||||
|
||||
float deltaX = Input.GetAxis("Horizontal"); // Vertical
|
||||
float deltaY = Input.GetAxis("Vertical"); // Vertical
|
||||
|
||||
movementDirection = new Vector3(deltaX, 0, 0);
|
||||
// x-movement
|
||||
transform.position += movementDirection * horizontalSpeed * Time.deltaTime;
|
||||
// Alternativ: transform.Translate(movementDirection * horizontalSpeed * Time.deltaTime);
|
||||
|
||||
if (transform.position.x < minXCoordinate)
|
||||
{
|
||||
transform.position = new Vector3(minXCoordinate, transform.position.y, transform.position.z);
|
||||
}
|
||||
else if (transform.position.x > maxXCoordinate)
|
||||
{
|
||||
transform.position = new Vector3(maxXCoordinate, transform.position.y, transform.position.z);
|
||||
}
|
||||
// y-movement
|
||||
|
||||
movementDirection = new Vector3(0, deltaY, 0);
|
||||
transform.position += movementDirection * verticalSpeed * Time.deltaTime;
|
||||
|
||||
if (transform.position.y < minYCoordinate)
|
||||
{
|
||||
transform.position = new Vector3(transform.position.x, minYCoordinate, transform.position.z);
|
||||
}
|
||||
else if (transform.position.y > maxYCoordinate)
|
||||
{
|
||||
transform.position = new Vector3(transform.position.x, maxYCoordinate, transform.position.z);
|
||||
}
|
||||
}
|
||||
public void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
if (other.gameObject.CompareTag("Shop Prefab") && uiElement != null)
|
||||
{
|
||||
uiElement.SetActive(true);
|
||||
}
|
||||
|
||||
Debug.Log("Aktiviert");
|
||||
}
|
||||
|
||||
public void OnTriggerExit2D(Collider2D other)
|
||||
{
|
||||
if (other.gameObject.CompareTag("Shop Prefab") && uiElement != null)
|
||||
{
|
||||
uiElement.SetActive(false);
|
||||
}
|
||||
|
||||
Debug.Log("Deaktiviert");
|
||||
}
|
||||
|
||||
private void ScorePanel()
|
||||
{
|
||||
scoreText.text = score.ToString();
|
||||
|
||||
if (score > PlayerPrefs.GetFloat("HighScore", 0f))
|
||||
{
|
||||
PlayerPrefs.SetFloat("HighScore", score);
|
||||
highscoreText.text = score.ToString($"{score}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
Assets/Scripts/Player/PlayerMovement.cs.meta
Normal file
11
Assets/Scripts/Player/PlayerMovement.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40f278e9caddc5e489f978ff087d735e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/Spielwelt.meta
Normal file
8
Assets/Scripts/Spielwelt.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 659e7a793f36dec4d8215e5307b44201
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
129
Assets/Scripts/Spielwelt/Enemie_Spawn_System.cs
Normal file
129
Assets/Scripts/Spielwelt/Enemie_Spawn_System.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class Enemie_Spawn_System : MonoBehaviour
|
||||
{
|
||||
[SerializeField] public int roundCounter = 0; //Kann die Runden im Inspector manuell erh<72>hen
|
||||
[SerializeField] public int roundModifierMax3 = 0; // regelt die schwierigkeit der Anfangsrunden
|
||||
|
||||
public int spawnCounter = 0; // z<>hlt wie viele Enemies gespawnt wurden & sorgt daf<61>r, dass der Shop wieder gespawnt wird
|
||||
|
||||
public GameObject Tank; // <---- Zu spawnende Prefab Einf<6E>gen
|
||||
public GameObject Standart; // <---- Zu spawnende Prefab Einf<6E>gen
|
||||
public GameObject Kamikaze; // <---- Zu spawnende Prefab Einf<6E>gen
|
||||
|
||||
public GameObject ShopPrefab;
|
||||
public Transform SpawnShop; // Punkt, an welchem der Shop respawnt wird
|
||||
|
||||
public Transform SpawnMitteOben; // Punkt, von dem die Enemies gespawnt werden
|
||||
public Transform SpawnMitteUnten; // Punkt, von dem die Enemies gespawnt werden
|
||||
public Transform SpawnMitteLinks; // Punkt, von dem die Enemies gespawnt werden
|
||||
public Transform SpawnMitteRechts; // Punkt, von dem die Enemies gespawnt werden
|
||||
public Transform SpawnLinksUnten; // Punkt, von dem die Enemies gespawnt werden
|
||||
public Transform SpawnRechtsUnten; // Punkt, von dem die Enemies gespawnt werden
|
||||
public Transform SpawnLinksOben; // Punkt, von dem die Enemies gespawnt werden
|
||||
public Transform SpawnRechtsOben; // Punkt, von dem die Enemies gespawnt werden
|
||||
|
||||
public TextMeshProUGUI Round_Counter; // <---- Kontrolliert die Rundenanzeige
|
||||
public TextMeshProUGUI Enemie_Counter; // <---- Kontrolliert die Anzahlanzeige der Gegner
|
||||
|
||||
private bool canSpawnShop = false;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
//ShopPrefab = Resources.Load<GameObject>("Shop Prefab");
|
||||
canSpawnShop = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
ShopRespawner();
|
||||
}
|
||||
|
||||
public void SpawnEnemies()
|
||||
{
|
||||
if (Tank != null && Standart != null && Kamikaze != null && SpawnMitteOben != null && SpawnMitteUnten != null && SpawnMitteLinks != null && SpawnMitteRechts != null && SpawnLinksUnten != null && SpawnRechtsUnten != null && SpawnLinksOben != null && SpawnRechtsOben != null)
|
||||
{
|
||||
Destroy(GameObject.FindGameObjectWithTag("Shop Prefab"));
|
||||
roundCounter++;
|
||||
Round_Counter.text = roundCounter.ToString();
|
||||
|
||||
Instantiate(Standart, SpawnMitteOben.position, SpawnMitteOben.rotation);
|
||||
Instantiate(Standart, SpawnMitteUnten.position, SpawnMitteUnten.rotation);
|
||||
Instantiate(Kamikaze, SpawnMitteLinks.position, SpawnMitteLinks.rotation);
|
||||
Instantiate(Kamikaze, SpawnMitteRechts.position, SpawnMitteRechts.rotation);
|
||||
ChangeEnemyCounter(4);
|
||||
|
||||
|
||||
if (roundCounter == roundModifierMax3) // Special-Runde0
|
||||
{
|
||||
Instantiate(Kamikaze, SpawnLinksUnten.position, SpawnLinksUnten.rotation);
|
||||
Instantiate(Kamikaze, SpawnRechtsUnten.position, SpawnRechtsUnten.rotation);
|
||||
Instantiate(Kamikaze, SpawnLinksOben.position, SpawnLinksOben.rotation);
|
||||
Instantiate(Kamikaze, SpawnRechtsOben.position, SpawnRechtsOben.rotation);
|
||||
ChangeEnemyCounter(4);
|
||||
}
|
||||
|
||||
if (roundCounter == roundModifierMax3 * 2) // Special-Runde1 Kamikaze
|
||||
{
|
||||
Instantiate(Standart, SpawnLinksUnten.position, SpawnLinksUnten.rotation);
|
||||
Instantiate(Standart, SpawnRechtsUnten.position, SpawnRechtsUnten.rotation);
|
||||
Instantiate(Standart, SpawnLinksOben.position, SpawnLinksOben.rotation);
|
||||
Instantiate(Standart, SpawnRechtsOben.position, SpawnRechtsOben.rotation);
|
||||
ChangeEnemyCounter(4);
|
||||
}
|
||||
|
||||
if (roundCounter == roundModifierMax3 * 3) // Special-Runde2 Standart Enemies & Tanks
|
||||
{
|
||||
Instantiate(Tank, SpawnLinksUnten.position, SpawnLinksUnten.rotation);
|
||||
Instantiate(Tank, SpawnRechtsUnten.position, SpawnRechtsUnten.rotation);
|
||||
Instantiate(Tank, SpawnLinksOben.position, SpawnLinksOben.rotation);
|
||||
Instantiate(Tank, SpawnRechtsOben.position, SpawnRechtsOben.rotation);
|
||||
Instantiate(Standart, SpawnMitteOben.position, SpawnMitteOben.rotation);
|
||||
Instantiate(Standart, SpawnMitteUnten.position, SpawnMitteUnten.rotation);
|
||||
Instantiate(Standart, SpawnMitteLinks.position, SpawnMitteLinks.rotation);
|
||||
Instantiate(Standart, SpawnMitteRechts.position, SpawnMitteRechts.rotation);
|
||||
ChangeEnemyCounter(8);
|
||||
}
|
||||
|
||||
if (roundCounter >= 20)
|
||||
{
|
||||
for (int i = 0 + roundCounter - 15; i > 0; i--)
|
||||
{
|
||||
Instantiate(Tank, SpawnLinksUnten.position, SpawnLinksUnten.rotation);
|
||||
Instantiate(Tank, SpawnRechtsUnten.position, SpawnRechtsUnten.rotation);
|
||||
Instantiate(Tank, SpawnLinksOben.position, SpawnLinksOben.rotation);
|
||||
Instantiate(Tank, SpawnRechtsOben.position, SpawnRechtsOben.rotation);
|
||||
Instantiate(Standart, SpawnMitteOben.position, SpawnMitteOben.rotation);
|
||||
Instantiate(Standart, SpawnMitteUnten.position, SpawnMitteUnten.rotation);
|
||||
Instantiate(Standart, SpawnMitteLinks.position, SpawnMitteLinks.rotation);
|
||||
Instantiate(Standart, SpawnMitteRechts.position, SpawnMitteRechts.rotation);
|
||||
Instantiate(Kamikaze, SpawnLinksOben.position, SpawnLinksOben.rotation);
|
||||
Instantiate(Kamikaze, SpawnRechtsOben.position, SpawnRechtsOben.rotation);
|
||||
Instantiate(Kamikaze, SpawnMitteOben.position, SpawnMitteOben.rotation);
|
||||
Instantiate(Kamikaze, SpawnMitteUnten.position, SpawnMitteUnten.rotation);
|
||||
ChangeEnemyCounter(12);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ShopRespawner()
|
||||
{
|
||||
if (spawnCounter <= 0 && ShopPrefab != null && canSpawnShop)
|
||||
{
|
||||
Instantiate(ShopPrefab, SpawnShop.position, SpawnShop.rotation);
|
||||
Debug.Log("Spawned Shop" + roundCounter);
|
||||
canSpawnShop = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeEnemyCounter(int count)
|
||||
{
|
||||
spawnCounter += count;
|
||||
Enemie_Counter.text = spawnCounter.ToString();
|
||||
canSpawnShop = true;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Spielwelt/Enemie_Spawn_System.cs.meta
Normal file
11
Assets/Scripts/Spielwelt/Enemie_Spawn_System.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea056f8883035a844856aa6ee265b621
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
Assets/Scripts/Spielwelt/GameOverScreen.cs
Normal file
17
Assets/Scripts/Spielwelt/GameOverScreen.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class GameOverScreen : MonoBehaviour
|
||||
{
|
||||
public void RestartGame()
|
||||
{
|
||||
SceneManager.LoadScene(2);
|
||||
}
|
||||
|
||||
public void Back2MainMenue()
|
||||
{
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Spielwelt/GameOverScreen.cs.meta
Normal file
11
Assets/Scripts/Spielwelt/GameOverScreen.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc6282b8ad9fc524293130bb565357e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
30
Assets/Scripts/Spielwelt/ItemShopButtons.cs
Normal file
30
Assets/Scripts/Spielwelt/ItemShopButtons.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ItemShopButtons : MonoBehaviour
|
||||
{
|
||||
public Button buyButton; // Der Button im Shop
|
||||
public GameObject player; // Dein Spieler-Objekt
|
||||
public MonoBehaviour weaponScript; // Das Skript f<>r die Waffe
|
||||
|
||||
private bool isUnlocked = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
buyButton.onClick.AddListener(UnlockWeapon);
|
||||
weaponScript.enabled = false; // Waffe ist am Anfang deaktiviert
|
||||
}
|
||||
|
||||
void UnlockWeapon()
|
||||
{
|
||||
if (!isUnlocked)
|
||||
{
|
||||
isUnlocked = true;
|
||||
weaponScript.enabled = true; // Aktiviere das Waffenskript
|
||||
buyButton.interactable = false; // Deaktiviere den Button nach dem Kauf
|
||||
Debug.Log("Waffe wurde freigeschaltet!");
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Spielwelt/ItemShopButtons.cs.meta
Normal file
11
Assets/Scripts/Spielwelt/ItemShopButtons.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d14de6a589d29848958c530af44e3f6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
45
Assets/Scripts/Spielwelt/ParallaxBackground.cs
Normal file
45
Assets/Scripts/Spielwelt/ParallaxBackground.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class ParallaxBackground : MonoBehaviour
|
||||
{
|
||||
public ParallaxCamera parallaxCamera;
|
||||
List<ParallaxLayer> parallaxLayers = new List<ParallaxLayer>();
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (parallaxCamera == null)
|
||||
parallaxCamera = Camera.main.GetComponent<ParallaxCamera>();
|
||||
|
||||
if (parallaxCamera != null)
|
||||
parallaxCamera.onCameraTranslate += Move;
|
||||
|
||||
SetLayers();
|
||||
}
|
||||
|
||||
void SetLayers()
|
||||
{
|
||||
parallaxLayers.Clear();
|
||||
|
||||
for (int i = 0; i < transform.childCount; i++)
|
||||
{
|
||||
ParallaxLayer layer = transform.GetChild(i).GetComponent<ParallaxLayer>();
|
||||
|
||||
if (layer != null)
|
||||
{
|
||||
layer.name = "Layer-" + i;
|
||||
parallaxLayers.Add(layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Move(float delta)
|
||||
{
|
||||
foreach (ParallaxLayer layer in parallaxLayers)
|
||||
{
|
||||
layer.Move(delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
//https://www.youtube.com/watch?v=MEy-kIGE-lI
|
||||
11
Assets/Scripts/Spielwelt/ParallaxBackground.cs.meta
Normal file
11
Assets/Scripts/Spielwelt/ParallaxBackground.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96957a179dc92144fa00120f927aafd5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
Assets/Scripts/Spielwelt/ParallaxCamera.cs
Normal file
31
Assets/Scripts/Spielwelt/ParallaxCamera.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class ParallaxCamera : MonoBehaviour
|
||||
{
|
||||
public delegate void ParallaxCameraDelegate(float deltaMovement);
|
||||
public ParallaxCameraDelegate onCameraTranslate;
|
||||
|
||||
private float oldPosition;
|
||||
|
||||
void Start()
|
||||
{
|
||||
oldPosition = transform.position.x;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (transform.position.x != oldPosition)
|
||||
{
|
||||
if (onCameraTranslate != null)
|
||||
{
|
||||
float delta = oldPosition - transform.position.x;
|
||||
onCameraTranslate(delta);
|
||||
}
|
||||
|
||||
oldPosition = transform.position.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//https://www.youtube.com/watch?v=MEy-kIGE-lI
|
||||
11
Assets/Scripts/Spielwelt/ParallaxCamera.cs.meta
Normal file
11
Assets/Scripts/Spielwelt/ParallaxCamera.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46fad2045c7b5a0479a7682ddba2f2bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/Scripts/Spielwelt/ParallaxLayer.cs
Normal file
16
Assets/Scripts/Spielwelt/ParallaxLayer.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class ParallaxLayer : MonoBehaviour
|
||||
{
|
||||
public float parallaxFactor;
|
||||
|
||||
public void Move(float delta)
|
||||
{
|
||||
Vector3 newPos = transform.localPosition;
|
||||
newPos.x -= delta * parallaxFactor;
|
||||
|
||||
transform.localPosition = newPos;
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/Scripts/Spielwelt/ParallaxLayer.cs.meta
Normal file
11
Assets/Scripts/Spielwelt/ParallaxLayer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00e70683d35fa6e4abd43e85299f0a21
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
14
Assets/Scripts/Spielwelt/Reset_Highscore.cs
Normal file
14
Assets/Scripts/Spielwelt/Reset_Highscore.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SocialPlatforms.Impl;
|
||||
|
||||
public class Reset_Highscore : MonoBehaviour
|
||||
{
|
||||
public void ResetHighscore()
|
||||
{
|
||||
PlayerPrefs.DeleteKey("HighScore");
|
||||
PlayerPrefs.SetFloat("HighScore", 0f);
|
||||
Debug.Log("HighScore wurde Gel<65>scht");
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Spielwelt/Reset_Highscore.cs.meta
Normal file
11
Assets/Scripts/Spielwelt/Reset_Highscore.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96876b6494284c1498943a8af18d279e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
Assets/Scripts/Spielwelt/Start_Next_Round.cs
Normal file
22
Assets/Scripts/Spielwelt/Start_Next_Round.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Start_Next_Round : MonoBehaviour
|
||||
{
|
||||
public GameObject shopPrefab;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
public void DeaktiviereShop()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Spielwelt/Start_Next_Round.cs.meta
Normal file
11
Assets/Scripts/Spielwelt/Start_Next_Round.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4cb09af40c6c3b46b8920eeb732730d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user