Merge branch 'main' into Soulaha
This commit is contained in:
commit
ff0d2aaf43
5866
Assets/Scenes/DanTest.unity
Normal file
5866
Assets/Scenes/DanTest.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/DanTest.unity.meta
Normal file
7
Assets/Scenes/DanTest.unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e54128340e19f0d42accf44efa9ed8d7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
29
Assets/Scripts/DimensionController.cs
Normal file
29
Assets/Scripts/DimensionController.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class DimensionController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private int dimensionId;
|
||||
[SerializeField] private int maxHp;
|
||||
|
||||
private float _hp;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_hp = maxHp;
|
||||
}
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
var enemy = other.GetComponent<Enemy>();
|
||||
if (ReferenceEquals(enemy, null)) return;
|
||||
|
||||
// Update HP (temp for now)
|
||||
_hp -= 1;
|
||||
|
||||
// Destroy projectile
|
||||
Destroy(other.gameObject);
|
||||
|
||||
// Check loss condition
|
||||
if (_hp <= 0) GameManager.Instance.TriggerGameOver(dimensionId);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/DimensionController.cs.meta
Normal file
11
Assets/Scripts/DimensionController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5dfc667192d2c2641bbd86b84f6dea74
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
43
Assets/Scripts/GameManager.cs
Normal file
43
Assets/Scripts/GameManager.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private PlayerInput _controls;
|
||||
[SerializeField, ReadOnly] private GameState _state;
|
||||
|
||||
public static GameManager Instance { get; private set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null && Instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
Instance = this;
|
||||
_state = GameState.InGame;
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerGameOver(int dimensionID)
|
||||
{
|
||||
if (_state == GameState.Loss) return;
|
||||
|
||||
// Stop controls
|
||||
_controls.SwitchCurrentActionMap("UI");
|
||||
|
||||
// Show Game Over Message
|
||||
Debug.Log("Game Over: Dimension " + dimensionID + " has been destroyed");
|
||||
|
||||
// Show Options (Return to Menu / Retry)
|
||||
_state = GameState.Loss;
|
||||
}
|
||||
}
|
||||
|
||||
public enum GameState
|
||||
{
|
||||
InGame,
|
||||
Loss
|
||||
}
|
||||
11
Assets/Scripts/GameManager.cs.meta
Normal file
11
Assets/Scripts/GameManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbbe9406db76ed447bdc7c36883ee139
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
151
Assets/Scripts/ShowOnlyAttribute.cs
Normal file
151
Assets/Scripts/ShowOnlyAttribute.cs
Normal file
@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
// Source: https://answers.unity.com/questions/489942/how-to-make-a-readonly-property-in-inspector.html
|
||||
|
||||
/// <summary>
|
||||
/// Display a field with disabled read-only controls in the inspector.
|
||||
/// Works with CustomPropertyDrawers.
|
||||
/// </summary>
|
||||
/// <seealso cref="ReadOnlyAttribute"/>
|
||||
/// <seealso cref="BeginShowOnlyGroupAttribute"/>
|
||||
/// <seealso cref="EndShowOnlyGroupAttribute"/>
|
||||
public class ShowOnlyAttribute : PropertyAttribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Display a field as a custom read-only text in the inspector.
|
||||
/// CustomPropertyDrawers will not work when this attribute is used.
|
||||
/// </summary>
|
||||
/// <seealso cref="ShowOnlyAttribute"/>
|
||||
/// <seealso cref="BeginShowOnlyGroupAttribute"/>
|
||||
/// <seealso cref="EndShowOnlyGroupAttribute"/>
|
||||
public class ReadOnlyAttribute : PropertyAttribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Display one or more fields as read-only in the inspector.
|
||||
/// Use <see cref="EndShowOnlyGroupAttribute"/> to close the group.
|
||||
/// Works with CustomPropertyDrawers.
|
||||
/// </summary>
|
||||
/// <seealso cref="EndShowOnlyGroupAttribute"/>
|
||||
/// <seealso cref="ShowOnlyAttribute"/>
|
||||
public class BeginShowOnlyGroupAttribute : PropertyAttribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Use with <see cref="BeginShowOnlyGroupAttribute"/>.
|
||||
/// Close the read-only group and resume editable fields.
|
||||
/// </summary>
|
||||
/// <seealso cref="BeginShowOnlyGroupAttribute"/>
|
||||
/// <seealso cref="ShowOnlyAttribute"/>
|
||||
public class EndShowOnlyGroupAttribute : PropertyAttribute { }
|
||||
|
||||
// Custom Drawers declarations must be in a if Unity Editor assembly condition to allow a project to compile
|
||||
#if UNITY_EDITOR
|
||||
[CustomPropertyDrawer(typeof(ShowOnlyAttribute))]
|
||||
public class ShowOnlyDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight( SerializedProperty property, GUIContent label ) {
|
||||
return EditorGUI.GetPropertyHeight( property, label, true );
|
||||
}
|
||||
|
||||
public override void OnGUI( Rect position, SerializedProperty prop, GUIContent label )
|
||||
{
|
||||
var currentGuiState = GUI.enabled;
|
||||
GUI.enabled = false;
|
||||
EditorGUI.PropertyField(position, prop, label, true);
|
||||
GUI.enabled = currentGuiState;
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer( typeof( ReadOnlyAttribute ) )]
|
||||
public class ReadOnlyDrawer : PropertyDrawer {
|
||||
|
||||
public override float GetPropertyHeight( SerializedProperty property, GUIContent label ) {
|
||||
return EditorGUI.GetPropertyHeight( property, label, true );
|
||||
}
|
||||
|
||||
public override void OnGUI( Rect position, SerializedProperty prop, GUIContent label )
|
||||
{
|
||||
EditorGUI.LabelField(position, label.text,PropToString(prop));
|
||||
}
|
||||
|
||||
private string PropToString(SerializedProperty prop)
|
||||
{
|
||||
string valueStr;
|
||||
|
||||
switch (prop.propertyType)
|
||||
{
|
||||
case SerializedPropertyType.Generic:
|
||||
valueStr = "Array";
|
||||
break;
|
||||
case SerializedPropertyType.Integer:
|
||||
valueStr = prop.intValue.ToString();
|
||||
break;
|
||||
case SerializedPropertyType.Boolean:
|
||||
valueStr = prop.boolValue.ToString();
|
||||
break;
|
||||
case SerializedPropertyType.Float:
|
||||
valueStr = prop.floatValue.ToString("0.00000");
|
||||
break;
|
||||
case SerializedPropertyType.String:
|
||||
valueStr = prop.stringValue;
|
||||
break;
|
||||
case SerializedPropertyType.Enum:
|
||||
valueStr = prop.enumDisplayNames[prop.enumValueIndex];
|
||||
break;
|
||||
case SerializedPropertyType.ObjectReference:
|
||||
try {
|
||||
valueStr = prop.objectReferenceValue.ToString();
|
||||
} catch (NullReferenceException) {
|
||||
valueStr = "Object ToString not defined";
|
||||
}
|
||||
break;
|
||||
case SerializedPropertyType.Vector4:
|
||||
valueStr = prop.vector4Value.ToString();
|
||||
break;
|
||||
case SerializedPropertyType.Vector3:
|
||||
valueStr = prop.vector3Value.ToString();
|
||||
break;
|
||||
case SerializedPropertyType.Vector2:
|
||||
valueStr = prop.vector2Value.ToString();
|
||||
break;
|
||||
case SerializedPropertyType.Vector2Int:
|
||||
valueStr = prop.vector2IntValue.ToString();
|
||||
break;
|
||||
case SerializedPropertyType.Vector3Int:
|
||||
valueStr = prop.vector3IntValue.ToString();
|
||||
break;
|
||||
default:
|
||||
valueStr = "( " + prop.type + " isn't supported )";
|
||||
break;
|
||||
}
|
||||
|
||||
return valueStr;
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer( typeof( BeginShowOnlyGroupAttribute ) )]
|
||||
public class BeginShowOnlyGroupDrawer : DecoratorDrawer {
|
||||
|
||||
public override float GetHeight() { return 0; }
|
||||
|
||||
public override void OnGUI( Rect position )
|
||||
{
|
||||
GUI.enabled = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer( typeof( EndShowOnlyGroupAttribute ) )]
|
||||
public class EndShowOnlyGroupDrawer : DecoratorDrawer {
|
||||
|
||||
public override float GetHeight() { return 0; }
|
||||
|
||||
public override void OnGUI( Rect position )
|
||||
{
|
||||
GUI.enabled = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
11
Assets/Scripts/ShowOnlyAttribute.cs.meta
Normal file
11
Assets/Scripts/ShowOnlyAttribute.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ceea82f853bfa8469552ca95eceae9a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1151
Assets/Settings/ConjureCreativeJam20.cs
Normal file
1151
Assets/Settings/ConjureCreativeJam20.cs
Normal file
File diff suppressed because it is too large
Load Diff
11
Assets/Settings/ConjureCreativeJam20.cs.meta
Normal file
11
Assets/Settings/ConjureCreativeJam20.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b95153e0aacd4642bfff2a40912b435
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -8,7 +8,7 @@ ScriptedImporter:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
|
||||
generateWrapperCode: 0
|
||||
generateWrapperCode: 1
|
||||
wrapperCodePath:
|
||||
wrapperClassName:
|
||||
wrapperCodeNamespace:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user