Skip to content
This repository has been archived by the owner on Jan 9, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillemsc committed Feb 20, 2021
2 parents 1aabd2d + 91c6290 commit 4a61635
Show file tree
Hide file tree
Showing 16 changed files with 413 additions and 5 deletions.
8 changes: 8 additions & 0 deletions Editor/Documentation/MonoBehaviour.meta

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.

8 changes: 4 additions & 4 deletions Runtime/Feedbacks/GameObject/GameObjectSetActiveFeedback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Juce.Feedbacks
{
[FeedbackIdentifier("SetActive", "GameObject/")]
[FeedbackIdentifier("Set Active", "GameObject/")]
public class GameObjectSetActiveFeedback : Feedback
{
[Header(FeedbackSectionsUtils.TargetSection)]
Expand All @@ -16,7 +16,7 @@ public class GameObjectSetActiveFeedback : Feedback
[Header(FeedbackSectionsUtils.TimingSection)]
[SerializeField] [Min(0)] private float delay = default;

private bool initialEnabledValue;
private bool initialActiveValue;

public GameObject Target { get => target; set => target = value; }
public bool SetActive { get => setActive; set => setActive = value; }
Expand Down Expand Up @@ -52,7 +52,7 @@ public override void OnFirstTimeExecute()
return;
}

initialEnabledValue = target.activeSelf;
initialActiveValue = target.activeSelf;
}

public override void OnReset()
Expand All @@ -62,7 +62,7 @@ public override void OnReset()
return;
}

target.SetActive(initialEnabledValue);
target.SetActive(initialActiveValue);
}

public override ExecuteResult OnExecute(FlowContext context, SequenceTween sequenceTween)
Expand Down
8 changes: 8 additions & 0 deletions Runtime/Feedbacks/MonoBehaviour.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions Runtime/Feedbacks/MonoBehaviour/MonoBehaviourDestroyFeedback.cs
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.

Loading

0 comments on commit 4a61635

Please sign in to comment.