浏览代码

interaction ui event

/main
Amel 4 年前
当前提交
f37966df
共有 3 个文件被更改,包括 38 次插入1 次删除
  1. 3
      UOP1_Project/Assets/Scripts/Events/ScriptableObjects/GameObjectEventChannelSO.cs
  2. 25
      UOP1_Project/Assets/Scripts/Events/ScriptableObjects/InteractionUIEventChannelSO.cs
  3. 11
      UOP1_Project/Assets/Scripts/Events/ScriptableObjects/InteractionUIEventChannelSO.cs.meta

3
UOP1_Project/Assets/Scripts/Events/ScriptableObjects/GameObjectEventChannelSO.cs


public UnityAction<GameObject> OnEventRaised;
public void RaiseEvent(GameObject value)
{
OnEventRaised.Invoke(value);
if (OnEventRaised != null)
OnEventRaised.Invoke(value);
}
}

25
UOP1_Project/Assets/Scripts/Events/ScriptableObjects/InteractionUIEventChannelSO.cs


using UnityEngine.Events;
using UnityEngine;
/// <summary>
/// This class is used for Events to toggle the interaction UI.
/// Example: Dispaly or hide the interaction UI via a bool and the interaction type from the enum via int
/// </summary>
[CreateAssetMenu(menuName = "Events/Toogle Interaction UI Event Channel")]
public class InteractionUIEventChannelSO : ScriptableObject
{
public UnityAction<bool, Interaction> OnEventRaised;
public void RaiseEvent(bool state, Interaction interactionType)
{
if (OnEventRaised != null)
OnEventRaised.Invoke(state, interactionType);
}
}
//maybe make a SO for the interaction type so we can access it from both the UI script
//and the Interaction script
//we have a field for the current interaction so no need to pass it as paramater
//in the event...

11
UOP1_Project/Assets/Scripts/Events/ScriptableObjects/InteractionUIEventChannelSO.cs.meta


fileFormatVersion: 2
guid: 93b84f4bc4b345044ab04e6870e694ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存