Browse Source

Refactored sprite comments

master
Christopher 9 years ago
parent
commit
769f0ffabb
  1. 11
      Assets/Fungus/Sprite/Scripts/Clickable2D.cs
  2. 5
      Assets/Fungus/Sprite/Scripts/Commands/FadeSprite.cs
  3. 5
      Assets/Fungus/Sprite/Scripts/Commands/SetClickable2D.cs
  4. 4
      Assets/Fungus/Sprite/Scripts/Commands/SetCollider.cs
  5. 5
      Assets/Fungus/Sprite/Scripts/Commands/SetDraggable2D.cs
  6. 5
      Assets/Fungus/Sprite/Scripts/Commands/SetLayerOrder.cs
  7. 4
      Assets/Fungus/Sprite/Scripts/Commands/SetMouseCursor.cs
  8. 4
      Assets/Fungus/Sprite/Scripts/Commands/SetSpriteOrder.cs
  9. 5
      Assets/Fungus/Sprite/Scripts/Commands/ShowSprite.cs
  10. 16
      Assets/Fungus/Sprite/Scripts/Draggable2D.cs
  11. 6
      Assets/Fungus/Sprite/Scripts/EventHandlers/DragCancelled.cs
  12. 6
      Assets/Fungus/Sprite/Scripts/EventHandlers/DragCompleted.cs
  13. 4
      Assets/Fungus/Sprite/Scripts/EventHandlers/DragEntered.cs
  14. 4
      Assets/Fungus/Sprite/Scripts/EventHandlers/DragExited.cs
  15. 6
      Assets/Fungus/Sprite/Scripts/EventHandlers/DragStarted.cs
  16. 4
      Assets/Fungus/Sprite/Scripts/EventHandlers/ObjectClicked.cs
  17. 35
      Assets/Fungus/Sprite/Scripts/Parallax.cs
  18. 14
      Assets/Fungus/Sprite/Scripts/SpriteFader.cs

11
Assets/Fungus/Sprite/Scripts/Clickable2D.cs

@ -8,16 +8,15 @@ using UnityEngine.EventSystems;
namespace Fungus namespace Fungus
{ {
/** /// <summary>
* Detects mouse clicks and touches on a Game Object, and sends an event to all Flowchart event handlers in the scene. /// Detects mouse clicks and touches on a Game Object, and sends an event to all Flowchart event handlers in the scene.
* The Game Object must have a Collider or Collider2D component attached. /// The Game Object must have a Collider or Collider2D component attached.
* Use in conjunction with the ObjectClicked Flowchart event handler. /// Use in conjunction with the ObjectClicked Flowchart event handler.
*/ /// </summary>
public class Clickable2D : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler public class Clickable2D : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
{ {
[Tooltip("Is object clicking enabled")] [Tooltip("Is object clicking enabled")]
[SerializeField] protected bool clickEnabled = true; [SerializeField] protected bool clickEnabled = true;
public bool ClickEnabled { set { clickEnabled = value; } } public bool ClickEnabled { set { clickEnabled = value; } }
[Tooltip("Mouse texture to use when hovering mouse over object")] [Tooltip("Mouse texture to use when hovering mouse over object")]

5
Assets/Fungus/Sprite/Scripts/Commands/FadeSprite.cs

@ -5,11 +5,12 @@
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization; using UnityEngine.Serialization;
using System;
using System.Collections;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// Fades a sprite to a target color over a period of time.
/// </summary>
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Fade Sprite", "Fade Sprite",
"Fades a sprite to a target color over a period of time.")] "Fades a sprite to a target color over a period of time.")]

5
Assets/Fungus/Sprite/Scripts/Commands/SetClickable2D.cs

@ -4,11 +4,12 @@
*/ */
using UnityEngine; using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// Sets a Clickable2D component to be clickable / non-clickable.
/// </summary>
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Set Clickable 2D", "Set Clickable 2D",
"Sets a Clickable2D component to be clickable / non-clickable.")] "Sets a Clickable2D component to be clickable / non-clickable.")]

4
Assets/Fungus/Sprite/Scripts/Commands/SetCollider.cs

@ -4,11 +4,13 @@
*/ */
using UnityEngine; using UnityEngine;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// Sets all collider (2d or 3d) components on the target objects to be active / inactive.
/// </summary>
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Set Collider", "Set Collider",
"Sets all collider (2d or 3d) components on the target objects to be active / inactive")] "Sets all collider (2d or 3d) components on the target objects to be active / inactive")]

5
Assets/Fungus/Sprite/Scripts/Commands/SetDraggable2D.cs

@ -4,11 +4,12 @@
*/ */
using UnityEngine; using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// Sets a Draggable2D component to be draggable / non-draggable.
/// </summary>
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Set Draggable 2D", "Set Draggable 2D",
"Sets a Draggable2D component to be draggable / non-draggable.")] "Sets a Draggable2D component to be draggable / non-draggable.")]

5
Assets/Fungus/Sprite/Scripts/Commands/SetLayerOrder.cs

@ -4,11 +4,12 @@
*/ */
using UnityEngine; using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// Sets the Renderer sorting layer of every child of a game object. Applies to all Renderers (including mesh, skinned mesh, and sprite).
/// </summary>
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Set Sorting Layer", "Set Sorting Layer",
"Sets the Renderer sorting layer of every child of a game object. Applies to all Renderers (including mesh, skinned mesh, and sprite).")] "Sets the Renderer sorting layer of every child of a game object. Applies to all Renderers (including mesh, skinned mesh, and sprite).")]

4
Assets/Fungus/Sprite/Scripts/Commands/SetMouseCursor.cs

@ -4,10 +4,12 @@
*/ */
using UnityEngine; using UnityEngine;
using System.Collections;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// Sets the mouse cursor sprite.
/// </summary>
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Set Mouse Cursor", "Set Mouse Cursor",
"Sets the mouse cursor sprite.")] "Sets the mouse cursor sprite.")]

4
Assets/Fungus/Sprite/Scripts/Commands/SetSpriteOrder.cs

@ -4,11 +4,13 @@
*/ */
using UnityEngine; using UnityEngine;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// Controls the render order of sprites by setting the Order In Layer property of a list of sprites.
/// </summary>
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Set Sprite Order", "Set Sprite Order",
"Controls the render order of sprites by setting the Order In Layer property of a list of sprites.")] "Controls the render order of sprites by setting the Order In Layer property of a list of sprites.")]

5
Assets/Fungus/Sprite/Scripts/Commands/ShowSprite.cs

@ -5,11 +5,12 @@
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization; using UnityEngine.Serialization;
using System;
using System.Collections;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// Makes a sprite visible / invisible by setting the color alpha.
/// </summary>
[CommandInfo("Sprite", [CommandInfo("Sprite",
"Show Sprite", "Show Sprite",
"Makes a sprite visible / invisible by setting the color alpha.")] "Makes a sprite visible / invisible by setting the color alpha.")]

16
Assets/Fungus/Sprite/Scripts/Draggable2D.cs

@ -10,19 +10,17 @@ using UnityEngine.Serialization;
namespace Fungus namespace Fungus
{ {
/// <summary>
/** /// Detects drag and drop interactions on a Game Object, and sends events to all Flowchart event handlers in the scene.
* Detects drag and drop interactions on a Game Object, and sends events to all Flowchart event handlers in the scene. /// The Game Object must have Collider2D & RigidBody components attached.
* The Game Object must have Collider2D & RigidBody components attached. /// The Collider2D must have the Is Trigger property set to true.
* The Collider2D must have the Is Trigger property set to true. /// The RigidBody would typically have the Is Kinematic property set to true, unless you want the object to move around using physics.
* The RigidBody would typically have the Is Kinematic property set to true, unless you want the object to move around using physics. /// Use in conjunction with the Drag Started, Drag Completed, Drag Cancelled, Drag Entered & Drag Exited event handlers.
* Use in conjunction with the Drag Started, Drag Completed, Drag Cancelled, Drag Entered & Drag Exited event handlers. /// </summary>
*/
public class Draggable2D : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerEnterHandler, IPointerExitHandler public class Draggable2D : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerEnterHandler, IPointerExitHandler
{ {
[Tooltip("Is object dragging enabled")] [Tooltip("Is object dragging enabled")]
[SerializeField] protected bool dragEnabled = true; [SerializeField] protected bool dragEnabled = true;
public bool DragEnabled { get { return dragEnabled; } set { dragEnabled = value; } } public bool DragEnabled { get { return dragEnabled; } set { dragEnabled = value; } }
[Tooltip("Move object back to its starting position when drag is cancelled")] [Tooltip("Move object back to its starting position when drag is cancelled")]

6
Assets/Fungus/Sprite/Scripts/EventHandlers/DragCancelled.cs

@ -4,12 +4,12 @@
*/ */
using UnityEngine; using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// The block will execute when the player drags an object and releases it without dropping it on a target object.
/// </summary>
[EventHandlerInfo("Sprite", [EventHandlerInfo("Sprite",
"Drag Cancelled", "Drag Cancelled",
"The block will execute when the player drags an object and releases it without dropping it on a target object.")] "The block will execute when the player drags an object and releases it without dropping it on a target object.")]

6
Assets/Fungus/Sprite/Scripts/EventHandlers/DragCompleted.cs

@ -4,12 +4,12 @@
*/ */
using UnityEngine; using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// The block will execute when the player drags an object and successfully drops it on a target object.
/// </summary>
[EventHandlerInfo("Sprite", [EventHandlerInfo("Sprite",
"Drag Completed", "Drag Completed",
"The block will execute when the player drags an object and successfully drops it on a target object.")] "The block will execute when the player drags an object and successfully drops it on a target object.")]

4
Assets/Fungus/Sprite/Scripts/EventHandlers/DragEntered.cs

@ -10,7 +10,9 @@ using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// The block will execute when the player is dragging an object which starts touching the target object.
/// </summary>
[EventHandlerInfo("Sprite", [EventHandlerInfo("Sprite",
"Drag Entered", "Drag Entered",
"The block will execute when the player is dragging an object which starts touching the target object.")] "The block will execute when the player is dragging an object which starts touching the target object.")]

4
Assets/Fungus/Sprite/Scripts/EventHandlers/DragExited.cs

@ -10,7 +10,9 @@ using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// The block will execute when the player is dragging an object which stops touching the target object.
/// </summary>
[EventHandlerInfo("Sprite", [EventHandlerInfo("Sprite",
"Drag Exited", "Drag Exited",
"The block will execute when the player is dragging an object which stops touching the target object.")] "The block will execute when the player is dragging an object which stops touching the target object.")]

6
Assets/Fungus/Sprite/Scripts/EventHandlers/DragStarted.cs

@ -4,12 +4,12 @@
*/ */
using UnityEngine; using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// The block will execute when the player starts dragging an object.
/// </summary>
[EventHandlerInfo("Sprite", [EventHandlerInfo("Sprite",
"Drag Started", "Drag Started",
"The block will execute when the player starts dragging an object.")] "The block will execute when the player starts dragging an object.")]

4
Assets/Fungus/Sprite/Scripts/EventHandlers/ObjectClicked.cs

@ -4,10 +4,12 @@
*/ */
using UnityEngine; using UnityEngine;
using System.Collections;
namespace Fungus namespace Fungus
{ {
/// <summary>
/// The block will execute when the user clicks or taps on the clickable object.
/// </summary>
[EventHandlerInfo("Sprite", [EventHandlerInfo("Sprite",
"Object Clicked", "Object Clicked",
"The block will execute when the user clicks or taps on the clickable object.")] "The block will execute when the user clicks or taps on the clickable object.")]

35
Assets/Fungus/Sprite/Scripts/Parallax.cs

@ -4,33 +4,32 @@
*/ */
using UnityEngine; using UnityEngine;
using System.Collections;
namespace Fungus namespace Fungus
{ {
/** /// <summary>
* Attach this component to a sprite object to apply a simple parallax scrolling effect. /// Attach this component to a sprite object to apply a simple parallax scrolling effect.
* The horizontal and vertical parallax offset is calculated based on the distance from the camera to the position of the background sprite. /// The horizontal and vertical parallax offset is calculated based on the distance from the camera to the position of the background sprite.
* The scale parallax is calculated based on the ratio of the camera size to the size of the background sprite. This gives a 'dolly zoom' effect. /// The scale parallax is calculated based on the ratio of the camera size to the size of the background sprite. This gives a 'dolly zoom' effect.
* Accelerometer based parallax is also applied on devices that support it. /// Accelerometer based parallax is also applied on devices that support it.
*/ /// </summary>
public class Parallax : MonoBehaviour public class Parallax : MonoBehaviour
{ {
/** /// <summary>
* The background sprite which this sprite is layered on top of. /// The background sprite which this sprite is layered on top of.
* The position of this sprite is used to calculate the parallax offset. /// The position of this sprite is used to calculate the parallax offset.
*/ /// </summary>
[SerializeField] protected SpriteRenderer backgroundSprite; [SerializeField] protected SpriteRenderer backgroundSprite;
/** /// <summary>
* Scale factor for calculating the parallax offset. /// Scale factor for calculating the parallax offset.
*/ /// </summary>
[SerializeField] protected Vector2 parallaxScale = new Vector2(0.25f, 0f); [SerializeField] protected Vector2 parallaxScale = new Vector2(0.25f, 0f);
/** /// <summary>
* Scale factor for calculating parallax offset based on device accelerometer tilt angle. /// Scale factor for calculating parallax offset based on device accelerometer tilt angle.
* Set this to 0 to disable the accelerometer parallax effect. /// Set this to 0 to disable the accelerometer parallax effect.
*/ /// </summary>
[SerializeField] protected float accelerometerScale = 0.5f; [SerializeField] protected float accelerometerScale = 0.5f;
protected Vector3 startPosition; protected Vector3 startPosition;

14
Assets/Fungus/Sprite/Scripts/SpriteFader.cs

@ -9,10 +9,10 @@ using System.Collections;
namespace Fungus namespace Fungus
{ {
/** /// <summary>
* Transitions a sprite from its current color to a target color. /// Transitions a sprite from its current color to a target color.
* An offset can be applied to slide the sprite in while changing color. /// An offset can be applied to slide the sprite in while changing color.
*/ /// </summary>
[RequireComponent (typeof (SpriteRenderer))] [RequireComponent (typeof (SpriteRenderer))]
public class SpriteFader : MonoBehaviour public class SpriteFader : MonoBehaviour
{ {
@ -27,9 +27,9 @@ namespace Fungus
protected Action onFadeComplete; protected Action onFadeComplete;
/** /// <summary>
* Attaches a SpriteFader component to a sprite object to transition its color over time. /// Attaches a SpriteFader component to a sprite object to transition its color over time.
*/ /// </summary>
public static void FadeSprite(SpriteRenderer spriteRenderer, Color targetColor, float duration, Vector2 slideOffset, Action onComplete = null) public static void FadeSprite(SpriteRenderer spriteRenderer, Color targetColor, float duration, Vector2 slideOffset, Action onComplete = null)
{ {
if (spriteRenderer == null) if (spriteRenderer == null)

Loading…
Cancel
Save