erster commit

This commit is contained in:
2025-03-19 10:28:26 +01:00
parent 3615fd566e
commit 91571b4f3f
747 changed files with 89182 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class AboutScript : MonoBehaviour
{
public void ExitAbout()
{
SceneManager.UnloadSceneAsync(4);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ecc4005bb02b5e94baa80d313dda8bee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using UnityEngine;
public class ScrollableBackground : MonoBehaviour
{
//[SerializeField] private GameObject background;
[SerializeField] public float speed = 2;
[SerializeField] private double minYPosition = -14.78;
[SerializeField] private float maxYPosition = 10;
// Update is called once per frame
void Update()
{
float deltaX = Input.GetAxis("Horizontal"); // Vertical
float deltaY = Input.GetAxis("Vertical"); // Vertical
Vector3 movementDirection;
movementDirection = new Vector3(0, -1, 0);
transform.Translate(movementDirection * speed * Time.deltaTime);
//background.transform.position += Vector3.down * speed * Time.deltaTime;
//if (background.transform.position.y <= minYPosition)
//{
// background.transform.position += Vector3.up * maxYPosition;
//}
transform.position += Vector3.down * speed * Time.deltaTime;
if (transform.position.y <= minYPosition)
{
transform.position += Vector3.up * maxYPosition;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1b0e30208474d4c4d8c0ac4f29245713
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,49 @@
using System.Collections;
using System.Collections.Generic;
using JetBrains.Annotations;
using Unity.VisualScripting;
using UnityEngine;
public class BulletScript : MonoBehaviour
{
public PlayerScript PlayerScript;
[SerializeField] public int speed = 3;
[SerializeField] public float maxY = 12f;
[SerializeField] public float BulletLiveTime;
[SerializeField] public float BulletLive;
[SerializeField] private int maxSpawns = 4;
[SerializeField] private float spawnTimer = 5;
[SerializeField] private float counter = 0;
[SerializeField] private int spawnCounter = 0;
public Vector3 direction = Vector3.up;
public GameObject WaveBullet;
public Transform firePoint;
public Rigidbody rb;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
if (spawnCounter < maxSpawns)
{
counter += Time.deltaTime;
if (counter >= spawnTimer)
{
Shoot();
counter = 0;
}
}
}
void Shoot()
{
Instantiate(WaveBullet, firePoint.position, firePoint.rotation);
rb.velocity = transform.up * speed * Time.deltaTime;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3fdd216f7d9265042ac2f0ed8fb1a32b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FishPoints : MonoBehaviour
{
public GameObject Fisch1;
public PlayerScript playerScript;
AudioManager audioManager;
private void Awake()
{
audioManager = GameObject.FindGameObjectWithTag("Audio").GetComponent<AudioManager>();
}
private void OnTriggerEnter2D(Collider2D kaputt)
{
//FishPoints Fish = kaputt.GetComponent<FishPoints>();
//if (Fish != null)
//{
// Debug.Log("AAAAAAAAAAAAAAAAA");
// GetCollected();
//}
//else
//{
// Debug.Log("Was f<>r ein Shit");
//}
}
public void GetCollected()
{
Destroy(Fisch1);
audioManager.PlaySFX(audioManager.Fisch);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 757fdabe6e42aeb418f6d8f16c8bebe4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FishPoints2 : MonoBehaviour
{
GameObject Fisch2;
public PlayerScript playerScript;
AudioManager audioManager;
private void Awake()
{
audioManager = GameObject.FindGameObjectWithTag("Audio").GetComponent<AudioManager>();
}
private void OnTriggerEnter2D(Collider2D kaputt)
{
FishPoints2 Fish = kaputt.GetComponent<FishPoints2>();
if (Fish != null)
{
GetCollected();
}
}
public void GetCollected()
{
if (Fisch2 != null)
{
Destroy(Fisch2);
audioManager.PlaySFX(audioManager.Fisch);
playerScript.Fisch2Collected = true;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 32607f3eb46158f43b70b3eceeb4bb41
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FishPoints3 : MonoBehaviour
{
GameObject Fisch3;
PlayerScript playerScript;
AudioManager audioManager;
private void Awake()
{
audioManager = GameObject.FindGameObjectWithTag("Audio").GetComponent<AudioManager>();
}
private void OnTriggerEnter2D(Collider2D kaputt)
{
FishPoints3 Fish = kaputt.GetComponent<FishPoints3>();
if (Fish != null)
{
GetCollected();
}
}
public void GetCollected()
{
if (Fisch3 != null)
{
Destroy(Fisch3);
audioManager.PlaySFX(audioManager.Fisch);
playerScript.Fisch3Collected = true;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ca83ff5b9bda9e2408d93cfb3e14314d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MenueScript : MonoBehaviour
{
public void About()
{
SceneManager.LoadSceneAsync(4);
}
public void StartGame()
{
SceneManager.LoadSceneAsync(1);
}
bool isPaused = false;
public void pauseGame()
{
Time.timeScale = 0;
isPaused = true;
SceneManager.LoadSceneAsync(2);
}
public void Unpause()
{
SceneManager.UnloadSceneAsync(2);
SceneManager.LoadScene(1);
if (isPaused == true)
{
Time.timeScale = 1;
isPaused = false;
}
}
public void Quit()
{
Application.Quit();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d15d5dda6017e4b408372b245b58ef76
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4fffc1f92f118104898b3512c1b87c6c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,154 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.SocialPlatforms.Impl;
using UnityEngine.UI;
public class PlayerScript : MonoBehaviour
{
[SerializeField] private float horizontalSpeed = 2;
[SerializeField] private float verticalSpeed = 4;
[SerializeField] private int MaxYCoordinate = 0;
[SerializeField] private int MinYCoordinate = -10;
[SerializeField] private int MaxXCoordinate = 10;
[SerializeField] private int MinXCoordinate = -10;
[SerializeField] private Text FischLabel;
public bool Fisch1Collected = false;
public bool Fisch2Collected = false;
public bool Fisch3Collected = false;
[SerializeField] private int sharkPoints = 2;
private int score1 = 2;
private int score2 = 5;
private int score3 = 10;
public GameObject WaveBullet;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
handleMovement();
MovementControlls();
}
private void MovementControlls()
{
Vector3 pos = transform.position;
if (Input.GetKey("w"))
{
pos.y += verticalSpeed * Time.deltaTime;
}
if (Input.GetKey("s"))
{
pos.y -= verticalSpeed * Time.deltaTime;
}
if (Input.GetKey("d"))
{
pos.x += horizontalSpeed * Time.deltaTime;
}
if (Input.GetKey("a"))
{
pos.x -= horizontalSpeed * Time.deltaTime;
}
if (Input.GetButtonDown("Cancel"))
{
SceneManager.LoadSceneAsync(2);
//if ()
//{
// if (Input.GetButtonDown("Cancel"))
// {
// SceneMan
// }
//}
}
transform.position = pos;
}
private void handleMovement()
{
float deltaX = Input.GetAxis("Horizontal") * horizontalSpeed; // Horizontal
float deltaY = Input.GetAxis("Vertical") * verticalSpeed; // Vertical
Vector3 movementDirection = new Vector3(deltaX, deltaY, 0);
// x-movement
transform.position += movementDirection * 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
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);
}
}
private void HaiScore()
{
if (Fisch1Collected == true)
{
sharkPoints += score1;
Fisch1Collected = false;
}
if (Fisch2Collected == true)
{
sharkPoints += score2;
Fisch2Collected = false;
}
if (Fisch3Collected == true)
{
sharkPoints += score3;
Fisch3Collected = false;
}
if (sharkPoints <= 0)
{
SceneManager.LoadSceneAsync(3);
}
}
private void OnTriggerEnter2D(Collider2D kaputt)
{
FishPoints Fischi = kaputt.GetComponent<FishPoints>();
if (Fischi != null)
{
Fischi.GetCollected();
Fisch1Collected = true;
HaiScore();
}
}
public int GetSharkPoints()
{
return sharkPoints;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4301c154cbfca8646974962ca0a9e087
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,59 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
public class WaveBulletScript : MonoBehaviour
{
[SerializeField] private float speed = 6f;
[SerializeField] private float BulletLiveTime = 3;
[SerializeField] private float BulletLive = 0;
public Vector3 direction = Vector3.up;
public GameObject WaveBullet;
public Transform firePoint;
public Rigidbody2D rb;
AudioManager audioManager;
// Start is called before the first frame update
void Start()
{
Shoot();
}
private void Update()
{
BulletLive += Time.deltaTime;
if (BulletLive >= BulletLiveTime)
{
Destroy(WaveBullet);
Debug.Log("Unfall");
BulletLive = 0;
}
}
void Shoot()
{
rb.velocity = transform.up * speed;
//* Time.deltaTime;
Debug.Log("Bullet bewegt sich");
}
private void OnTriggerEnter2D(Collider2D kaputt)
{
Debug.Log(kaputt.name);
Netz_1Script Netz = kaputt.GetComponent<Netz_1Script>();
if (Netz != null)
{
Netz.TakeDamage();
}
Destroy(WaveBullet);
audioManager.PlaySFX(audioManager.Wave);
}
private void Awake()
{
audioManager = GameObject.FindGameObjectWithTag("Audio").GetComponent<AudioManager>();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ef2295a5ae0f3144d9daad6d81f5af80
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,55 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WaveSpawn : MonoBehaviour
{
public PlayerScript playerScript;
//private Vector3 direction = Vector3.up;
[SerializeField] private int maxSpawns = 5;
[SerializeField] private int currentSpawns = 0;
[SerializeField] private float spawnCooldown = 1;
[SerializeField] private float spawnCoolCounter = 0;
public GameObject WaveBullet;
public Transform firePoint;
// Update is called once per frame
void Update()
{
spawnCoolCounter += Time.deltaTime;
//Reguliuert den CurrentSpawn Count
if (spawnCoolCounter > spawnCooldown)
{
if (currentSpawns >= 1)
{
currentSpawns--;
}
spawnCoolCounter = 0;
}
if (Input.GetButtonDown("Fire1"))
{
Debug.Log("Ich versuche zu schie<69>en");
//Pr<50>ft, ob das Limit noch nicht <20>berschreitet ist
if (currentSpawns < maxSpawns)
{
//Debug.Log("Darf was spawnen");
Spawn();
}
}
void Spawn()
{
Instantiate(WaveBullet, firePoint.position, firePoint.rotation);
Debug.Log("Bullet spawnt");
currentSpawns++;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c9abcba7fabbeba44be93c46b8a764a7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: