You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.6 KiB
69 lines
1.6 KiB
11 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using Fungus;
|
||
|
|
||
11 years ago
|
public class SpriteRoom : Room
|
||
11 years ago
|
{
|
||
|
public Room menuRoom;
|
||
11 years ago
|
|
||
11 years ago
|
public Animator blueAlienAnim;
|
||
11 years ago
|
public SpriteRenderer blueAlienSprite;
|
||
|
public SpriteRenderer redMushroomSprite;
|
||
11 years ago
|
|
||
|
void OnEnter()
|
||
|
{
|
||
11 years ago
|
HideSprite(redMushroomSprite);
|
||
|
|
||
11 years ago
|
ShowSprite(blueAlienSprite);
|
||
|
|
||
11 years ago
|
Say("Pink Alien says to Blue Alien...");
|
||
|
Say("...'Show me your funky moves!'");
|
||
|
|
||
|
SetAnimatorTrigger(blueAlienAnim, "StartBlueWalk");
|
||
|
|
||
|
Say("Blue Alien starts to dance.");
|
||
|
Say("Tap on Blue Alien to stop him dancing.");
|
||
11 years ago
|
|
||
11 years ago
|
AddButton(blueAlienSprite, StopDancing);
|
||
11 years ago
|
}
|
||
|
|
||
|
// This method is called from the Button component on the BlueAlien object
|
||
|
void StopDancing()
|
||
|
{
|
||
11 years ago
|
RemoveButton(blueAlienSprite);
|
||
|
|
||
11 years ago
|
SetAnimatorTrigger(blueAlienAnim, "Stop");
|
||
|
|
||
|
Say("Nice moves there Blue Alien!");
|
||
11 years ago
|
|
||
|
FadeSprite(redMushroomSprite, 1f, 1f);
|
||
|
|
||
11 years ago
|
Say("Maybe you want a nice mushroom to sit down on?");
|
||
11 years ago
|
Say("Don't want to sit? Ok, no problem.");
|
||
11 years ago
|
|
||
11 years ago
|
FadeSprite(redMushroomSprite, 0f, 1f);
|
||
|
|
||
11 years ago
|
Say("Uh oh, you look like you're turning a little green after all that dancing!");
|
||
|
|
||
|
SetAnimatorTrigger(blueAlienAnim, "StartGreenWalk");
|
||
|
|
||
|
Say("Never mind, you'll feel better soon!");
|
||
|
}
|
||
|
|
||
11 years ago
|
// 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()
|
||
11 years ago
|
{
|
||
11 years ago
|
SetAnimatorTrigger(blueAlienAnim, "Stop");
|
||
11 years ago
|
|
||
11 years ago
|
Say("Well done Blue Alien! Time to say goodbye!");
|
||
11 years ago
|
|
||
11 years ago
|
FadeSprite(blueAlienSprite, 0, 1f);
|
||
|
Wait(1f);
|
||
11 years ago
|
|
||
11 years ago
|
Say("Heh. That Blue Alien - what a guy!");
|
||
11 years ago
|
|
||
11 years ago
|
MoveToRoom(menuRoom);
|
||
11 years ago
|
}
|
||
|
}
|