浏览代码

Fixed missing instigator calls + Inspector Logic fixes for Play From Here +

/main
Thomas ICHÉ 6 年前
当前提交
240a0fcd
共有 11 个文件被更改,包括 34 次插入23 次删除
  1. 4
      Editor/PlayFromHere.cs
  2. 2
      Runtime/Hooks/OnAwakeHook.cs
  3. 2
      Runtime/Hooks/OnDestroyHook.cs
  4. 4
      Runtime/Hooks/OnEnableDisableHook.cs
  5. 4
      Runtime/Hooks/OnKeyDownHook.cs
  6. 2
      Runtime/Hooks/OnMessageHook.cs
  7. 2
      Runtime/Hooks/OnStartHook.cs
  8. 4
      Runtime/Logic/ConditionalLogic.cs
  9. 10
      Runtime/Logic/DelayedLogic.cs
  10. 17
      Runtime/Logic/EditorOnlyLogic.cs
  11. 6
      Runtime/Logic/NextFrameLogic.cs

4
Editor/PlayFromHere.cs


EditorPrefs.SetFloat("PlayFromHere.forward.y", forward.y);
EditorPrefs.SetFloat("PlayFromHere.forward.z", forward.z);
EditorUtility.DisplayProgressBar("Play From Here", "Entering Play From here mode...", 1.0f);
EditorApplication.isPlaying = true;
}

if (state == PlayModeStateChange.EnteredPlayMode && (PlayerPrefs.GetInt("PlayFromHere") == 1))
{
EditorUtility.ClearProgressBar();
if (OnPlayFromHere != null)
{
Vector3 position = new Vector3(

2
Runtime/Hooks/OnAwakeHook.cs


private void Awake()
{
Callable.Call(onAwake);
Callable.Call(onAwake, gameObject);
}
}
}

2
Runtime/Hooks/OnDestroyHook.cs


private void OnDestroy()
{
Callable.Call(onDestroy);
Callable.Call(onDestroy, gameObject);
}
}

4
Runtime/Hooks/OnEnableDisableHook.cs


private void OnEnable()
{
Callable.Call(OnEnableEvent);
Callable.Call(OnEnableEvent, gameObject);
Callable.Call(OnDisableEvent);
Callable.Call(OnDisableEvent, gameObject);
}
}
}

4
Runtime/Hooks/OnKeyDownHook.cs


void Update()
{
if (Input.GetKeyDown(Key))
Callable.Call(OnKeyDownEvent);
Callable.Call(OnKeyDownEvent, gameObject);
Callable.Call(OnKeyUpEvent);
Callable.Call(OnKeyUpEvent, gameObject);
}
}
}

2
Runtime/Hooks/OnMessageHook.cs


void Execute()
{
Callable.Call(OnMessageRecieved);
Callable.Call(OnMessageRecieved, gameObject);
}

2
Runtime/Hooks/OnStartHook.cs


private void Start()
{
Callable.Call(OnStart);
Callable.Call(OnStart, gameObject);
}
}
}

4
Runtime/Logic/ConditionalLogic.cs


public override void Execute(GameObject instigator = null)
{
if (GetCondition())
Callable.Call(OnConditionValid);
Callable.Call(OnConditionValid, instigator);
Callable.Call(OnConditionInvalid);
Callable.Call(OnConditionInvalid, instigator);
}
public abstract bool GetCondition();

10
Runtime/Logic/DelayedLogic.cs


IEnumerator m_Coroutine;
public void Cancel()
public void Cancel(GameObject instigator = null)
Callable.Call(OnCanceled);
Callable.Call(OnCanceled, instigator);
m_Coroutine = null;
}
}

if (m_Coroutine != null) Cancel();
m_Coroutine = RunDelay(Delay);
m_Coroutine = RunDelay(Delay, instigator);
IEnumerator RunDelay(float Seconds)
IEnumerator RunDelay(float Seconds, GameObject instigator = null)
Callable.Call(OnDelayComplete);
Callable.Call(OnDelayComplete, instigator);
m_Coroutine = null;
}
}

17
Runtime/Logic/EditorOnlyLogic.cs


{
public enum Mode
{
PlayerAndEditor,
EditorOnly,
PlayerOnly
}

public Mode ExecutionPath;
public Mode ExecutionPath = Mode.PlayerAndEditor;
[ReorderableList]
public Callable[] OnExecute;

bool acceptPlayFromHere = !(DisableOnPlayFromHere && (PlayerPrefs.GetInt("PlayFromHere") == 1));
case Mode.PlayerAndEditor:
if (acceptPlayFromHere)
Callable.Call(OnExecute, instigator);
break;
if (Application.isEditor && !(DisableOnPlayFromHere && (PlayerPrefs.GetInt("PlayFromHere") == 1)))
Callable.Call(OnExecute);
if (Application.isEditor && acceptPlayFromHere)
Callable.Call(OnExecute, instigator);
if (!Application.isEditor) Callable.Call(OnExecute);
if (!Application.isEditor && acceptPlayFromHere)
Callable.Call(OnExecute, instigator);
break;
}
}

6
Runtime/Logic/NextFrameLogic.cs


public override void Execute(GameObject instigator = null)
{
m_Coroutine = RunDelay();
m_Coroutine = RunDelay(instigator);
IEnumerator RunDelay()
IEnumerator RunDelay(GameObject instigator = null)
Callable.Call(OnComplete);
Callable.Call(OnComplete, instigator);
m_Coroutine = null;
}
}
正在加载...
取消
保存