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
{
/**
* 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.
* Use in conjunction with the ObjectClicked Flowchart event handler.
*/
/// <summary>
/// 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.
/// Use in conjunction with the ObjectClicked Flowchart event handler.
/// </summary>
public class Clickable2D : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
{
[Tooltip("Is object clicking enabled")]
[SerializeField] protected bool clickEnabled = true;
public bool ClickEnabled { set { clickEnabled = value; } }
[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.Serialization;
using System;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Fades a sprite to a target color over a period of time.
/// </summary>
[CommandInfo("Sprite",
"Fade Sprite",
"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 System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Sets a Clickable2D component to be clickable / non-clickable.
/// </summary>
[CommandInfo("Sprite",
"Set Clickable 2D",
"Sets a Clickable2D component to be clickable / non-clickable.")]

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

@ -4,11 +4,13 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Sets all collider (2d or 3d) components on the target objects to be active / inactive.
/// </summary>
[CommandInfo("Sprite",
"Set Collider",
"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 System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Sets a Draggable2D component to be draggable / non-draggable.
/// </summary>
[CommandInfo("Sprite",
"Set Draggable 2D",
"Sets a Draggable2D component to be draggable / non-draggable.")]

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

@ -4,11 +4,12 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
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",
"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).")]

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

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

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

@ -4,11 +4,13 @@
*/
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// Controls the render order of sprites by setting the Order In Layer property of a list of sprites.
/// </summary>
[CommandInfo("Sprite",
"Set Sprite Order",
"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.Serialization;
using System;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Makes a sprite visible / invisible by setting the color alpha.
/// </summary>
[CommandInfo("Sprite",
"Show Sprite",
"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
{
/**
* 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 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.
* Use in conjunction with the Drag Started, Drag Completed, Drag Cancelled, Drag Entered & Drag Exited event handlers.
*/
/// <summary>
/// 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 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.
/// 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
{
[Tooltip("Is object dragging enabled")]
[SerializeField] protected bool dragEnabled = true;
public bool DragEnabled { get { return dragEnabled; } set { dragEnabled = value; } }
[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 System;
using System.Collections;
using System.Collections.Generic;
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",
"Drag Cancelled",
"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 System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// The block will execute when the player drags an object and successfully drops it on a target object.
/// </summary>
[EventHandlerInfo("Sprite",
"Drag Completed",
"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
{
/// <summary>
/// The block will execute when the player is dragging an object which starts touching the target object.
/// </summary>
[EventHandlerInfo("Sprite",
"Drag Entered",
"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
{
/// <summary>
/// The block will execute when the player is dragging an object which stops touching the target object.
/// </summary>
[EventHandlerInfo("Sprite",
"Drag Exited",
"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 System;
using System.Collections;
using System.Collections.Generic;
namespace Fungus
{
/// <summary>
/// The block will execute when the player starts dragging an object.
/// </summary>
[EventHandlerInfo("Sprite",
"Drag Started",
"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 System.Collections;
namespace Fungus
{
/// <summary>
/// The block will execute when the user clicks or taps on the clickable object.
/// </summary>
[EventHandlerInfo("Sprite",
"Object Clicked",
"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 System.Collections;
namespace Fungus
{
/**
* 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 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.
*/
/// <summary>
/// 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 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.
/// </summary>
public class Parallax : MonoBehaviour
{
/**
* The background sprite which this sprite is layered on top of.
* The position of this sprite is used to calculate the parallax offset.
*/
/// <summary>
/// The background sprite which this sprite is layered on top of.
/// The position of this sprite is used to calculate the parallax offset.
/// </summary>
[SerializeField] protected SpriteRenderer backgroundSprite;
/**
* Scale factor for calculating the parallax offset.
*/
/// <summary>
/// Scale factor for calculating the parallax offset.
/// </summary>
[SerializeField] protected Vector2 parallaxScale = new Vector2(0.25f, 0f);
/**
* Scale factor for calculating parallax offset based on device accelerometer tilt angle.
* Set this to 0 to disable the accelerometer parallax effect.
*/
/// <summary>
/// Scale factor for calculating parallax offset based on device accelerometer tilt angle.
/// Set this to 0 to disable the accelerometer parallax effect.
/// </summary>
[SerializeField] protected float accelerometerScale = 0.5f;
protected Vector3 startPosition;

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

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

Loading…
Cancel
Save