add dynamic spawning
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Utils
|
||||
{
|
||||
[Serializable]
|
||||
public class GameObjectEntry
|
||||
{
|
||||
public string key;
|
||||
public GameObject value;
|
||||
}
|
||||
|
||||
public static class GameObjectEntryListExtensions
|
||||
{
|
||||
public static GameObject ByKey(this List<GameObjectEntry> entries, string key)
|
||||
{
|
||||
foreach (var entry in entries)
|
||||
{
|
||||
if (entry.key == key)
|
||||
return entry.value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f5a46f036b44cbd9b4bf5d0694327fc
|
||||
timeCreated: 1787569753
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Utils
|
||||
{
|
||||
[System.Serializable]
|
||||
public class LevelData
|
||||
{
|
||||
public List<DoorData> doors;
|
||||
public List<GuardData> guards;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class DoorData
|
||||
{
|
||||
public string type;
|
||||
public string action;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class GuardData
|
||||
{
|
||||
public string type;
|
||||
public string action;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2350cfda27c14b5fbb0e296982bf46d9
|
||||
timeCreated: 1787569794
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Utils
|
||||
{
|
||||
public static class ListExtensions
|
||||
{
|
||||
public static void Shuffle<T>(this List<T> list)
|
||||
{
|
||||
for (int i = list.Count - 1; i > 0; i--)
|
||||
{
|
||||
int j = Random.Range(0, i + 1);
|
||||
|
||||
(list[i], list[j]) = (list[j], list[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79c87d7a89b04996bc35ac4bdb8a95dd
|
||||
timeCreated: 1787569866
|
||||
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Utils
|
||||
{
|
||||
public abstract class Singleton<T> : MonoBehaviour where T : MonoBehaviour
|
||||
{
|
||||
public static T Instance { get; private set; }
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
if (Instance != null && Instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
Instance = this as T;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c0c51556b4d40b596303c15a761a80e
|
||||
timeCreated: 1787575635
|
||||
Reference in New Issue
Block a user