Skip to content
Snippets Groups Projects
Commit 5179d881 authored by michael's avatar michael
Browse files

Added scriptable vars shared code and removed meta-less readme.

parent cb0baf02
No related branches found
No related tags found
No related merge requests found
Pipeline #1962 canceled
Showing
with 299 additions and 2 deletions
# unity pm test
fileFormatVersion: 2
guid: 99f3c7ece40238e41bfcfb1a3123bc9b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections.Generic;
using UnityEngine;
namespace Shared.ScriptableVariables {
// Automatically calls Reset() on any assigned Resettables on Start
// Useful for setting default values to ScriptableVariables on startup
public class AutomaticResettableResetter : MonoBehaviour {
[Tooltip("List of Objects that implement the Resettable interface to reset on Start")]
public List<Object> resettables = new List<Object>();
[Tooltip("Game Event to fire when all resettables have been reset")]
public GameEvent resetComplete;
// ---------------------------------------------------------------------------
void OnValidate() {
// Remove any Objects in the list that don't implement the Resettable interface
for (var index = resettables.Count - 1; index >= 0; --index) {
if (!(resettables[index] is Resettable)) {
resettables.RemoveAt(index);
}
}
}
// ---------------------------------------------------------------------------
void Start() {
for (var index = resettables.Count - 1; index >= 0; --index) {
var resettable = resettables[index] as Resettable;
resettable.Reset();
}
if (resetComplete != null) {
resetComplete.Raise();
}
}
}
}
fileFormatVersion: 2
guid: cf16b22a15bd12f41a3c1a8f532b26fb
timeCreated: 1510602115
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 483ff9c813faac44189347241e5939e6
folderAsset: yes
timeCreated: 1510599414
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
namespace Shared.ScriptableVariables {
// ScriptableVariable that decouples components firing and listening to game events that require a boolean parameter
[CreateAssetMenu(menuName = "Scriptable Objects/Events/Boolean Game Event")]
public class BooleanGameEvent : GameEvent<bool> {
//---------------------------------------------------------------------------
[ContextMenu("Raise(true)")]
private void RaiseTrue() {
Raise(true);
}
//---------------------------------------------------------------------------
[ContextMenu("Raise(false)")]
private void RaiseFalse() {
Raise(false);
}
}
}
fileFormatVersion: 2
guid: ff7d54b91183cc94297ede3be460e0d0
timeCreated: 1510599448
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: c5fb57c8c826579458e26998f190b842
folderAsset: yes
timeCreated: 1513206428
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using UnityEditor;
using UnityEngine;
namespace Shared.ScriptableVariables {
//---------------------------------------------------------------------------
[CustomEditor(typeof(BooleanGameEvent))]
public class BooleanGameEventEditor : Editor {
private bool testValue = false;
//---------------------------------------------------------------------------
public override void OnInspectorGUI() {
base.OnInspectorGUI();
EditorGUILayout.BeginHorizontal();
testValue = EditorGUILayout.Toggle("Test Value", testValue);
if (GUILayout.Button("Fire Event")) {
((BooleanGameEvent)target).Raise(testValue);
}
EditorGUILayout.EndHorizontal();
}
}
}
fileFormatVersion: 2
guid: 4cc2f4c2b9d6848418dda0f375a7f50f
timeCreated: 1513206436
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEditor;
using UnityEngine;
namespace Shared.ScriptableVariables {
//---------------------------------------------------------------------------
[CustomEditor(typeof(FloatGameEvent))]
public class FloatGameEventEditor : Editor {
private float testValue = 0.0f;
//---------------------------------------------------------------------------
public override void OnInspectorGUI() {
base.OnInspectorGUI();
EditorGUILayout.BeginHorizontal();
testValue = EditorGUILayout.FloatField("Test Value", testValue);
if (GUILayout.Button("Fire Event")) {
((FloatGameEvent)target).Raise(testValue);
}
EditorGUILayout.EndHorizontal();
}
}
}
fileFormatVersion: 2
guid: 55ad0db2d28d4484c8cc2c3193e9c2d3
timeCreated: 1513206436
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEditor;
using UnityEngine;
namespace Shared.ScriptableVariables {
//---------------------------------------------------------------------------
[CustomEditor(typeof(GameEvent))]
public class GameEventEditor : Editor {
//---------------------------------------------------------------------------
public override void OnInspectorGUI() {
base.OnInspectorGUI();
if (GUILayout.Button("Fire Event")) {
((GameEvent)target).Raise();
}
}
}
}
fileFormatVersion: 2
guid: 88090feebd5266e4b8a497e0aeacb15a
timeCreated: 1513206436
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEditor;
using UnityEngine;
namespace Shared.ScriptableVariables {
//---------------------------------------------------------------------------
[CustomEditor(typeof(IntGameEvent))]
public class IntGameEventEditor : Editor {
private int testValue = 0;
//---------------------------------------------------------------------------
public override void OnInspectorGUI() {
base.OnInspectorGUI();
EditorGUILayout.BeginHorizontal();
testValue = EditorGUILayout.IntField("Test Value", testValue);
if (GUILayout.Button("Fire Event")) {
((IntGameEvent)target).Raise(testValue);
}
EditorGUILayout.EndHorizontal();
}
}
}
fileFormatVersion: 2
guid: 091b5244678bea24ab2a62e3849cb715
timeCreated: 1513206436
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEditor;
using UnityEngine;
namespace Shared.ScriptableVariables {
//---------------------------------------------------------------------------
[CustomEditor(typeof(StringGameEvent))]
public class StringGameEventEditor : Editor {
private string testValue;
//---------------------------------------------------------------------------
public override void OnInspectorGUI() {
base.OnInspectorGUI();
EditorGUILayout.BeginHorizontal();
testValue = EditorGUILayout.TextField("Test Value", testValue);
if (GUILayout.Button("Fire Event")) {
((StringGameEvent)target).Raise(testValue);
}
EditorGUILayout.EndHorizontal();
}
}
}
fileFormatVersion: 2
guid: 5b14325ad63c61f468af93d960da8ec0
timeCreated: 1513206436
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
namespace Shared.ScriptableVariables {
// ScriptableVariable that decouples components firing and listening to game events that require a float parameter
[CreateAssetMenu(menuName = "Scriptable Objects/Events/Float Game Event")]
public class FloatGameEvent : GameEvent<float> {
}
}
fileFormatVersion: 2
guid: 548f989fcd91b734492e17b5b7a185fc
timeCreated: 1510599448
licenseType: Pro
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment