Browse Source

Fixed Playmaker compatibility issue

The Photon Networking add on for PlayMaker defines a class called
‘Room’ in the global namespace which conflicts with Fungus.Room. To fix
this, I’ve moved all Room derived example classes into the Fungus
namespace.
master
chrisgregan 11 years ago
parent
commit
927df59210
  1. 11
      Assets/Fungus/Scripts/RoomTemplate.cs
  2. 6
      Assets/FungusExample/Scripts/AudioRoom.cs
  3. 8
      Assets/FungusExample/Scripts/ButtonRoom.cs
  4. 6
      Assets/FungusExample/Scripts/MenuRoom.cs
  5. 6
      Assets/FungusExample/Scripts/PageRoom.cs
  6. 14
      Assets/FungusExample/Scripts/ParallaxRoom.cs
  7. 6
      Assets/FungusExample/Scripts/SpriteRoom.cs
  8. 6
      Assets/FungusExample/Scripts/ViewRoom.cs

11
Assets/Fungus/Scripts/RoomTemplate.cs

@ -1,8 +1,12 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using Fungus;
/** /**
* We recommend placing your room code in the Fungus namespace to avoid class name conflicts with other Unity libraries.
*/
namespace Fungus
{
/**
* This class is a template to use as a starting point for your own Room scripts. * This class is a template to use as a starting point for your own Room scripts.
* 1. Select this script in the Project window in Unity3D * 1. Select this script in the Project window in Unity3D
* 2. Choose Edit > Duplicate from the menu. A copy of the file will be created. * 2. Choose Edit > Duplicate from the menu. A copy of the file will be created.
@ -10,8 +14,8 @@ using Fungus;
* 4. Edit the script and rename the class to match the file name (e.g. public class RoomTemplate => public class DungeonRoom) * 4. Edit the script and rename the class to match the file name (e.g. public class RoomTemplate => public class DungeonRoom)
* 5. Save the script and add it as a component to your Room game object in Unity 3D. * 5. Save the script and add it as a component to your Room game object in Unity 3D.
*/ */
public class RoomTemplate : Room public class RoomTemplate : Room
{ {
// Add public properties here. // Add public properties here.
// These will appear in the inspector window in Unity so you can connect them to objects in your scene // These will appear in the inspector window in Unity so you can connect them to objects in your scene
@ -31,4 +35,5 @@ public class RoomTemplate : Room
// Add any sequence of Fungus commands you want here. // Add any sequence of Fungus commands you want here.
// See FungusExample/Scripts for examples // See FungusExample/Scripts for examples
} }
}
} }

6
Assets/FungusExample/Scripts/AudioRoom.cs

@ -1,9 +1,10 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using Fungus;
public class AudioRoom : Room namespace Fungus.Example
{ {
public class AudioRoom : Room
{
public Room menuRoom; public Room menuRoom;
public AudioClip musicClip; public AudioClip musicClip;
public AudioClip effectClip; public AudioClip effectClip;
@ -69,4 +70,5 @@ public class AudioRoom : Room
{ {
MoveToRoom(menuRoom); MoveToRoom(menuRoom);
} }
}
} }

8
Assets/FungusExample/Scripts/ButtonRoom.cs

@ -1,10 +1,11 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using Fungus;
public class ButtonRoom : Room namespace Fungus.Example
{ {
public Room menuRoom; public class ButtonRoom : Room
{
public Fungus.Room menuRoom;
public AudioClip effectClip; public AudioClip effectClip;
@ -52,4 +53,5 @@ public class ButtonRoom : Room
Say("What book was he reading?"); Say("What book was he reading?");
Say("Sadly we will never know for sure."); Say("Sadly we will never know for sure.");
} }
}
} }

6
Assets/FungusExample/Scripts/MenuRoom.cs

@ -1,9 +1,10 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using Fungus;
public class MenuRoom : Room namespace Fungus.Example
{ {
public class MenuRoom : Room
{
public Room pageRoom; public Room pageRoom;
public Room viewRoom; public Room viewRoom;
public Room spriteRoom; public Room spriteRoom;
@ -53,4 +54,5 @@ public class MenuRoom : Room
{ {
MoveToRoom(audioRoom); MoveToRoom(audioRoom);
} }
}
} }

6
Assets/FungusExample/Scripts/PageRoom.cs

@ -1,9 +1,10 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using Fungus;
public class PageRoom : Room namespace Fungus.Example
{ {
public class PageRoom : Room
{
// This is a reference to the menu room so we can transition back to the menu using MoveToRoom() // This is a reference to the menu room so we can transition back to the menu using MoveToRoom()
public Room menuRoom; public Room menuRoom;
@ -86,4 +87,5 @@ public class PageRoom : Room
Choose("What will I do now?"); Choose("What will I do now?");
} }
}
} }

14
Assets/FungusExample/Scripts/ParallaxRoom.cs

@ -1,13 +1,14 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using Fungus;
// The parallax effect is achieved by attaching a Parallax script to each sprite that requires a namespace Fungus.Example
// parallax offset. The offset is then applied automatically whenever the camera moves around the active Room.
// There is a handy parallax sprite prefab in Fungus/Prefabs/ParallaxSprite.prefab
public class ParallaxRoom : Room
{ {
// The parallax effect is achieved by attaching a Parallax script to each sprite that requires a
// parallax offset. The offset is then applied automatically whenever the camera moves around the active Room.
// There is a handy parallax sprite prefab in Fungus/Prefabs/ParallaxSprite.prefab
public class ParallaxRoom : Room
{
public View viewA; public View viewA;
public View viewB; public View viewB;
@ -35,4 +36,5 @@ public class ParallaxRoom : Room
{ {
MoveToRoom(menuRoom); MoveToRoom(menuRoom);
} }
}
} }

6
Assets/FungusExample/Scripts/SpriteRoom.cs

@ -1,9 +1,10 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using Fungus;
public class SpriteRoom : Room namespace Fungus.Example
{ {
public class SpriteRoom : Room
{
public Room menuRoom; public Room menuRoom;
public Animator blueAlienAnim; public Animator blueAlienAnim;
@ -58,4 +59,5 @@ public class SpriteRoom : Room
MoveToRoom(menuRoom); MoveToRoom(menuRoom);
} }
}
} }

6
Assets/FungusExample/Scripts/ViewRoom.cs

@ -1,9 +1,10 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
using Fungus;
public class ViewRoom : Room namespace Fungus.Example
{ {
public class ViewRoom : Room
{
public Room menuRoom; public Room menuRoom;
public View mainView; public View mainView;
@ -50,4 +51,5 @@ public class ViewRoom : Room
Say("And we're back!"); Say("And we're back!");
Call(OnEnter); Call(OnEnter);
} }
}
} }
Loading…
Cancel
Save