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 System.Collections; |
||||
using Fungus; |
||||
|
||||
/** |
||||
* 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. |
||||
* We recommend placing your room code in the Fungus namespace to avoid class name conflicts with other Unity libraries. |
||||
*/ |
||||
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. |
||||
// See FungusExample/Scripts for examples |
||||
} |
||||
// 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 |
||||
*/ |
||||
void OnEnter() |
||||
{ |
||||
// Add any sequence of Fungus commands you want here. |
||||
// See FungusExample/Scripts for examples |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,72 +1,74 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
using Fungus; |
||||
|
||||
public class AudioRoom : Room |
||||
namespace Fungus.Example |
||||
{ |
||||
public Room menuRoom; |
||||
public AudioClip musicClip; |
||||
public AudioClip effectClip; |
||||
|
||||
void OnEnter() |
||||
public class AudioRoom : Room |
||||
{ |
||||
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() |
||||
{ |
||||
SetValue("quiet"); |
||||
SetMusicVolume(0.25f, 1f); |
||||
Call(OnEnter); |
||||
} |
||||
void MakeQuiet() |
||||
{ |
||||
SetValue("quiet"); |
||||
SetMusicVolume(0.25f, 1f); |
||||
Call(OnEnter); |
||||
} |
||||
|
||||
void MainMenu() |
||||
{ |
||||
MoveToRoom(menuRoom); |
||||
void MainMenu() |
||||
{ |
||||
MoveToRoom(menuRoom); |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,55 +1,57 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
using Fungus; |
||||
|
||||
public class ButtonRoom : Room |
||||
namespace Fungus.Example |
||||
{ |
||||
public Room menuRoom; |
||||
|
||||
public AudioClip effectClip; |
||||
|
||||
public Button homeButton; |
||||
public Button soundButton; |
||||
public Button questionButton; |
||||
|
||||
void OnEnter() |
||||
{ |
||||
// Show button, always visible (because autoHide is set to false) |
||||
ShowButton(homeButton, OnHomeClicked); |
||||
|
||||
// Show buttons, auto hides when text is displayed (because autoHide is set to true) |
||||
ShowButton(soundButton, OnMusicClicked); |
||||
ShowButton(questionButton, OnQuestionClicked); |
||||
|
||||
Say("The Mushroom read his book with great interest."); |
||||
Say("After turning the last page, he considered his options."); |
||||
|
||||
// Uncomment this line to make the player tap the screen before showing the buttons |
||||
// WaitForInput(); |
||||
|
||||
// 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 |
||||
} |
||||
|
||||
void OnHomeClicked() |
||||
public class ButtonRoom : Room |
||||
{ |
||||
MoveToRoom(menuRoom); |
||||
} |
||||
|
||||
void OnMusicClicked() |
||||
{ |
||||
PlaySound(effectClip); |
||||
|
||||
// The music button has been configured to automatically hide when this value is set |
||||
SetValue("PlayedSound"); |
||||
} |
||||
|
||||
void OnQuestionClicked() |
||||
{ |
||||
// 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. |
||||
|
||||
Say("What book was he reading?"); |
||||
Say("Sadly we will never know for sure."); |
||||
public Fungus.Room menuRoom; |
||||
|
||||
public AudioClip effectClip; |
||||
|
||||
public Button homeButton; |
||||
public Button soundButton; |
||||
public Button questionButton; |
||||
|
||||
void OnEnter() |
||||
{ |
||||
// Show button, always visible (because autoHide is set to false) |
||||
ShowButton(homeButton, OnHomeClicked); |
||||
|
||||
// Show buttons, auto hides when text is displayed (because autoHide is set to true) |
||||
ShowButton(soundButton, OnMusicClicked); |
||||
ShowButton(questionButton, OnQuestionClicked); |
||||
|
||||
Say("The Mushroom read his book with great interest."); |
||||
Say("After turning the last page, he considered his options."); |
||||
|
||||
// Uncomment this line to make the player tap the screen before showing the buttons |
||||
// WaitForInput(); |
||||
|
||||
// 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 |
||||
} |
||||
|
||||
void OnHomeClicked() |
||||
{ |
||||
MoveToRoom(menuRoom); |
||||
} |
||||
|
||||
void OnMusicClicked() |
||||
{ |
||||
PlaySound(effectClip); |
||||
|
||||
// The music button has been configured to automatically hide when this value is set |
||||
SetValue("PlayedSound"); |
||||
} |
||||
|
||||
void OnQuestionClicked() |
||||
{ |
||||
// 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. |
||||
|
||||
Say("What book was he reading?"); |
||||
Say("Sadly we will never know for sure."); |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,56 +1,58 @@
|
||||
using UnityEngine; |
||||
using System.Collections; |
||||
using Fungus; |
||||
|
||||
public class MenuRoom : Room |
||||
namespace Fungus.Example |
||||
{ |
||||
public Room pageRoom; |
||||
public Room viewRoom; |
||||
public Room spriteRoom; |
||||
public Room parallaxRoom; |
||||
public Room buttonRoom; |
||||
public Room audioRoom; |
||||
|
||||
void OnEnter() |
||||
public class MenuRoom : Room |
||||
{ |
||||
SetPageMiddle(); |
||||
|
||||
AddOption("Writing a story with Pages", MoveToWritingRoom); |
||||
AddOption("Controlling the camera with Views", MoveToViewRoom); |
||||
AddOption("Sprites and Animations", MoveToSpriteRoom); |
||||
AddOption("Swipe panning and parallax", MoveToParallaxRoom); |
||||
AddOption("Using Buttons", MoveToButtonsRoom); |
||||
AddOption("Playing music and sound effects", MoveToAudioRoom); |
||||
Choose("Choose an example"); |
||||
} |
||||
|
||||
void MoveToWritingRoom() |
||||
{ |
||||
MoveToRoom(pageRoom); |
||||
} |
||||
|
||||
void MoveToViewRoom() |
||||
{ |
||||
MoveToRoom(viewRoom); |
||||
} |
||||
|
||||
void MoveToSpriteRoom() |
||||
{ |
||||
MoveToRoom(spriteRoom); |
||||
} |
||||
|
||||
void MoveToParallaxRoom() |
||||
{ |
||||
MoveToRoom(parallaxRoom); |
||||
} |
||||
|
||||
void MoveToButtonsRoom() |
||||
{ |
||||
MoveToRoom(buttonRoom); |
||||
} |
||||
|
||||
void MoveToAudioRoom() |
||||
{ |
||||
MoveToRoom(audioRoom); |
||||
public Room pageRoom; |
||||
public Room viewRoom; |
||||
public Room spriteRoom; |
||||
public Room parallaxRoom; |
||||
public Room buttonRoom; |
||||
public Room audioRoom; |
||||
|
||||
void OnEnter() |
||||
{ |
||||
SetPageMiddle(); |
||||
|
||||
AddOption("Writing a story with Pages", MoveToWritingRoom); |
||||
AddOption("Controlling the camera with Views", MoveToViewRoom); |
||||
AddOption("Sprites and Animations", MoveToSpriteRoom); |
||||
AddOption("Swipe panning and parallax", MoveToParallaxRoom); |
||||
AddOption("Using Buttons", MoveToButtonsRoom); |
||||
AddOption("Playing music and sound effects", MoveToAudioRoom); |
||||
Choose("Choose an example"); |
||||
} |
||||
|
||||
void MoveToWritingRoom() |
||||
{ |
||||
MoveToRoom(pageRoom); |
||||
} |
||||
|
||||
void MoveToViewRoom() |
||||
{ |
||||
MoveToRoom(viewRoom); |
||||
} |
||||
|
||||
void MoveToSpriteRoom() |
||||
{ |
||||
MoveToRoom(spriteRoom); |
||||
} |
||||
|
||||
void MoveToParallaxRoom() |
||||
{ |
||||
MoveToRoom(parallaxRoom); |
||||
} |
||||
|
||||
void MoveToButtonsRoom() |
||||
{ |
||||
MoveToRoom(buttonRoom); |
||||
} |
||||
|
||||
void MoveToAudioRoom() |
||||
{ |
||||
MoveToRoom(audioRoom); |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,89 +1,91 @@
|
||||
using UnityEngine; |
||||
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 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() |
||||
public class PageRoom : Room |
||||
{ |
||||
// Sets the header text on the page |
||||
SetHeader("The Mushroom"); |
||||
// This is a reference to the menu room so we can transition back to the menu using MoveToRoom() |
||||
public Room menuRoom; |
||||
|
||||
// Each Say() command writes one line of text, followed by a continue button |
||||
Say("One day in the forest, a mushroom grew."); |
||||
Say("What am I doing here he wondered?"); |
||||
// References to PageStyle prefab assets |
||||
// Use these with SetPageStyle() to change the Page rendering style |
||||
public PageStyle defaultStyle; |
||||
public PageStyle alternateStyle; |
||||
|
||||
SetPageTop(); |
||||
Say("I think I will wait for a while and see if something happens."); |
||||
// The OnEnter() method is called whenever the player enters the room |
||||
void OnEnter() |
||||
{ |
||||
// Sets the header text on the page |
||||
SetHeader("The Mushroom"); |
||||
|
||||
// Wait for a few seconds |
||||
Wait(3); |
||||
// Each Say() command writes one line of text, followed by a continue button |
||||
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 |
||||
SetHeader(""); |
||||
SetPageTop(); |
||||
Say("I think I will wait for a while and see if something happens."); |
||||
|
||||
SetPageBottom(); |
||||
Say("..."); |
||||
Say("Hmmm. Nothing seems to be happening."); |
||||
// Wait for a few seconds |
||||
Wait(3); |
||||
|
||||
// Add a couple of user options |
||||
// The first parameter is the option text |
||||
// 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); |
||||
// Set the header text to the empty string to remove the page title |
||||
SetHeader(""); |
||||
|
||||
// Display all the previously added options, with a text prompt |
||||
Choose("Whatever will I do?"); |
||||
} |
||||
SetPageBottom(); |
||||
Say("..."); |
||||
Say("Hmmm. Nothing seems to be happening."); |
||||
|
||||
void GoToSleep() |
||||
{ |
||||
// 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!"); |
||||
// Add a couple of user options |
||||
// The first parameter is the option text |
||||
// 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); |
||||
|
||||
// Leave the current room and enter the menu room |
||||
MoveToRoom(menuRoom); |
||||
// Display all the previously added options, with a text prompt |
||||
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. |
||||
Call(ProduceSpores); |
||||
void GoToSleep() |
||||
{ |
||||
// 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() |
||||
{ |
||||
// Set a PageStyle with no background box texture |
||||
SetPageStyle(alternateStyle); |
||||
void ProduceSpores() |
||||
{ |
||||
// Set a PageStyle with no background box texture |
||||
SetPageStyle(alternateStyle); |
||||
|
||||
Say("Yeah! I feel like doing some sporing!"); |
||||
Say("Wow - look at all these spores! COOL!"); |
||||
Say("Yeah! I feel like doing some sporing!"); |
||||
Say("Wow - look at all these spores! COOL!"); |
||||
|
||||
// Set the default style with background box texture |
||||
SetPageStyle(defaultStyle); |
||||
// Set the default style with background box texture |
||||
SetPageStyle(defaultStyle); |
||||
|
||||
// Sets a global value flag which we check above in GoToSleep |
||||
SetValue("spawned"); |
||||
// Sets a global value flag which we check above in GoToSleep |
||||
SetValue("spawned"); |
||||
|
||||
AddOption("So tired. I sleep now.", GoToSleep); |
||||
AddOption("No way! More spores!", ProduceSpores); |
||||
AddOption("So tired. I sleep now.", GoToSleep); |
||||
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 System.Collections; |
||||
using Fungus; |
||||
|
||||
// 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 |
||||
namespace Fungus.Example |
||||
{ |
||||
public View viewA; |
||||
public View viewB; |
||||
// 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 Button menuButton; |
||||
public class ParallaxRoom : Room |
||||
{ |
||||
public View viewA; |
||||
public View viewB; |
||||
|
||||
public Room menuRoom; |
||||
public Button menuButton; |
||||
|
||||
void OnEnter() |
||||
{ |
||||
SetView(viewA); |
||||
public Room menuRoom; |
||||
|
||||
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."); |
||||
void OnEnter() |
||||
{ |
||||
SetView(viewA); |
||||
|
||||
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() |
||||
{ |
||||
MoveToRoom(menuRoom); |
||||
StartSwipePan(viewA, viewB, 0f); |
||||
} |
||||
|
||||
void OnHomeButtonClicked() |
||||
{ |
||||
MoveToRoom(menuRoom); |
||||
} |
||||
} |
||||
} |
@ -1,61 +1,63 @@
|
||||
using UnityEngine; |
||||
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 SpriteRenderer blueAlienSprite; |
||||
public SpriteRenderer redMushroomSprite; |
||||
public Animator blueAlienAnim; |
||||
public SpriteRenderer blueAlienSprite; |
||||
public SpriteRenderer redMushroomSprite; |
||||
|
||||
void OnEnter() |
||||
{ |
||||
HideSprite(redMushroomSprite); |
||||
void OnEnter() |
||||
{ |
||||
HideSprite(redMushroomSprite); |
||||
|
||||
ShowSprite(blueAlienSprite); |
||||
ShowSprite(blueAlienSprite); |
||||
|
||||
Say("Pink Alien says to Blue Alien..."); |
||||
Say("...'Show me your funky moves!'"); |
||||
Say("Pink Alien says to Blue Alien..."); |
||||
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("Don't want to sit? Ok, no problem."); |
||||
Say("Maybe you want a nice mushroom to sit down on?"); |
||||
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. |
||||
// When the GreenAlienWalk animation finishes it fires an event which calls this method. |
||||
void AlienAnimationFinished() |
||||
{ |
||||
SetAnimatorTrigger(blueAlienAnim, "Stop"); |
||||
// 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. |
||||
void AlienAnimationFinished() |
||||
{ |
||||
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); |
||||
Wait(1f); |
||||
FadeSprite(blueAlienSprite, 0, 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 System.Collections; |
||||
using Fungus; |
||||
|
||||
public class ViewRoom : Room |
||||
namespace Fungus.Example |
||||
{ |
||||
public Room menuRoom; |
||||
|
||||
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() |
||||
public class ViewRoom : Room |
||||
{ |
||||
Say("Let's have a look around here"); |
||||
PanToPath(10f, logoView, toadstoolView, mainView); |
||||
Say("And we're back!"); |
||||
Call(OnEnter); |
||||
public Room menuRoom; |
||||
|
||||
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"); |
||||
PanToPath(10f, logoView, toadstoolView, mainView); |
||||
Say("And we're back!"); |
||||
Call(OnEnter); |
||||
} |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue