Änderungen am 18.03.2025 in der Schule getroffen.
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Platform destroyer
|
||||
/// Original script found in: https://stackoverflow.com/questions/75924903/instantiating-and-destroying-unity-prefabs.
|
||||
/// </summary>
|
||||
|
||||
public class OffScreenDestroyPlatform : MonoBehaviour
|
||||
{
|
||||
public static Vector2? screenBounds;
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (screenBounds == null) screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z));
|
||||
|
||||
if (transform.position.x < screenBounds.Value.x * 5)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e1f87050f92a0048829711096bc7730
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,42 +0,0 @@
|
||||
using UnityEngine;
|
||||
/// <summary>
|
||||
/// Platform generator logic
|
||||
/// Original Guide on YouTube link: https://www.youtube.com/watch?v=NtY_R0g8L8E.
|
||||
/// </summary>
|
||||
|
||||
public class PlatformGenerator : MonoBehaviour
|
||||
{
|
||||
/*
|
||||
[SerializeField] private Transform platformStart;
|
||||
[SerializeField] private System.Collections.Generic.List<Transform> platformList;
|
||||
[SerializeField] Vector2 nextSpawnPos;
|
||||
|
||||
private Vector2 lastEndPosition;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Vector2 positionPlat = platformStart.Find("Endposition").position;
|
||||
lastEndPosition = positionPlat;
|
||||
|
||||
int startingSpawnLevelPlat = 5;
|
||||
for (int i = 0; i < startingSpawnLevelPlat; i++)
|
||||
{
|
||||
SpawnLevelPlat();
|
||||
}
|
||||
}
|
||||
|
||||
private void SpawnLevelPlat()
|
||||
{
|
||||
// Platform is choosed different
|
||||
Transform currentPlat = platformList[Random.Range(0, platformList.Count)];
|
||||
// Platform spawns
|
||||
Transform lastLevelPlatTransform = SpawnLevelPlat(currentPlat, lastEndPosition);
|
||||
lastEndPosition = lastLevelPlatTransform.Find("EndPosition").position;
|
||||
}
|
||||
|
||||
private Transform SpawnLevelPlat(Transform levelPlat, Vector2 spawnPosition)
|
||||
{
|
||||
Transform platformLevelTransform = Instantiate(levelPlat, spawnPosition, Quaternion.identity);
|
||||
return platformLevelTransform;
|
||||
}*/
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a58f8ab6811b9942b34b7598fe7d37f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,23 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Platform spawner
|
||||
/// Original script found in: https://stackoverflow.com/questions/75924903/instantiating-and-destroying-unity-prefabs.
|
||||
/// </summary>
|
||||
|
||||
public class PlatformSpawner : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private int platformCount;
|
||||
[SerializeField] private OffScreenDestroyPlatform platformPrefab;
|
||||
|
||||
void Start()
|
||||
{
|
||||
for (int i = 0; i < platformCount; i++)
|
||||
{
|
||||
var spawnPosition = new Vector2(Random.Range(1f, 10f), Random.Range(-2f, 2f));
|
||||
Instantiate(platformPrefab, spawnPosition, Quaternion.identity);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c31972b8c73d95d4098ee6aca9c698e9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -12,7 +12,8 @@ public class SpawnScanner : MonoBehaviour
|
||||
|
||||
private void Spawn()
|
||||
{
|
||||
Vector3 ggg = new Vector3(1f, 4f, 4f);
|
||||
Instantiate(platform, ggg, Quaternion.identity);
|
||||
float height = Random.Range(-2f, -1f);
|
||||
Vector3 positionPLat = new Vector3(12f, height, 0f);
|
||||
Instantiate(platform, positionPLat, Quaternion.identity);
|
||||
}
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ public class movePlatform : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
speed += acceleration * Time.deltaTime;
|
||||
// speed += acceleration * Time.deltaTime;
|
||||
transform.Translate(new Vector2(-1f, 0f) * speed * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user