Browse Source
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
8 changed files with 363 additions and 344 deletions
@ -1,34 +1,39 @@ |
|||||||
using UnityEngine; |
using UnityEngine; |
||||||
using System.Collections; |
using System.Collections; |
||||||
using Fungus; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* This class is a template to use as a starting point for your own Room scripts. |
* We recommend placing your room code in the Fungus namespace to avoid class name conflicts with other Unity libraries. |
||||||
* 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. |
|
||||||
* 3. Rename the file to match the name of your room (e.g. 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. |
|
||||||
*/ |
*/ |
||||||
public class RoomTemplate : Room |
namespace Fungus |
||||||
{ |
{ |
||||||
// Add public properties here. |
|
||||||
// These will appear in the inspector window in Unity so you can connect them to objects in your scene |
|
||||||
|
|
||||||
// Some common examples: |
|
||||||
// public View mainView; |
|
||||||
// public Page dialogPage; |
|
||||||
// public Room otherRoom; |
|
||||||
// public SpriteRenderer characterSprite; |
|
||||||
// public Animator characterAnim; |
|
||||||
// public AudioClip musicClip; |
|
||||||
|
|
||||||
/** |
/** |
||||||
* OnEnter() is always called when the player enters the room |
* 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 |
||||||
|
* 2. Choose Edit > Duplicate from the menu. A copy of the file will be created. |
||||||
|
* 3. Rename the file to match the name of your room (e.g. 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. |
||||||
*/ |
*/ |
||||||
void OnEnter() |
public class RoomTemplate : Room |
||||||
{ |
{ |
||||||
// Add any sequence of Fungus commands you want here. |
// Add public properties here. |
||||||
// See FungusExample/Scripts for examples |
// These will appear in the inspector window in Unity so you can connect them to objects in your scene |
||||||
|
|
||||||
|
// Some common examples: |
||||||
|
// public View mainView; |
||||||
|
// public Page dialogPage; |
||||||
|
// public Room otherRoom; |
||||||
|
// public SpriteRenderer characterSprite; |
||||||
|
// public Animator characterAnim; |
||||||
|
// public AudioClip musicClip; |
||||||
|
|
||||||
|
/** |
||||||
|
* OnEnter() is always called when the player enters the room |
||||||
|
*/ |
||||||
|
void OnEnter() |
||||||
|
{ |
||||||
|
// Add any sequence of Fungus commands you want here. |
||||||
|
// See FungusExample/Scripts for examples |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,72 +1,74 @@ |
|||||||
using UnityEngine; |
using UnityEngine; |
||||||
using System.Collections; |
using System.Collections; |
||||||
using Fungus; |
|
||||||
|
|
||||||
public class AudioRoom : Room |
namespace Fungus.Example |
||||||
{ |
{ |
||||||
public Room menuRoom; |
public class AudioRoom : Room |
||||||
public AudioClip musicClip; |
|
||||||
public AudioClip effectClip; |
|
||||||
|
|
||||||
void OnEnter() |
|
||||||
{ |
{ |
||||||
if (HasValue("music")) |
public Room menuRoom; |
||||||
|
public AudioClip musicClip; |
||||||
|
public AudioClip effectClip; |
||||||
|
|
||||||
|
void OnEnter() |
||||||
{ |
{ |
||||||
AddOption("Stop the music", StopGameMusic); |
if (HasValue("music")) |
||||||
|
{ |
||||||
|
AddOption("Stop the music", StopGameMusic); |
||||||
|
|
||||||
|
if (HasValue("quiet") == false) |
||||||
|
{ |
||||||
|
AddOption("Shhh! Make it quieter", MakeQuiet); |
||||||
|
} |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
AddOption("Play some music", StartGameMusic); |
||||||
|
} |
||||||
|
AddOption("Play a sound effect", PlaySound); |
||||||
|
AddOption("Back to menu", MainMenu); |
||||||
|
|
||||||
if (HasValue("quiet") == false) |
if (IsFirstVisit()) |
||||||
{ |
{ |
||||||
AddOption("Shhh! Make it quieter", MakeQuiet); |
Choose("We are the music makers, and we are the dreamers of dreams."); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Choose(); |
||||||
} |
} |
||||||
} |
} |
||||||
else |
|
||||||
|
void StartGameMusic() |
||||||
{ |
{ |
||||||
AddOption("Play some music", StartGameMusic); |
PlayMusic(musicClip); |
||||||
|
SetMusicVolume(1f); |
||||||
|
SetValue("music"); |
||||||
|
Call(OnEnter); |
||||||
} |
} |
||||||
AddOption("Play a sound effect", PlaySound); |
|
||||||
AddOption("Back to menu", MainMenu); |
|
||||||
|
|
||||||
if (IsFirstVisit()) |
void StopGameMusic() |
||||||
{ |
{ |
||||||
Choose("We are the music makers, and we are the dreamers of dreams."); |
StopMusic(); |
||||||
|
ClearValue("music"); |
||||||
|
ClearValue("quiet"); |
||||||
|
Call(OnEnter); |
||||||
} |
} |
||||||
else |
|
||||||
|
void PlaySound() |
||||||
{ |
{ |
||||||
Choose(); |
PlaySound(effectClip, 1f); |
||||||
|
Call(OnEnter); |
||||||
} |
} |
||||||
} |
|
||||||
|
|
||||||
void StartGameMusic() |
|
||||||
{ |
|
||||||
PlayMusic(musicClip); |
|
||||||
SetMusicVolume(1f); |
|
||||||
SetValue("music"); |
|
||||||
Call(OnEnter); |
|
||||||
} |
|
||||||
|
|
||||||
void StopGameMusic() |
|
||||||
{ |
|
||||||
StopMusic(); |
|
||||||
ClearValue("music"); |
|
||||||
ClearValue("quiet"); |
|
||||||
Call(OnEnter); |
|
||||||
} |
|
||||||
|
|
||||||
void PlaySound() |
|
||||||
{ |
|
||||||
PlaySound(effectClip, 1f); |
|
||||||
Call(OnEnter); |
|
||||||
} |
|
||||||
|
|
||||||
void MakeQuiet() |
void MakeQuiet() |
||||||
{ |
{ |
||||||
SetValue("quiet"); |
SetValue("quiet"); |
||||||
SetMusicVolume(0.25f, 1f); |
SetMusicVolume(0.25f, 1f); |
||||||
Call(OnEnter); |
Call(OnEnter); |
||||||
} |
} |
||||||
|
|
||||||
void MainMenu() |
void MainMenu() |
||||||
{ |
{ |
||||||
MoveToRoom(menuRoom); |
MoveToRoom(menuRoom); |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,55 +1,57 @@ |
|||||||
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; |
||||||
|
|
||||||
public Button homeButton; |
public Button homeButton; |
||||||
public Button soundButton; |
public Button soundButton; |
||||||
public Button questionButton; |
public Button questionButton; |
||||||
|
|
||||||
void OnEnter() |
void OnEnter() |
||||||
{ |
{ |
||||||
// Show button, always visible (because autoHide is set to false) |
// Show button, always visible (because autoHide is set to false) |
||||||
ShowButton(homeButton, OnHomeClicked); |
ShowButton(homeButton, OnHomeClicked); |
||||||
|
|
||||||
// Show buttons, auto hides when text is displayed (because autoHide is set to true) |
// Show buttons, auto hides when text is displayed (because autoHide is set to true) |
||||||
ShowButton(soundButton, OnMusicClicked); |
ShowButton(soundButton, OnMusicClicked); |
||||||
ShowButton(questionButton, OnQuestionClicked); |
ShowButton(questionButton, OnQuestionClicked); |
||||||
|
|
||||||
Say("The Mushroom read his book with great interest."); |
Say("The Mushroom read his book with great interest."); |
||||||
Say("After turning the last page, he considered his options."); |
Say("After turning the last page, he considered his options."); |
||||||
|
|
||||||
// Uncomment this line to make the player tap the screen before showing the buttons |
// Uncomment this line to make the player tap the screen before showing the buttons |
||||||
// WaitForInput(); |
// WaitForInput(); |
||||||
|
|
||||||
// Once the last Say command executes the page will dissappear because there's no more content to show. |
// Once the last Say command executes the page will dissappear because there's no more content to show. |
||||||
// At that point, the game will automatically fade in all Auto Buttons in the room |
// At that point, the game will automatically fade in all Auto Buttons in the room |
||||||
} |
} |
||||||
|
|
||||||
void OnHomeClicked() |
void OnHomeClicked() |
||||||
{ |
{ |
||||||
MoveToRoom(menuRoom); |
MoveToRoom(menuRoom); |
||||||
} |
} |
||||||
|
|
||||||
void OnMusicClicked() |
void OnMusicClicked() |
||||||
{ |
{ |
||||||
PlaySound(effectClip); |
PlaySound(effectClip); |
||||||
|
|
||||||
// The music button has been configured to automatically hide when this value is set |
// The music button has been configured to automatically hide when this value is set |
||||||
SetValue("PlayedSound"); |
SetValue("PlayedSound"); |
||||||
} |
} |
||||||
|
|
||||||
void OnQuestionClicked() |
void OnQuestionClicked() |
||||||
{ |
{ |
||||||
// Set the Button.autoHide property to automatically hide buttons when displaying page text/options or waiting |
// Set the Button.autoHide property to automatically hide buttons when displaying page text/options or waiting |
||||||
// The Question and Sound buttons have the Auto Hide property set, but the Home button does not. |
// The Question and Sound buttons have the Auto Hide property set, but the Home button does not. |
||||||
|
|
||||||
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."); |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,56 +1,58 @@ |
|||||||
using UnityEngine; |
using UnityEngine; |
||||||
using System.Collections; |
using System.Collections; |
||||||
using Fungus; |
|
||||||
|
|
||||||
public class MenuRoom : Room |
namespace Fungus.Example |
||||||
{ |
{ |
||||||
public Room pageRoom; |
public class MenuRoom : Room |
||||||
public Room viewRoom; |
|
||||||
public Room spriteRoom; |
|
||||||
public Room parallaxRoom; |
|
||||||
public Room buttonRoom; |
|
||||||
public Room audioRoom; |
|
||||||
|
|
||||||
void OnEnter() |
|
||||||
{ |
{ |
||||||
SetPageMiddle(); |
public Room pageRoom; |
||||||
|
public Room viewRoom; |
||||||
AddOption("Writing a story with Pages", MoveToWritingRoom); |
public Room spriteRoom; |
||||||
AddOption("Controlling the camera with Views", MoveToViewRoom); |
public Room parallaxRoom; |
||||||
AddOption("Sprites and Animations", MoveToSpriteRoom); |
public Room buttonRoom; |
||||||
AddOption("Swipe panning and parallax", MoveToParallaxRoom); |
public Room audioRoom; |
||||||
AddOption("Using Buttons", MoveToButtonsRoom); |
|
||||||
AddOption("Playing music and sound effects", MoveToAudioRoom); |
void OnEnter() |
||||||
Choose("Choose an example"); |
{ |
||||||
} |
SetPageMiddle(); |
||||||
|
|
||||||
void MoveToWritingRoom() |
AddOption("Writing a story with Pages", MoveToWritingRoom); |
||||||
{ |
AddOption("Controlling the camera with Views", MoveToViewRoom); |
||||||
MoveToRoom(pageRoom); |
AddOption("Sprites and Animations", MoveToSpriteRoom); |
||||||
} |
AddOption("Swipe panning and parallax", MoveToParallaxRoom); |
||||||
|
AddOption("Using Buttons", MoveToButtonsRoom); |
||||||
void MoveToViewRoom() |
AddOption("Playing music and sound effects", MoveToAudioRoom); |
||||||
{ |
Choose("Choose an example"); |
||||||
MoveToRoom(viewRoom); |
} |
||||||
} |
|
||||||
|
void MoveToWritingRoom() |
||||||
void MoveToSpriteRoom() |
{ |
||||||
{ |
MoveToRoom(pageRoom); |
||||||
MoveToRoom(spriteRoom); |
} |
||||||
} |
|
||||||
|
void MoveToViewRoom() |
||||||
void MoveToParallaxRoom() |
{ |
||||||
{ |
MoveToRoom(viewRoom); |
||||||
MoveToRoom(parallaxRoom); |
} |
||||||
} |
|
||||||
|
void MoveToSpriteRoom() |
||||||
void MoveToButtonsRoom() |
{ |
||||||
{ |
MoveToRoom(spriteRoom); |
||||||
MoveToRoom(buttonRoom); |
} |
||||||
} |
|
||||||
|
void MoveToParallaxRoom() |
||||||
void MoveToAudioRoom() |
{ |
||||||
{ |
MoveToRoom(parallaxRoom); |
||||||
MoveToRoom(audioRoom); |
} |
||||||
|
|
||||||
|
void MoveToButtonsRoom() |
||||||
|
{ |
||||||
|
MoveToRoom(buttonRoom); |
||||||
|
} |
||||||
|
|
||||||
|
void MoveToAudioRoom() |
||||||
|
{ |
||||||
|
MoveToRoom(audioRoom); |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,89 +1,91 @@ |
|||||||
using UnityEngine; |
using UnityEngine; |
||||||
using System.Collections; |
using System.Collections; |
||||||
using Fungus; |
|
||||||
|
|
||||||
public class PageRoom : Room |
namespace Fungus.Example |
||||||
{ |
{ |
||||||
// This is a reference to the menu room so we can transition back to the menu using MoveToRoom() |
public class PageRoom : Room |
||||||
public Room menuRoom; |
|
||||||
|
|
||||||
// References to PageStyle prefab assets |
|
||||||
// Use these with SetPageStyle() to change the Page rendering style |
|
||||||
public PageStyle defaultStyle; |
|
||||||
public PageStyle alternateStyle; |
|
||||||
|
|
||||||
// The OnEnter() method is called whenever the player enters the room |
|
||||||
void OnEnter() |
|
||||||
{ |
{ |
||||||
// Sets the header text on the page |
// This is a reference to the menu room so we can transition back to the menu using MoveToRoom() |
||||||
SetHeader("The Mushroom"); |
public Room menuRoom; |
||||||
|
|
||||||
// Each Say() command writes one line of text, followed by a continue button |
// References to PageStyle prefab assets |
||||||
Say("One day in the forest, a mushroom grew."); |
// Use these with SetPageStyle() to change the Page rendering style |
||||||
Say("What am I doing here he wondered?"); |
public PageStyle defaultStyle; |
||||||
|
public PageStyle alternateStyle; |
||||||
|
|
||||||
SetPageTop(); |
// The OnEnter() method is called whenever the player enters the room |
||||||
Say("I think I will wait for a while and see if something happens."); |
void OnEnter() |
||||||
|
{ |
||||||
|
// Sets the header text on the page |
||||||
|
SetHeader("The Mushroom"); |
||||||
|
|
||||||
// Wait for a few seconds |
// Each Say() command writes one line of text, followed by a continue button |
||||||
Wait(3); |
Say("One day in the forest, a mushroom grew."); |
||||||
|
Say("What am I doing here he wondered?"); |
||||||
|
|
||||||
// Set the header text to the empty string to remove the page title |
SetPageTop(); |
||||||
SetHeader(""); |
Say("I think I will wait for a while and see if something happens."); |
||||||
|
|
||||||
SetPageBottom(); |
// Wait for a few seconds |
||||||
Say("..."); |
Wait(3); |
||||||
Say("Hmmm. Nothing seems to be happening."); |
|
||||||
|
|
||||||
// Add a couple of user options |
// Set the header text to the empty string to remove the page title |
||||||
// The first parameter is the option text |
SetHeader(""); |
||||||
// The second parameter is the method to call if the user selects the option |
|
||||||
// You can add as many options as you like |
|
||||||
AddOption("Go to sleep", GoToSleep); |
|
||||||
AddOption("Produce spores", ProduceSpores); |
|
||||||
|
|
||||||
// Display all the previously added options, with a text prompt |
SetPageBottom(); |
||||||
Choose("Whatever will I do?"); |
Say("..."); |
||||||
} |
Say("Hmmm. Nothing seems to be happening."); |
||||||
|
|
||||||
void GoToSleep() |
// Add a couple of user options |
||||||
{ |
// The first parameter is the option text |
||||||
// Check to see if a game value has been set |
// The second parameter is the method to call if the user selects the option |
||||||
if (HasValue("spawned")) |
// You can add as many options as you like |
||||||
{ |
AddOption("Go to sleep", GoToSleep); |
||||||
Say("I am feeling rather sleepy after all that spawning!"); |
AddOption("Produce spores", ProduceSpores); |
||||||
Say("Yawn! Good night world!"); |
|
||||||
|
|
||||||
// Leave the current room and enter the menu room |
// Display all the previously added options, with a text prompt |
||||||
MoveToRoom(menuRoom); |
Choose("Whatever will I do?"); |
||||||
} |
} |
||||||
else |
|
||||||
{ |
|
||||||
Say("I'm not feeling tired. I'm a fresh mushroom!"); |
|
||||||
Say("Maybe I should spawn some spores?"); |
|
||||||
|
|
||||||
// Use Call() to call another method whenever you want. |
void GoToSleep() |
||||||
Call(ProduceSpores); |
{ |
||||||
|
// Check to see if a game value has been set |
||||||
|
if (HasValue("spawned")) |
||||||
|
{ |
||||||
|
Say("I am feeling rather sleepy after all that spawning!"); |
||||||
|
Say("Yawn! Good night world!"); |
||||||
|
|
||||||
|
// Leave the current room and enter the menu room |
||||||
|
MoveToRoom(menuRoom); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Say("I'm not feeling tired. I'm a fresh mushroom!"); |
||||||
|
Say("Maybe I should spawn some spores?"); |
||||||
|
|
||||||
|
// Use Call() to call another method whenever you want. |
||||||
|
Call(ProduceSpores); |
||||||
|
} |
||||||
} |
} |
||||||
} |
|
||||||
|
|
||||||
void ProduceSpores() |
void ProduceSpores() |
||||||
{ |
{ |
||||||
// Set a PageStyle with no background box texture |
// Set a PageStyle with no background box texture |
||||||
SetPageStyle(alternateStyle); |
SetPageStyle(alternateStyle); |
||||||
|
|
||||||
Say("Yeah! I feel like doing some sporing!"); |
Say("Yeah! I feel like doing some sporing!"); |
||||||
Say("Wow - look at all these spores! COOL!"); |
Say("Wow - look at all these spores! COOL!"); |
||||||
|
|
||||||
// Set the default style with background box texture |
// Set the default style with background box texture |
||||||
SetPageStyle(defaultStyle); |
SetPageStyle(defaultStyle); |
||||||
|
|
||||||
// Sets a global value flag which we check above in GoToSleep |
// Sets a global value flag which we check above in GoToSleep |
||||||
SetValue("spawned"); |
SetValue("spawned"); |
||||||
|
|
||||||
AddOption("So tired. I sleep now.", GoToSleep); |
AddOption("So tired. I sleep now.", GoToSleep); |
||||||
AddOption("No way! More spores!", ProduceSpores); |
AddOption("No way! More spores!", ProduceSpores); |
||||||
|
|
||||||
Choose("What will I do now?"); |
Choose("What will I do now?"); |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,38 +1,40 @@ |
|||||||
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 |
|
||||||
{ |
{ |
||||||
public View viewA; |
// The parallax effect is achieved by attaching a Parallax script to each sprite that requires a |
||||||
public View viewB; |
// 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 Button menuButton; |
public class ParallaxRoom : Room |
||||||
|
{ |
||||||
|
public View viewA; |
||||||
|
public View viewB; |
||||||
|
|
||||||
public Room menuRoom; |
public Button menuButton; |
||||||
|
|
||||||
void OnEnter() |
public Room menuRoom; |
||||||
{ |
|
||||||
SetView(viewA); |
|
||||||
|
|
||||||
Say("Let's move the camera!"); |
void OnEnter() |
||||||
PanToView(viewB, 2); |
{ |
||||||
Say("Oooh! Nice parallax!"); |
SetView(viewA); |
||||||
PanToView(viewA, 2); |
|
||||||
Say("Now you have a go!"); |
|
||||||
Say("Swipe the screen to pan around."); |
|
||||||
|
|
||||||
ShowButton(menuButton, OnHomeButtonClicked); |
Say("Let's move the camera!"); |
||||||
|
PanToView(viewB, 2); |
||||||
|
Say("Oooh! Nice parallax!"); |
||||||
|
PanToView(viewA, 2); |
||||||
|
Say("Now you have a go!"); |
||||||
|
Say("Swipe the screen to pan around."); |
||||||
|
|
||||||
StartSwipePan(viewA, viewB, 0f); |
ShowButton(menuButton, OnHomeButtonClicked); |
||||||
} |
|
||||||
|
|
||||||
void OnHomeButtonClicked() |
StartSwipePan(viewA, viewB, 0f); |
||||||
{ |
} |
||||||
MoveToRoom(menuRoom); |
|
||||||
|
void OnHomeButtonClicked() |
||||||
|
{ |
||||||
|
MoveToRoom(menuRoom); |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
@ -1,61 +1,63 @@ |
|||||||
using UnityEngine; |
using UnityEngine; |
||||||
using System.Collections; |
using System.Collections; |
||||||
using Fungus; |
|
||||||
|
|
||||||
public class SpriteRoom : Room |
namespace Fungus.Example |
||||||
{ |
{ |
||||||
public Room menuRoom; |
public class SpriteRoom : Room |
||||||
|
{ |
||||||
|
public Room menuRoom; |
||||||
|
|
||||||
public Animator blueAlienAnim; |
public Animator blueAlienAnim; |
||||||
public SpriteRenderer blueAlienSprite; |
public SpriteRenderer blueAlienSprite; |
||||||
public SpriteRenderer redMushroomSprite; |
public SpriteRenderer redMushroomSprite; |
||||||
|
|
||||||
void OnEnter() |
void OnEnter() |
||||||
{ |
{ |
||||||
HideSprite(redMushroomSprite); |
HideSprite(redMushroomSprite); |
||||||
|
|
||||||
ShowSprite(blueAlienSprite); |
ShowSprite(blueAlienSprite); |
||||||
|
|
||||||
Say("Pink Alien says to Blue Alien..."); |
Say("Pink Alien says to Blue Alien..."); |
||||||
Say("...'Show me your funky moves!'"); |
Say("...'Show me your funky moves!'"); |
||||||
|
|
||||||
SetAnimatorTrigger(blueAlienAnim, "StartBlueWalk"); |
SetAnimatorTrigger(blueAlienAnim, "StartBlueWalk"); |
||||||
|
|
||||||
Say("Blue Alien starts to dance."); |
Say("Blue Alien starts to dance."); |
||||||
|
|
||||||
Wait(4); |
Wait(4); |
||||||
|
|
||||||
SetAnimatorTrigger(blueAlienAnim, "Stop"); |
SetAnimatorTrigger(blueAlienAnim, "Stop"); |
||||||
|
|
||||||
Say("Nice moves there Blue Alien!"); |
Say("Nice moves there Blue Alien!"); |
||||||
|
|
||||||
FadeSprite(redMushroomSprite, 1f, 1f); |
FadeSprite(redMushroomSprite, 1f, 1f); |
||||||
|
|
||||||
Say("Maybe you want a nice mushroom to sit down on?"); |
Say("Maybe you want a nice mushroom to sit down on?"); |
||||||
Say("Don't want to sit? Ok, no problem."); |
Say("Don't want to sit? Ok, no problem."); |
||||||
|
|
||||||
FadeSprite(redMushroomSprite, 0f, 1f); |
FadeSprite(redMushroomSprite, 0f, 1f); |
||||||
|
|
||||||
Say("Uh oh, you look like you're turning a little green after all that dancing!"); |
Say("Uh oh, you look like you're turning a little green after all that dancing!"); |
||||||
|
|
||||||
SetAnimatorTrigger(blueAlienAnim, "StartGreenWalk"); |
SetAnimatorTrigger(blueAlienAnim, "StartGreenWalk"); |
||||||
|
|
||||||
Say("Never mind, you'll feel better soon!"); |
Say("Never mind, you'll feel better soon!"); |
||||||
} |
} |
||||||
|
|
||||||
// This method is called by the Animation Event Listener component on the blue alien. |
// This method is called by the Animation Event Listener component on the blue alien. |
||||||
// When the GreenAlienWalk animation finishes it fires an event which calls this method. |
// When the GreenAlienWalk animation finishes it fires an event which calls this method. |
||||||
void AlienAnimationFinished() |
void AlienAnimationFinished() |
||||||
{ |
{ |
||||||
SetAnimatorTrigger(blueAlienAnim, "Stop"); |
SetAnimatorTrigger(blueAlienAnim, "Stop"); |
||||||
|
|
||||||
Say("Well done Blue Alien! Time to say goodbye!"); |
Say("Well done Blue Alien! Time to say goodbye!"); |
||||||
|
|
||||||
FadeSprite(blueAlienSprite, 0, 1f); |
FadeSprite(blueAlienSprite, 0, 1f); |
||||||
Wait(1f); |
Wait(1f); |
||||||
|
|
||||||
Say("Heh. That Blue Alien - what a guy!"); |
Say("Heh. That Blue Alien - what a guy!"); |
||||||
|
|
||||||
MoveToRoom(menuRoom); |
MoveToRoom(menuRoom); |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,53 +1,55 @@ |
|||||||
using UnityEngine; |
using UnityEngine; |
||||||
using System.Collections; |
using System.Collections; |
||||||
using Fungus; |
|
||||||
|
|
||||||
public class ViewRoom : Room |
namespace Fungus.Example |
||||||
{ |
{ |
||||||
public Room menuRoom; |
public class ViewRoom : Room |
||||||
|
|
||||||
public View mainView; |
|
||||||
public View logoView; |
|
||||||
public View toadstoolView; |
|
||||||
|
|
||||||
void OnEnter() |
|
||||||
{ |
|
||||||
SetView(mainView); |
|
||||||
|
|
||||||
AddOption("Lets look at the logo", LookLogo); |
|
||||||
AddOption("That's a nice toadstool over there", LookToadstool); |
|
||||||
AddOption ("Give me the full tour", FullTour); |
|
||||||
AddOption("Back to menu", MoveToMenu); |
|
||||||
|
|
||||||
Choose("Wanna move the camera?"); |
|
||||||
} |
|
||||||
|
|
||||||
void MoveToMenu() |
|
||||||
{ |
|
||||||
MoveToRoom(menuRoom); |
|
||||||
} |
|
||||||
|
|
||||||
void LookLogo() |
|
||||||
{ |
|
||||||
PanToView(logoView, 2f); |
|
||||||
Wait(2); |
|
||||||
PanToView(mainView, 2f); |
|
||||||
Call(OnEnter); |
|
||||||
} |
|
||||||
|
|
||||||
void LookToadstool() |
|
||||||
{ |
|
||||||
FadeToView(toadstoolView, 2f); |
|
||||||
Say("Now that is a pretty mushroom"); |
|
||||||
Say("Hey - let's go look at that logo"); |
|
||||||
Call(LookLogo); |
|
||||||
} |
|
||||||
|
|
||||||
void FullTour() |
|
||||||
{ |
{ |
||||||
Say("Let's have a look around here"); |
public Room menuRoom; |
||||||
PanToPath(10f, logoView, toadstoolView, mainView); |
|
||||||
Say("And we're back!"); |
public View mainView; |
||||||
Call(OnEnter); |
public View logoView; |
||||||
|
public View toadstoolView; |
||||||
|
|
||||||
|
void OnEnter() |
||||||
|
{ |
||||||
|
SetView(mainView); |
||||||
|
|
||||||
|
AddOption("Lets look at the logo", LookLogo); |
||||||
|
AddOption("That's a nice toadstool over there", LookToadstool); |
||||||
|
AddOption ("Give me the full tour", FullTour); |
||||||
|
AddOption("Back to menu", MoveToMenu); |
||||||
|
|
||||||
|
Choose("Wanna move the camera?"); |
||||||
|
} |
||||||
|
|
||||||
|
void MoveToMenu() |
||||||
|
{ |
||||||
|
MoveToRoom(menuRoom); |
||||||
|
} |
||||||
|
|
||||||
|
void LookLogo() |
||||||
|
{ |
||||||
|
PanToView(logoView, 2f); |
||||||
|
Wait(2); |
||||||
|
PanToView(mainView, 2f); |
||||||
|
Call(OnEnter); |
||||||
|
} |
||||||
|
|
||||||
|
void LookToadstool() |
||||||
|
{ |
||||||
|
FadeToView(toadstoolView, 2f); |
||||||
|
Say("Now that is a pretty mushroom"); |
||||||
|
Say("Hey - let's go look at that logo"); |
||||||
|
Call(LookLogo); |
||||||
|
} |
||||||
|
|
||||||
|
void FullTour() |
||||||
|
{ |
||||||
|
Say("Let's have a look around here"); |
||||||
|
PanToPath(10f, logoView, toadstoolView, mainView); |
||||||
|
Say("And we're back!"); |
||||||
|
Call(OnEnter); |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
Loading…
Reference in new issue