Initial. Added files
This commit is contained in:
57
Assets/Scripts/Managers/GameManager.cs
Executable file
57
Assets/Scripts/Managers/GameManager.cs
Executable file
@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditorInternal;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
|
||||
private static GameManager instance;
|
||||
public static GameManager Instance { get { return instance; } }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
instance = this;
|
||||
else if (Instance == this)
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
GlobalEventManager.onCaptureFlag += flagCaptured;
|
||||
GlobalEventManager.onTimeLeft += timeOut;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void flagCaptured(Team team)
|
||||
{
|
||||
switch(team)
|
||||
{
|
||||
case Team.Attackers:
|
||||
Debug.Log("Attackers Win");
|
||||
break;
|
||||
case Team.Defenders:
|
||||
Debug.Log("Defenders Win");
|
||||
break;
|
||||
default:
|
||||
Debug.LogError("Unexpected Team");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void timeOut()
|
||||
{
|
||||
Debug.Log("Time is out");
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
GlobalEventManager.onCaptureFlag -= flagCaptured;
|
||||
GlobalEventManager.onTimeLeft -= timeOut;
|
||||
}
|
||||
}
|
11
Assets/Scripts/Managers/GameManager.cs.meta
generated
Executable file
11
Assets/Scripts/Managers/GameManager.cs.meta
generated
Executable file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5bc70199fbcaaa44e8683edeec4ab3bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
19
Assets/Scripts/Managers/GlobalEventManager.cs
Executable file
19
Assets/Scripts/Managers/GlobalEventManager.cs
Executable file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
public class GlobalEventManager
|
||||
{
|
||||
public static event Action<Team> onCaptureFlag;
|
||||
|
||||
public static void SendCaptureFlag(Team team)
|
||||
{
|
||||
onCaptureFlag?.Invoke(team);
|
||||
onCaptureFlag = null;
|
||||
}
|
||||
|
||||
public static event Action onTimeLeft;
|
||||
public static void SendTimeout()
|
||||
{
|
||||
onTimeLeft?.Invoke();
|
||||
onTimeLeft = null;
|
||||
}
|
||||
}
|
11
Assets/Scripts/Managers/GlobalEventManager.cs.meta
generated
Executable file
11
Assets/Scripts/Managers/GlobalEventManager.cs.meta
generated
Executable file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ab1008b51a03e3429285a87c6893647
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
13
Assets/Scripts/Managers/MapManager.cs
Executable file
13
Assets/Scripts/Managers/MapManager.cs
Executable file
@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MapManager : MonoBehaviour
|
||||
{
|
||||
public List<NavPoint> navPoints { get; private set; }
|
||||
private void Start()
|
||||
{
|
||||
var navPointsGameObj = GameObject.FindGameObjectsWithTag("Point");
|
||||
foreach (var gameobj in navPointsGameObj)
|
||||
navPoints.Add(gameobj.GetComponent<NavPoint>());
|
||||
}
|
||||
}
|
11
Assets/Scripts/Managers/MapManager.cs.meta
generated
Executable file
11
Assets/Scripts/Managers/MapManager.cs.meta
generated
Executable file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 593162665e908cf4ea4429f8385dc627
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 100
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
26
Assets/Scripts/Managers/TimeManager.cs
Executable file
26
Assets/Scripts/Managers/TimeManager.cs
Executable file
@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class TimeManager : MonoBehaviour
|
||||
{
|
||||
public static TimeManager instance = null;
|
||||
public float CurrentTime;
|
||||
void Start()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = this;
|
||||
instance.CurrentTime = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Only one Instance");
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
CurrentTime += Time.deltaTime;
|
||||
}
|
||||
}
|
11
Assets/Scripts/Managers/TimeManager.cs.meta
generated
Executable file
11
Assets/Scripts/Managers/TimeManager.cs.meta
generated
Executable file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81d1d84442a0ba441976abd6fdd22788
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user