Files
Crash-Course/Assets/Scripts/GameManager.cs

65 lines
1.4 KiB
C#
Raw Normal View History

2025-02-19 20:11:57 -05:00
using System.Collections.Generic;
2025-02-17 18:23:05 -05:00
using UnityEngine;
public class GameManager : MonoBehaviour
{
2025-02-28 13:17:06 -05:00
private void Start()
{
StartGame();
}
2025-02-26 18:16:51 -05:00
public void StartGame()
{
if (gameMode == GameMode.freeForAll)
{
StartFreeForAll();
}
if (gameMode == GameMode.keepAway)
{
StartKeepAway();
}
if (gameMode == GameMode.obstacleCourse)
{
StartObstacleCourse();
}
}
2025-02-17 18:23:05 -05:00
public enum GameMode
{
freeForAll,
2025-02-17 19:02:14 -05:00
keepAway,
obstacleCourse
2025-02-17 18:23:05 -05:00
}
public static GameMode gameMode = GameMode.freeForAll;
2025-02-19 20:11:57 -05:00
2025-02-26 18:16:51 -05:00
public static string map = "Platformer With Headroom"; //is called for in playermanager but should probably be removed.
2025-02-19 20:11:57 -05:00
public static List<GameObject> players = new List<GameObject>();
public Vector2 spawnPosition;
2025-02-26 18:16:51 -05:00
private void StartFreeForAll()
2025-02-19 20:11:57 -05:00
{
foreach (GameObject player in players)
{
player.transform.position = spawnPosition;
}
}
2025-02-21 17:29:28 -05:00
2025-02-26 18:16:51 -05:00
private void StartKeepAway()
{
foreach (GameObject player in players)
{
player.transform.position = spawnPosition;
}
}
private void StartObstacleCourse()
{
foreach (GameObject player in players)
{
player.transform.position = spawnPosition;
}
}
2025-02-17 18:23:05 -05:00
}