Browse Source

Added ShakeCamera() command.

master
chrisgregan 11 years ago
parent
commit
a26695397b
  1. 14
      Assets/Fungus/Scripts/GameController.cs
  2. 3
      Assets/FungusExample/Scripts/DialogRoom.cs

14
Assets/Fungus/Scripts/GameController.cs

@ -239,6 +239,20 @@ namespace Fungus
commandQueue.AddCommand(new Command.PanToStoredView(viewName, duration));
}
/**
* Applies a random shake to the camera.
* @param x Horizontal shake amount in world units.
* @param x Vertical shake amount in world units.
* @param duration Length of time for shake effect to last.
*/
public static void ShakeCamera(float x, float y, float duration)
{
CommandQueue commandQueue = Game.GetInstance().commandQueue;
commandQueue.AddCommand(new Command.Call(delegate {
iTween.ShakePosition(Camera.main.gameObject, new Vector3(x, y, 0), duration);
}));
}
#endregion
#region Dialog Methods

3
Assets/FungusExample/Scripts/DialogRoom.cs

@ -59,6 +59,9 @@ namespace Fungus.Example
void ProduceSpores()
{
Say("Yeah! I feel like doing some sporing!");
ShakeCamera(0.1f, 0.1f, 0.2f);
Say("Wow - look at all these spores! COOL!");
// Sets a global value flag which we check above in GoToSleep

Loading…
Cancel
Save