浏览代码

More code cleanup and bug fixes

Renamed tools
Hidden Quest tool
Added debug visualisation to some ScriptableObjects using ReadOnly attribute
/main
Ciro Continisio 3 年前
当前提交
e0bf1a99
共有 8 个文件被更改,包括 26 次插入22 次删除
  1. 6
      UOP1_Project/Assets/Scripts/Camera/CameraManager.cs
  2. 2
      UOP1_Project/Assets/Scripts/Characters/Damageable.cs
  3. 10
      UOP1_Project/Assets/Scripts/Gameplay/SpawnSystem.cs
  4. 7
      UOP1_Project/Assets/Scripts/Quests/Editor/QuestEditorWindow.cs
  5. 5
      UOP1_Project/Assets/Scripts/RuntimeAnchors/PathStorageSO.cs
  6. 12
      UOP1_Project/Assets/Scripts/RuntimeAnchors/RuntimeAnchorBase.cs
  7. 4
      UOP1_Project/Assets/Scripts/StateMachine/Editor/TransitionTableEditorWindow.cs
  8. 2
      UOP1_Project/Assets/Scripts/StateMachine/ScriptableObjects/TransitionTableSO.cs

6
UOP1_Project/Assets/Scripts/Camera/CameraManager.cs


_protagonistTransformAnchor.OnAnchorProvided += SetupProtagonistVirtualCamera;
_camShakeEvent.OnEventRaised += impulseSource.GenerateImpulse;
_cameraTransformAnchor.Value = mainCamera.transform;
}
private void OnDisable()

_protagonistTransformAnchor.OnAnchorProvided -= SetupProtagonistVirtualCamera;
_camShakeEvent.OnEventRaised -= impulseSource.GenerateImpulse;
_cameraTransformAnchor.Value = null;
}
private void Start()

SetupProtagonistVirtualCamera();
_cameraTransformAnchor.Value = mainCamera.transform;
}
private void OnEnableMouseControlCamera()

2
UOP1_Project/Assets/Scripts/Characters/Damageable.cs


{
if (_currentHealthSO == null)
{
_currentHealthSO = new HealthSO();
_currentHealthSO = ScriptableObject.CreateInstance<HealthSO>();
_currentHealthSO.SetMaxHealth(_healthConfigSO.MaxHealth);
_currentHealthSO.SetCurrentHealth(_healthConfigSO.MaxHealth);
}

10
UOP1_Project/Assets/Scripts/Gameplay/SpawnSystem.cs


public class SpawnSystem : MonoBehaviour
{
[Header("Asset References")]
[SerializeField] private InputReader _inputReader = default;
[SerializeField] private Protagonist _playerPrefab = default;
[SerializeField] private TransformAnchor _playerTransformAnchor = default;

[Header("Scene References")]
private LocationEntrance[] _spawnLocations;
private Transform _defaultSpawnPoint;
private LocationEntrance[] _spawnLocations;
private Transform _defaultSpawnPoint;
private void Awake()
{

private void OnDisable()
{
_onSceneReady.OnEventRaised -= SpawnPlayer;
_playerTransformAnchor.Value = null;
}
private Transform GetSpawnLocation()

7
UOP1_Project/Assets/Scripts/Quests/Editor/QuestEditorWindow.cs


private int _idQuestSelected = default;
private int _idStepSelected = default;
[MenuItem("ChopChop/QuestEditorWindow")]
//Note: Hidden from the tools because it's not fully functional at the moment
//[MenuItem("ChopChop/Quest Editor")]
wnd.titleContent = new GUIContent("QuestEditorWindow");
wnd.titleContent = new GUIContent("Quest Editor");
// Sets a minimum size to the window.
wnd.minSize = new Vector2(250, 250);

// Adds a title to the window.
window.titleContent = new GUIContent("QuestEditorWindow");
window.titleContent = new GUIContent("Quest Editor");
// Sets a minimum size to the window.
window.minSize = new Vector2(250, 250);

5
UOP1_Project/Assets/Scripts/RuntimeAnchors/PathStorageSO.cs


using UnityEngine;
/// <summary>
/// This one of a kind SO stores, during gameplay, the path that was
/// This one of a kind SO stores, during gameplay, the path that was used last (i.e. the one that was taken to get to the current scene).
[HideInInspector] public PathSO lastPathTaken;
[Space]
[ReadOnly] public PathSO lastPathTaken;
}

12
UOP1_Project/Assets/Scripts/RuntimeAnchors/RuntimeAnchorBase.cs


public class RuntimeAnchorBase<T> : DescriptionBaseSO where T : UnityEngine.Object
{
[HideInInspector] public bool isSet = false; // Any script can check if the transform is null before using it, by just checking this bool
private T _value;
[Header("Debug")]
[ReadOnly] public bool isSet = false; // Any script can check if the transform is null before using it, by just checking this bool
[ReadOnly] [SerializeField] private T _value;
public T Value
{
get { return _value; }

isSet = _value != null;
//Notify whoever is waiting for this anchor
if(OnAnchorProvided != null)
if(OnAnchorProvided != null
&& isSet)
Debug.Log(OnAnchorProvided.GetInvocationList()[0].Method.Name);
}
}

4
UOP1_Project/Assets/Scripts/StateMachine/Editor/TransitionTableEditorWindow.cs


private UnityEditor.Editor _transitionTableEditor;
[MenuItem("Transition Table Editor", menuItem = "ChopChop/Transition Table Editor")]
[MenuItem("State Machine Editor", menuItem = "ChopChop/State Machine Editor")]
_window = GetWindow<TransitionTableEditorWindow>("Transition Table Editor");
_window = GetWindow<TransitionTableEditorWindow>("State Machine Editor");
_window.Show();
}

2
UOP1_Project/Assets/Scripts/StateMachine/ScriptableObjects/TransitionTableSO.cs


namespace UOP1.StateMachine.ScriptableObjects
{
[CreateAssetMenu(fileName = "New Transition Table", menuName = "State Machines/Transition Table")]
[CreateAssetMenu(fileName = "NewTransitionTable", menuName = "State Machines/Transition Table")]
public class TransitionTableSO : ScriptableObject
{
[SerializeField] private TransitionItem[] _transitions = default;

正在加载...
取消
保存