Skip to content
Snippets Groups Projects
Commit 093813bc authored by billc27's avatar billc27
Browse files

feat: state for cheats

parent c30cb2fc
Branches
Tags
1 merge request!2No Damage Cheat, Twice Speed Cheat, Reset Cheat(s)
using Nightmare;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GlobalStateManager : MonoBehaviour
{
// Create Singleton
public static GlobalStateManager Instance { get; private set; }
private CheatManager cheatManager;
private void Awake()
{
if (Instance != null)
{
if (Instance != this)
{
Destroy(this);
}
}
else
{
Instance = this;
Refresh();
}
}
private void Refresh()
{
cheatManager = FindObjectOfType<CheatManager>();
}
public void SetState(SaveState state)
{
Refresh();
cheatManager.LoadCheat(state.globalSaveState.cheats);
}
}
fileFormatVersion: 2
guid: 40f7e905f1aa63741b02b9146e251f76
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class GlobalSaveState
{
public bool[] cheats;
public GlobalSaveState(bool[] cheats)
{
this.cheats = cheats;
}
public override string ToString()
{
return JsonConvert.SerializeObject(this);
}
}
[Serializable]
public class SaveState
{
public GlobalSaveState globalSaveState;
public SaveState(GlobalSaveState globalSaveState)
{
this.globalSaveState = globalSaveState;
}
public override string ToString()
{
return JsonConvert.SerializeObject(this);
}
}
fileFormatVersion: 2
guid: e0c4e2ce428b7c044baefcfca6687111
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment