Browse Source

Added simple clickable sprite script & prefab

master
chrisgregan 10 years ago
parent
commit
d50121506e
  1. BIN
      Assets/Fungus/Dialog/Prefabs/Character.prefab
  2. 9
      Assets/Fungus/Sprite/Editor/SpriteMenuItems.cs
  3. BIN
      Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab
  4. 4
      Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab.meta
  5. BIN
      Assets/Fungus/Sprite/Prefabs/ParallaxSprite.prefab
  6. 18
      Assets/Fungus/Sprite/Scripts/ClickableSprite.cs
  7. 8
      Assets/Fungus/Sprite/Scripts/ClickableSprite.cs.meta

BIN
Assets/Fungus/Dialog/Prefabs/Character.prefab

Binary file not shown.

9
Assets/Fungus/Sprite/Editor/SpriteMenuItems.cs

@ -7,13 +7,18 @@ namespace Fungus
public class SpriteMenuItems
{
[MenuItem("GameObject/Fungus/Sprite/ParallaxSprite")]
static void CreateBackground()
static void CreateParallaxSprite()
{
InstantiatePrefab("ParallaxSprite");
}
[MenuItem("GameObject/Fungus/Sprite/ClickableSprite")]
static void CreateClickableSprite()
{
InstantiatePrefab("ClickableSprite");
}
static void InstantiatePrefab(string prefabName)
{
GameObject prefab = Resources.LoadAssetAtPath("Assets/Fungus/Sprite/Prefabs/" + prefabName + ".prefab", typeof(GameObject)) as GameObject;

BIN
Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab

Binary file not shown.

4
Assets/Fungus/Sprite/Prefabs/ClickableSprite.prefab.meta

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 7dd53f3f0a79d441fb32e055767a1b17
NativeFormatImporter:
userData:

BIN
Assets/Fungus/Sprite/Prefabs/ParallaxSprite.prefab

Binary file not shown.

18
Assets/Fungus/Sprite/Scripts/ClickableSprite.cs

@ -0,0 +1,18 @@
using UnityEngine;
using UnityEngine.Events;
using System.Collections;
namespace Fungus
{
public class ClickableSprite : MonoBehaviour
{
public UnityEvent onSpriteClick;
void OnMouseDown()
{
onSpriteClick.Invoke();
}
}
}

8
Assets/Fungus/Sprite/Scripts/ClickableSprite.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cc03961113fa349c09cb06ef2911013d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
Loading…
Cancel
Save