Browse Source

Added Shake Camera command

master
chrisgregan 11 years ago
parent
commit
c88889a085
  1. 46
      Assets/Fungus/Camera/Commands/ShakeCamera.cs
  2. 8
      Assets/Fungus/Camera/Commands/ShakeCamera.cs.meta
  3. BIN
      Assets/Shuttle/ShuttleGame.unity

46
Assets/Fungus/Camera/Commands/ShakeCamera.cs

@ -0,0 +1,46 @@
using UnityEngine;
using System;
using System.Collections;
namespace Fungus.Script
{
[CommandInfo("Camera",
"Shake Camera",
"Applies a camera shake effect to the main camera.")]
public class ShakeCamera : FungusCommand
{
public float duration = 0.5f;
public Vector2 amount = new Vector2(1, 1);
public bool waitUntilFinished;
public override void OnEnter()
{
iTween.ShakePosition(Camera.main.gameObject, new Vector3(amount.x, amount.y, 0), duration);
if (waitUntilFinished)
{
Invoke("OnWaitComplete", duration);
}
else
{
Continue();
}
}
void OnWaitComplete()
{
Continue();
}
public override string GetSummary()
{
return "For " + duration + " seconds.";
}
public override Color GetButtonColor()
{
return new Color32(216, 228, 170, 255);
}
}
}

8
Assets/Fungus/Camera/Commands/ShakeCamera.cs.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 616cd37e21c7645c58a89edf5abee56f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save