mirror of
https://github.com/nothke/quality-control.git
synced 2024-11-09 20:43:42 +00:00
Basic staging utility
This commit is contained in:
parent
87a0195f91
commit
8740952493
3
Assets/Scripts/Game Schedule.meta
Normal file
3
Assets/Scripts/Game Schedule.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 71cc283a7f7c45649d6fabee033bce4a
|
||||||
|
timeCreated: 1723894561
|
17
Assets/Scripts/Game Schedule/StageProp.cs
Normal file
17
Assets/Scripts/Game Schedule/StageProp.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class StageProp: MonoBehaviour
|
||||||
|
{
|
||||||
|
public StagingManager.StageEnum ActiveAtStages;
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
StagingManager.RegisterStageProp(this);
|
||||||
|
gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDestroy()
|
||||||
|
{
|
||||||
|
StagingManager.RemoveStageProp(this);
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Scripts/Game Schedule/StageProp.cs.meta
Normal file
3
Assets/Scripts/Game Schedule/StageProp.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 71cd04e41258435d9d03d9b67cb4b7ed
|
||||||
|
timeCreated: 1723894689
|
75
Assets/Scripts/Game Schedule/StagingManager.cs
Normal file
75
Assets/Scripts/Game Schedule/StagingManager.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class StagingManager: MonoBehaviour
|
||||||
|
{
|
||||||
|
public static StagingManager Instance;
|
||||||
|
public static List<StageProp> StageProps;
|
||||||
|
|
||||||
|
public StageEnum CurrentStage;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum StageEnum
|
||||||
|
{
|
||||||
|
Level1 = 1,
|
||||||
|
Level2 = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
if (Instance == null)
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDestroy()
|
||||||
|
{
|
||||||
|
StageProps.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RegisterStageProp(StageProp stageProp)
|
||||||
|
{
|
||||||
|
if (StageProps == null)
|
||||||
|
{
|
||||||
|
StageProps = new List<StageProp>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StageProps.Contains(stageProp))
|
||||||
|
{
|
||||||
|
StageProps.Add(stageProp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveStageProp(StageProp stageProp)
|
||||||
|
{
|
||||||
|
if (StageProps.Contains(stageProp))
|
||||||
|
{
|
||||||
|
StageProps.Remove(stageProp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetStage(StageEnum stage)
|
||||||
|
{
|
||||||
|
Instance.CurrentStage = stage;
|
||||||
|
|
||||||
|
foreach (var stageProp in StageProps)
|
||||||
|
{
|
||||||
|
stageProp.gameObject.SetActive((stageProp.ActiveAtStages & stage) != 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem("Tools/Staging/Level1")]
|
||||||
|
public static void SetStage1()
|
||||||
|
{
|
||||||
|
SetStage(StageEnum.Level1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem("Tools/Staging/Level2")]
|
||||||
|
public static void SetStage2()
|
||||||
|
{
|
||||||
|
SetStage(StageEnum.Level2);
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Scripts/Game Schedule/StagingManager.cs.meta
Normal file
3
Assets/Scripts/Game Schedule/StagingManager.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 892330fb84d24d79b298b2fa65e8e92f
|
||||||
|
timeCreated: 1723894601
|
Loading…
Reference in New Issue
Block a user