-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Juce.Feedbacks | ||
{ | ||
internal class MonoBehaviourDestroyDocumentation : IFeedbackDocumentation | ||
{ | ||
public Type FeedbackType => typeof(MonoBehaviourDestroyFeedback); | ||
|
||
public void DrawDocumentation() | ||
{ | ||
GUILayout.Label("Destroys the target MonoBehaviour", EditorStyles.wordWrappedLabel); | ||
|
||
EditorGUILayout.Space(2); | ||
|
||
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) | ||
{ | ||
GUILayout.Label("- Target: MonoBehaviour that is going to be destroyed", EditorStyles.wordWrappedLabel); | ||
} | ||
|
||
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) | ||
{ | ||
GenericsDocumentation.DelayDocumentation(); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Juce.Feedbacks | ||
{ | ||
internal class MonoBehaviourInstantiateDocumentation : IFeedbackDocumentation | ||
{ | ||
public Type FeedbackType => typeof(MonoBehaviourInstantiateFeedback); | ||
|
||
public void DrawDocumentation() | ||
{ | ||
GUILayout.Label("Instantiates the target MonoBehaviour", EditorStyles.wordWrappedLabel); | ||
|
||
EditorGUILayout.Space(2); | ||
|
||
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) | ||
{ | ||
GUILayout.Label("- Target: MonoBehaviour that is going to be instantiated", EditorStyles.wordWrappedLabel); | ||
} | ||
|
||
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) | ||
{ | ||
GUILayout.Label("- Parent: Parent transform to set to the instantiated MonoBehaviour. Can be left to null", EditorStyles.wordWrappedLabel); | ||
GUILayout.Label("- World Position Stays: When you assign a parent MonoBehaviour, true will position the " + | ||
"new object directly in world space. False will set the MonoBehaviour’s position relative to its new parent", EditorStyles.wordWrappedLabel); | ||
} | ||
|
||
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) | ||
{ | ||
GenericsDocumentation.DelayDocumentation(); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace Juce.Feedbacks | ||
{ | ||
internal class MonoBehaviourSetEnabledDocumentation : IFeedbackDocumentation | ||
{ | ||
public Type FeedbackType => typeof(MonoBehaviourSetEnabledFeedback); | ||
|
||
public void DrawDocumentation() | ||
{ | ||
GUILayout.Label("Enables or disables the target MonoBehaviour", EditorStyles.wordWrappedLabel); | ||
|
||
EditorGUILayout.Space(2); | ||
|
||
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) | ||
{ | ||
GUILayout.Label("- Target: MonoBehaviour that is going to be enabled/disabled", EditorStyles.wordWrappedLabel); | ||
} | ||
|
||
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) | ||
{ | ||
GUILayout.Label("- Set Enabled: enables or disables the MonoBehaviour", EditorStyles.wordWrappedLabel); | ||
} | ||
|
||
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox)) | ||
{ | ||
GenericsDocumentation.DelayDocumentation(); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using Juce.Tween; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace Juce.Feedbacks | ||
{ | ||
[FeedbackIdentifier("Destroy", "MonoBehaviour/")] | ||
public class MonoBehaviourDestroyFeedback : Feedback | ||
{ | ||
[Header(FeedbackSectionsUtils.TargetSection)] | ||
[SerializeField] private MonoBehaviour target = default; | ||
|
||
[Header(FeedbackSectionsUtils.TimingSection)] | ||
[SerializeField] [Min(0)] private float delay = default; | ||
|
||
public MonoBehaviour Target { get => target; set => target = value; } | ||
public float Delay { get => delay; set => delay = Mathf.Max(0, value); } | ||
|
||
public override bool GetFeedbackErrors(out string errors) | ||
{ | ||
if (target == null) | ||
{ | ||
errors = ErrorUtils.TargetNullErrorMessage; | ||
return true; | ||
} | ||
|
||
errors = string.Empty; | ||
return false; | ||
} | ||
|
||
public override string GetFeedbackTargetInfo() | ||
{ | ||
return target != null ? target.gameObject.name : string.Empty; | ||
} | ||
|
||
public override void GetFeedbackInfo(ref List<string> infoList) | ||
{ | ||
InfoUtils.GetTimingInfo(ref infoList, delay); | ||
} | ||
|
||
public override ExecuteResult OnExecute(FlowContext context, SequenceTween sequenceTween) | ||
{ | ||
if (target == null) | ||
{ | ||
return null; | ||
} | ||
|
||
Tween.Tween delayTween = null; | ||
|
||
if (delay > 0) | ||
{ | ||
delayTween = new WaitTimeTween(delay); | ||
sequenceTween.Append(delayTween); | ||
} | ||
|
||
sequenceTween.AppendCallback(() => | ||
{ | ||
MonoBehaviour.Destroy(target); | ||
}); | ||
|
||
ExecuteResult result = new ExecuteResult(); | ||
result.DelayTween = delayTween; | ||
|
||
return result; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using Juce.Tween; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace Juce.Feedbacks | ||
{ | ||
[FeedbackIdentifier("Instantiate", "MonoBehaviour/")] | ||
public class MonoBehaviourInstantiateFeedback : Feedback | ||
{ | ||
[Header(FeedbackSectionsUtils.TargetSection)] | ||
[SerializeField] private MonoBehaviour target = default; | ||
|
||
[Header(FeedbackSectionsUtils.ValuesSection)] | ||
[SerializeField] private Transform parent = default; | ||
|
||
[SerializeField] private bool worldPositionStays = default; | ||
|
||
[Header(FeedbackSectionsUtils.TimingSection)] | ||
[SerializeField] [Min(0)] private float delay = default; | ||
|
||
public MonoBehaviour Target { get => target; set => target = value; } | ||
public float Delay { get => delay; set => delay = Mathf.Max(0, value); } | ||
|
||
public override bool GetFeedbackErrors(out string errors) | ||
{ | ||
if (target == null) | ||
{ | ||
errors = ErrorUtils.TargetNullErrorMessage; | ||
return true; | ||
} | ||
|
||
errors = string.Empty; | ||
return false; | ||
} | ||
|
||
public override string GetFeedbackTargetInfo() | ||
{ | ||
return target != null ? target.gameObject.name : string.Empty; | ||
} | ||
|
||
public override void GetFeedbackInfo(ref List<string> infoList) | ||
{ | ||
InfoUtils.GetTimingInfo(ref infoList, delay); | ||
} | ||
|
||
public override ExecuteResult OnExecute(FlowContext context, SequenceTween sequenceTween) | ||
{ | ||
if (target == null) | ||
{ | ||
return null; | ||
} | ||
|
||
Tween.Tween delayTween = null; | ||
|
||
if (delay > 0) | ||
{ | ||
delayTween = new WaitTimeTween(delay); | ||
sequenceTween.Append(delayTween); | ||
} | ||
|
||
sequenceTween.AppendCallback(() => | ||
{ | ||
MonoBehaviour.Instantiate(target, parent, worldPositionStays); | ||
}); | ||
|
||
ExecuteResult result = new ExecuteResult(); | ||
result.DelayTween = delayTween; | ||
|
||
return result; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.