浏览代码

Added Instigators references to Callable Execution. / Added On Destroy Hook / Destroy Object Action / Teleport Game Object Action

/main
Thomas ICHÉ 6 年前
当前提交
6d00ca58
共有 48 个文件被更改,包括 379 次插入33 次删除
  1. 2
      Runtime/Actions/ApplicationExitAction.cs
  2. 2
      Runtime/Actions/AudioMixParameterAction.cs
  3. 2
      Runtime/Actions/AudioMixParameterCurveAction.cs
  4. 2
      Runtime/Actions/CursorAction.cs
  5. 2
      Runtime/Actions/CycleResolutionsAction.cs
  6. 2
      Runtime/Actions/CycleWindowModeAction.cs
  7. 3
      Runtime/Actions/FocusUIAction.cs
  8. 2
      Runtime/Actions/FullScreenFadeAction.cs
  9. 2
      Runtime/Actions/GameSaveLoadSaveAction.cs
  10. 2
      Runtime/Actions/GameSaveSetValueAction.cs
  11. 4
      Runtime/Actions/SendMessageAction.cs
  12. 2
      Runtime/Actions/SetTimeScaleAction.cs
  13. 3
      Runtime/Actions/StreamingLevelAction.cs
  14. 2
      Runtime/Actions/TakeScreenshotAction.cs
  15. 2
      Runtime/Actions/ToggleGameObjectAction.cs
  16. 3
      Runtime/Actions/UnityEventAction.cs
  17. 11
      Runtime/Callable.cs
  18. 4
      Runtime/Hooks/OnTriggerHook.cs
  19. 2
      Runtime/ICallable.cs
  20. 3
      Runtime/Logic/ConditionalLogic.cs
  21. 2
      Runtime/Logic/DelayedLogic.cs
  22. 8
      Runtime/Logic/EditorOnlyLogic.cs
  23. 2
      Runtime/Logic/NextFrameLogic.cs
  24. 2
      Runtime/Logic/SaveDataLogic.cs
  25. 24
      Runtime/Actions/DestroyObjectAction.cs
  26. 11
      Runtime/Actions/DestroyObjectAction.cs.meta
  27. 34
      Runtime/Actions/SpawnPrefabAction.cs
  28. 11
      Runtime/Actions/SpawnPrefabAction.cs.meta
  29. 40
      Runtime/Actions/TeleportGameObjectAction.cs
  30. 11
      Runtime/Actions/TeleportGameObjectAction.cs.meta
  31. 19
      Runtime/Hooks/OnDestroyHook.cs
  32. 11
      Runtime/Hooks/OnDestroyHook.cs.meta
  33. 18
      Runtime/Hooks/OnPickupHook.cs
  34. 11
      Runtime/Hooks/OnPickupHook.cs.meta
  35. 8
      Runtime/Pickup.meta
  36. 8
      Runtime/Rigs.meta
  37. 16
      Runtime/Pickup/PickupEffectBase.cs
  38. 11
      Runtime/Pickup/PickupEffectBase.cs.meta
  39. 12
      Runtime/Pickup/PickupOwnerBase.cs
  40. 11
      Runtime/Pickup/PickupOwnerBase.cs.meta
  41. 12
      Runtime/Pickup/SamplePickupEffect.cs
  42. 11
      Runtime/Pickup/SamplePickupEffect.cs.meta
  43. 18
      Runtime/Pickup/SamplePickupOwner.cs
  44. 11
      Runtime/Pickup/SamplePickupOwner.cs.meta
  45. 22
      Runtime/Rigs/FollowPositionRig.cs
  46. 11
      Runtime/Rigs/FollowPositionRig.cs.meta

2
Runtime/Actions/ApplicationExitAction.cs


{
public class ApplicationExitAction : ActionBase
{
public override void Execute()
public override void Execute(GameObject instigator = null)
{
Application.Quit();
}

2
Runtime/Actions/AudioMixParameterAction.cs


public UnityEvent OnInterpComplete;
Coroutine m_Coroutine;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
if (InterpDuration <= 0.0f)
{

2
Runtime/Actions/AudioMixParameterCurveAction.cs


public UnityEvent OnInterpComplete;
Coroutine m_Coroutine;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
if (m_Coroutine != null)

2
Runtime/Actions/CursorAction.cs


public CursorLockMode LockState = CursorLockMode.None;
public bool CursorVisible = true;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
Cursor.lockState = LockState;
Cursor.visible = CursorVisible;

2
Runtime/Actions/CycleResolutionsAction.cs


ButtonLabel.text = getText(selectedResolution);
}
public override void Execute()
public override void Execute(GameObject instigator = null)
{
// When we are in the editor we don't have any available resolutions
if (availableResolutions.Length == 0)

2
Runtime/Actions/CycleWindowModeAction.cs


ButtonLabel.text = getText(Screen.fullScreen);
}
public override void Execute()
public override void Execute(GameObject instigator = null)
{
Screen.fullScreen = !Screen.fullScreen;
}

3
Runtime/Actions/FocusUIAction.cs


using UnityEngine;
using UnityEngine.UI;
namespace GameplayIngredients.Actions

public Selectable UIObjectToFocus;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
if (UIObjectToFocus != null)
UIObjectToFocus.Select();

2
Runtime/Actions/FullScreenFadeAction.cs


[ReorderableList]
public Callable[] OnComplete;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
Manager.Get<FullScreenFadeManager>().Fade(Duration, Fading, OnComplete);
}

2
Runtime/Actions/GameSaveLoadSaveAction.cs


public Action action = Action.Load;
public byte UserSaveIndex = 0;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
if(action == Action.Load)
{

2
Runtime/Actions/GameSaveSetValueAction.cs


public bool BoolValue;
public float FloatValue;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
var gsm = Manager.Get<GameSaveManager>();
switch(valueType)

4
Runtime/Actions/SendMessageAction.cs


using UnityEngine;
namespace GameplayIngredients.Actions
{
public class SendMessageAction : ActionBase

public override void Execute()
public override void Execute(GameObject instigator = null)
{
Messager.Send(MessageToSend);
}

2
Runtime/Actions/SetTimeScaleAction.cs


{
public float TimeScale = 1.0f;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
Time.timeScale = TimeScale;
}

3
Runtime/Actions/StreamingLevelAction.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using GameplayIngredients.LevelStreaming;
using NaughtyAttributes;

[ReorderableList]
public Callable[] OnLoadComplete;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
List<string> sceneNames = new List<string>();
foreach (var scene in Scenes)

2
Runtime/Actions/TakeScreenshotAction.cs


public int figureCount = 2;
private int screenshotNumber = 0;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
ScreenCapture.CaptureScreenshot(name + screenshotNumber.ToString().PadLeft(figureCount, '0') + ".png", supersampleRate);
screenshotNumber += 1;

2
Runtime/Actions/ToggleGameObjectAction.cs


[ReorderableList]
public GameObjectToggle[] Targets;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
foreach(var target in Targets)
{

3
Runtime/Actions/UnityEventAction.cs


using UnityEngine;
using UnityEngine.Events;
namespace GameplayIngredients.Actions

public UnityEvent OnExecute;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
OnExecute.Invoke();
}

11
Runtime/Callable.cs


Name = GetType().Name;
}
public abstract void Execute();
public abstract void Execute(GameObject instigator = null);
public static void Call(Callable[] calls)
public static void Call(Callable[] calls, GameObject instigator = null)
call.Execute();
call.Execute(instigator);
public static void Call(Callable call)
public static void Call(Callable call, GameObject instigator = null)
call.Execute();
call.Execute(instigator);
else
Debug.LogError("Cannot execute call: Null or Missing");
}

4
Runtime/Hooks/OnTriggerHook.cs


}
if (OnlyInteractWithTag && other.tag == Tag )
{
Callable.Call(onTriggerEnter);
Callable.Call(onTriggerEnter, other.gameObject);
Callable.Call(onTriggerEnter);
Callable.Call(onTriggerEnter, other.gameObject);
}
}

2
Runtime/ICallable.cs


{
public interface ICallable
{
void Execute();
void Execute(GameObject instigator = null);
}
}

3
Runtime/Logic/ConditionalLogic.cs


using NaughtyAttributes;
using System;
using UnityEngine;
using UnityEngine.Events;
namespace GameplayIngredients.Logic

[ReorderableList]
public Callable[] OnConditionInvalid;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
if (GetCondition())
Callable.Call(OnConditionValid);

2
Runtime/Logic/DelayedLogic.cs


}
}
public override void Execute()
public override void Execute(GameObject instigator = null)
{
if (m_Coroutine != null) Cancel();

8
Runtime/Logic/EditorOnlyLogic.cs


PlayerOnly
}
[Tooltip("Executes in editor whe using Play From Here or not")]
public bool EditorOnPlayHere = false;
[Tooltip("Disables when using Play From Here")]
public bool DisableOnPlayFromHere = false;
public Mode ExecutionPath;

public override void Execute()
public override void Execute(GameObject instigator = null)
if (Application.isEditor && EditorOnPlayHere == (PlayerPrefs.GetInt("PlayFromHere") == 1))
if (Application.isEditor && !(DisableOnPlayFromHere && (PlayerPrefs.GetInt("PlayFromHere") == 1)))
Callable.Call(OnExecute);
break;

2
Runtime/Logic/NextFrameLogic.cs


public Callable[] OnComplete;
IEnumerator m_Coroutine;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
m_Coroutine = RunDelay();
StartCoroutine(m_Coroutine);

2
Runtime/Logic/SaveDataLogic.cs


[ReorderableList]
public Callable[] OnTesFail;
public override void Execute()
public override void Execute(GameObject instigator = null)
{
var gsm = Manager.Get<GameSaveManager>();
bool result = false;

24
Runtime/Actions/DestroyObjectAction.cs


using NaughtyAttributes;
using UnityEngine;
namespace GameplayIngredients.Actions
{
public class DestroyObjectAction : ActionBase
{
[ReorderableList]
public GameObject[] ObjectsToDestroy;
public bool DestroyInstigator = false;
public override void Execute(GameObject instigator = null)
{
if (ObjectsToDestroy != null )
{
foreach(var obj in ObjectsToDestroy)
Destroy(obj);
}
if(DestroyInstigator && instigator != null)
Destroy(instigator);
}
}
}

11
Runtime/Actions/DestroyObjectAction.cs.meta


fileFormatVersion: 2
guid: 5e0d20f2fb594be42acf7e05001c2932
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

34
Runtime/Actions/SpawnPrefabAction.cs


using NaughtyAttributes;
using UnityEngine;
namespace GameplayIngredients.Actions
{
public class SpawnPrefabAction : ActionBase
{
[ReorderableList]
public GameObject[] Prefabs;
public Transform TargetTransform;
public bool AttachToTarget = false;
public bool DontDestroyPrefabsOnLoad = false;
public override void Execute(GameObject instigator = null)
{
foreach (var prefab in Prefabs)
{
string name = prefab.name;
var obj = Instantiate<GameObject>(prefab);
obj.name = name;
obj.transform.position = TargetTransform.position;
obj.transform.rotation = TargetTransform.rotation;
if (AttachToTarget)
obj.transform.parent = TargetTransform;
if (DontDestroyPrefabsOnLoad)
DontDestroyOnLoad(obj);
}
}
}
}

11
Runtime/Actions/SpawnPrefabAction.cs.meta


fileFormatVersion: 2
guid: f2875c0d65452a845831d16b89e97547
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

40
Runtime/Actions/TeleportGameObjectAction.cs


using NaughtyAttributes;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GameplayIngredients.Actions
{
public class TeleportGameObjectAction : ActionBase
{
[ReorderableList]
public GameObject[] ObjectsToTeleport;
public bool TeleportInstigator = false;
public Transform TeleportTarget;
public override void Execute(GameObject instigator = null)
{
if(TeleportTarget == null)
{
Debug.LogWarning("No Teleport Target");
return;
}
if(ObjectsToTeleport != null)
{
foreach(var obj in ObjectsToTeleport)
{
Teleport(obj, TeleportTarget.position, TeleportTarget.rotation);
}
}
if (TeleportInstigator && instigator != null)
Teleport(instigator, TeleportTarget.position, TeleportTarget.rotation);
}
static void Teleport(GameObject obj, Vector3 worldPosition, Quaternion rotation)
{
obj.transform.position = worldPosition;
obj.transform.rotation = rotation;
}
}
}

11
Runtime/Actions/TeleportGameObjectAction.cs.meta


fileFormatVersion: 2
guid: 274fbc4743bc0694e92a40c10f7961aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

19
Runtime/Hooks/OnDestroyHook.cs


using NaughtyAttributes;
using UnityEngine;
namespace GameplayIngredients.Hooks
{
public class OnDestroyHook : MonoBehaviour
{
[ReorderableList]
public Callable[] onDestroy;
private void OnDestroy()
{
Callable.Call(onDestroy);
}
}
}

11
Runtime/Hooks/OnDestroyHook.cs.meta


fileFormatVersion: 2
guid: 8d68e1777abe66842b9beb0678f7bdd1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

18
Runtime/Hooks/OnPickupHook.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OnPickupHook : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
Runtime/Hooks/OnPickupHook.cs.meta


fileFormatVersion: 2
guid: 4cd7c5c3eb0bd1c4d9fbbb4a0e98613b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Runtime/Pickup.meta


fileFormatVersion: 2
guid: bbd0e8c072187b54aab41cb4d7ff1507
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Runtime/Rigs.meta


fileFormatVersion: 2
guid: e472dbe013811a64ca80302d176dbc90
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

16
Runtime/Pickup/PickupEffectBase.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GameplayIngredients.Pickup
{
public abstract class PickupEffectBase : ScriptableObject
{
public float Duration = 0.0f;
public void ApplyPickupEffect(PickupOwnerBase owner)
{
owner.ApplyEffect(this);
}
}
}

11
Runtime/Pickup/PickupEffectBase.cs.meta


fileFormatVersion: 2
guid: 90a8967f9fa92d848a7409149660bd64
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

12
Runtime/Pickup/PickupOwnerBase.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GameplayIngredients.Pickup
{
public abstract class PickupOwnerBase : MonoBehaviour
{
public abstract void ApplyEffect<T>(T effect) where T : PickupEffectBase;
}
}

11
Runtime/Pickup/PickupOwnerBase.cs.meta


fileFormatVersion: 2
guid: 1a1a56323be50404aa1c75fa378cfc03
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

12
Runtime/Pickup/SamplePickupEffect.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GameplayIngredients.Pickup
{
public class SamplePickupEffect : PickupEffectBase
{
public int Toto;
}
}

11
Runtime/Pickup/SamplePickupEffect.cs.meta


fileFormatVersion: 2
guid: d37b1e4e191100f4a9c6dcf738a1dd0c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

18
Runtime/Pickup/SamplePickupOwner.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SamplePickupOwner : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

11
Runtime/Pickup/SamplePickupOwner.cs.meta


fileFormatVersion: 2
guid: 39322b75bba8c564ea36c0a2dac5fa5b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

22
Runtime/Rigs/FollowPositionRig.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FollowPositionRig : MonoBehaviour
{
public Transform Target;
public float Dampen = 1.0f;
public float MaximumVelocity = 1.0f;
void Update()
{
if(Target != null)
{
var transform = gameObject.transform;
var delta = Target.position - transform.position;
var speed = Time.deltaTime * Mathf.Min((Dampen * delta.magnitude), MaximumVelocity);
gameObject.transform.position += delta.normalized * speed;
}
}
}

11
Runtime/Rigs/FollowPositionRig.cs.meta


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