From 97da432c35b8c7aaf9dd2c39e2aa4b1f55f36065 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 27 Jan 2021 16:15:06 +0800 Subject: +behaviour designer --- .../Basic Tasks/CharacterController/GetCenter.cs | 45 ++++++++++++++++++++++ .../CharacterController/GetCenter.cs.meta | 8 ++++ .../Basic Tasks/CharacterController/GetHeight.cs | 44 +++++++++++++++++++++ .../CharacterController/GetHeight.cs.meta | 8 ++++ .../Basic Tasks/CharacterController/GetRadius.cs | 45 ++++++++++++++++++++++ .../CharacterController/GetRadius.cs.meta | 8 ++++ .../CharacterController/GetSlopeLimit.cs | 45 ++++++++++++++++++++++ .../CharacterController/GetSlopeLimit.cs.meta | 8 ++++ .../CharacterController/GetStepOffset.cs | 45 ++++++++++++++++++++++ .../CharacterController/GetStepOffset.cs.meta | 8 ++++ .../Basic Tasks/CharacterController/GetVelocity.cs | 45 ++++++++++++++++++++++ .../CharacterController/GetVelocity.cs.meta | 8 ++++ .../CharacterController/HasColliderHit.cs | 43 +++++++++++++++++++++ .../CharacterController/HasColliderHit.cs.meta | 8 ++++ .../Basic Tasks/CharacterController/IsGrounded.cs | 39 +++++++++++++++++++ .../CharacterController/IsGrounded.cs.meta | 8 ++++ .../Basic Tasks/CharacterController/Move.cs | 44 +++++++++++++++++++++ .../Basic Tasks/CharacterController/Move.cs.meta | 8 ++++ .../Basic Tasks/CharacterController/SetCenter.cs | 44 +++++++++++++++++++++ .../CharacterController/SetCenter.cs.meta | 8 ++++ .../Basic Tasks/CharacterController/SetHeight.cs | 44 +++++++++++++++++++++ .../CharacterController/SetHeight.cs.meta | 8 ++++ .../Basic Tasks/CharacterController/SetRadius.cs | 44 +++++++++++++++++++++ .../CharacterController/SetRadius.cs.meta | 8 ++++ .../CharacterController/SetSlopeLimit.cs | 44 +++++++++++++++++++++ .../CharacterController/SetSlopeLimit.cs.meta | 8 ++++ .../CharacterController/SetStepOffset.cs | 44 +++++++++++++++++++++ .../CharacterController/SetStepOffset.cs.meta | 8 ++++ .../Basic Tasks/CharacterController/SimpleMove.cs | 44 +++++++++++++++++++++ .../CharacterController/SimpleMove.cs.meta | 8 ++++ 30 files changed, 779 insertions(+) create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetCenter.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetCenter.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetHeight.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetHeight.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetRadius.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetRadius.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetSlopeLimit.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetSlopeLimit.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetStepOffset.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetStepOffset.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetVelocity.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetVelocity.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/HasColliderHit.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/HasColliderHit.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/IsGrounded.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/IsGrounded.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/Move.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/Move.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetCenter.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetCenter.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetHeight.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetHeight.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetRadius.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetRadius.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetSlopeLimit.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetSlopeLimit.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetStepOffset.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetStepOffset.cs.meta create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SimpleMove.cs create mode 100644 Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SimpleMove.cs.meta (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController') diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetCenter.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetCenter.cs new file mode 100644 index 00000000..a05eb82a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetCenter.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Stores the center of the CharacterController. Returns Success.")] + public class GetCenter : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The center of the CharacterController")] + [RequiredField] + public SharedVector3 storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + storeValue.Value = characterController.center; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetCenter.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetCenter.cs.meta new file mode 100644 index 00000000..d0c9a496 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetCenter.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e4033e3d9c7ef994ba600b3afec28a0d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetHeight.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetHeight.cs new file mode 100644 index 00000000..1317129e --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetHeight.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Stores the height of the CharacterController. Returns Success.")] + public class GetHeight : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The height of the CharacterController")] + [RequiredField] + public SharedFloat storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + storeValue.Value = characterController.height; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetHeight.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetHeight.cs.meta new file mode 100644 index 00000000..d1dd43b3 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetHeight.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eec31e6d5685c674fa2952757b4adf9a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetRadius.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetRadius.cs new file mode 100644 index 00000000..67c3d1ff --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetRadius.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Stores the radius of the CharacterController. Returns Success.")] + public class GetRadius : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The radius of the CharacterController")] + [RequiredField] + public SharedFloat storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + storeValue.Value = characterController.radius; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetRadius.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetRadius.cs.meta new file mode 100644 index 00000000..81e97192 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetRadius.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3bf330244cdea3b43ad95e8731fdb78b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetSlopeLimit.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetSlopeLimit.cs new file mode 100644 index 00000000..cb33ff2a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetSlopeLimit.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Stores the slope limit of the CharacterController. Returns Success.")] + public class GetSlopeLimit : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The slope limit of the CharacterController")] + [RequiredField] + public SharedFloat storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + storeValue.Value = characterController.slopeLimit; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetSlopeLimit.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetSlopeLimit.cs.meta new file mode 100644 index 00000000..c6bf9789 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetSlopeLimit.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3cb445c34dce1a14aa5134278025ec59 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetStepOffset.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetStepOffset.cs new file mode 100644 index 00000000..f4d14456 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetStepOffset.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Stores the step offset of the CharacterController. Returns Success.")] + public class GetStepOffset : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The step offset of the CharacterController")] + [RequiredField] + public SharedFloat storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + storeValue.Value = characterController.stepOffset; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetStepOffset.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetStepOffset.cs.meta new file mode 100644 index 00000000..17385174 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetStepOffset.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d9bb8d4be247f4d4cb9b2b05a6efd48f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetVelocity.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetVelocity.cs new file mode 100644 index 00000000..2c4ee10a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetVelocity.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Stores the velocity of the CharacterController. Returns Success.")] + public class GetVelocity : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The velocity of the CharacterController")] + [RequiredField] + public SharedVector3 storeValue; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + storeValue.Value = characterController.velocity; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + storeValue = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetVelocity.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetVelocity.cs.meta new file mode 100644 index 00000000..23ec32d3 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/GetVelocity.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 783c920567425bd4c9385eeaf8099ea4 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/HasColliderHit.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/HasColliderHit.cs new file mode 100644 index 00000000..a1688d5f --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/HasColliderHit.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Returns Success if the collider hit another object, otherwise Failure.")] + public class HasColliderHit : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The tag of the GameObject to check for a collision against")] + public SharedString tag = ""; + [Tooltip("The object that started the collision")] + public SharedGameObject collidedGameObject; + + private bool enteredCollision = false; + + public override TaskStatus OnUpdate() + { + return enteredCollision ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnEnd() + { + enteredCollision = false; + } + + public override void OnControllerColliderHit(ControllerColliderHit hit) + { + if (string.IsNullOrEmpty(tag.Value) || tag.Value.Equals(hit.gameObject.tag)) { + collidedGameObject.Value = hit.gameObject; + enteredCollision = true; + } + } + + public override void OnReset() + { + targetGameObject = null; + tag = ""; + collidedGameObject = null; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/HasColliderHit.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/HasColliderHit.cs.meta new file mode 100644 index 00000000..947de51c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/HasColliderHit.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9ff7c43d9df5279489455a4ce2eb3b20 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/IsGrounded.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/IsGrounded.cs new file mode 100644 index 00000000..4d480765 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/IsGrounded.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Returns Success if the character is grounded, otherwise Failure.")] + public class IsGrounded : Conditional + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + return characterController.isGrounded ? TaskStatus.Success : TaskStatus.Failure; + } + + public override void OnReset() + { + targetGameObject = null; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/IsGrounded.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/IsGrounded.cs.meta new file mode 100644 index 00000000..536c1fa8 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/IsGrounded.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e8541a996b0a37b4f8bce82dd23ddb84 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/Move.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/Move.cs new file mode 100644 index 00000000..de40f1d2 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/Move.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("A more complex move function taking absolute movement deltas. Returns Success.")] + public class Move : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The amount to move")] + public SharedVector3 motion; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.Move(motion.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + motion = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/Move.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/Move.cs.meta new file mode 100644 index 00000000..00e7570e --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/Move.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 546770f14f8265d4c83b94210630b644 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetCenter.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetCenter.cs new file mode 100644 index 00000000..c3aaac90 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetCenter.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Sets the center of the CharacterController. Returns Success.")] + public class SetCenter : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The center of the CharacterController")] + public SharedVector3 center; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.center = center.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + center = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetCenter.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetCenter.cs.meta new file mode 100644 index 00000000..90d1e1c9 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetCenter.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1072c5d1f7d15b24d811ee2e52f5806f +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetHeight.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetHeight.cs new file mode 100644 index 00000000..7ad8e61c --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetHeight.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Sets the height of the CharacterController. Returns Success.")] + public class SetHeight : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The height of the CharacterController")] + public SharedFloat height; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.height = height.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + height = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetHeight.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetHeight.cs.meta new file mode 100644 index 00000000..d42f0e0b --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetHeight.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f3646fc892390f443ab43e4313cd0c6a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetRadius.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetRadius.cs new file mode 100644 index 00000000..53327f7d --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetRadius.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Sets the radius of the CharacterController. Returns Success.")] + public class SetRadius : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The radius of the CharacterController")] + public SharedFloat radius; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.radius = radius.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + radius = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetRadius.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetRadius.cs.meta new file mode 100644 index 00000000..8db23e47 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetRadius.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d3d7c584aef3bd5468165685a1975862 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetSlopeLimit.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetSlopeLimit.cs new file mode 100644 index 00000000..ac860c57 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetSlopeLimit.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Sets the slope limit of the CharacterController. Returns Success.")] + public class SetSlopeLimit : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The slope limit of the CharacterController")] + public SharedFloat slopeLimit; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.slopeLimit = slopeLimit.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + slopeLimit = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetSlopeLimit.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetSlopeLimit.cs.meta new file mode 100644 index 00000000..aca63d5a --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetSlopeLimit.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65d4ccec4c868584a89d9037a6eec3e6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetStepOffset.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetStepOffset.cs new file mode 100644 index 00000000..d646276d --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetStepOffset.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Sets the step offset of the CharacterController. Returns Success.")] + public class SetStepOffset : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The step offset of the CharacterController")] + public SharedFloat stepOffset; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.stepOffset = stepOffset.Value; + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + stepOffset = 0; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetStepOffset.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetStepOffset.cs.meta new file mode 100644 index 00000000..5512e7e7 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SetStepOffset.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b062e83de9feb8a41a9e4989f2d65b97 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SimpleMove.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SimpleMove.cs new file mode 100644 index 00000000..7b999324 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SimpleMove.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityCharacterController +{ + [TaskCategory("Basic/CharacterController")] + [TaskDescription("Moves the character with speed. Returns Success.")] + public class SimpleMove : Action + { + [Tooltip("The GameObject that the task operates on. If null the task GameObject is used.")] + public SharedGameObject targetGameObject; + [Tooltip("The speed of the movement")] + public SharedVector3 speed; + + private CharacterController characterController; + private GameObject prevGameObject; + + public override void OnStart() + { + var currentGameObject = GetDefaultGameObject(targetGameObject.Value); + if (currentGameObject != prevGameObject) { + characterController = currentGameObject.GetComponent(); + prevGameObject = currentGameObject; + } + } + + public override TaskStatus OnUpdate() + { + if (characterController == null) { + Debug.LogWarning("CharacterController is null"); + return TaskStatus.Failure; + } + + characterController.SimpleMove(speed.Value); + + return TaskStatus.Success; + } + + public override void OnReset() + { + targetGameObject = null; + speed = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SimpleMove.cs.meta b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SimpleMove.cs.meta new file mode 100644 index 00000000..f3a41a05 --- /dev/null +++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/CharacterController/SimpleMove.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c760a29b8a35c044d87b7a80a58f046c +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: -- cgit v1.1-26-g67d0