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.
66 lines
1.5 KiB
66 lines
1.5 KiB
10 years ago
|
using UnityEngine;
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
|
||
10 years ago
|
namespace Fungus
|
||
10 years ago
|
{
|
||
10 years ago
|
[CommandInfo("Camera",
|
||
|
"Move To View",
|
||
10 years ago
|
"Moves the camera to a location specified by a View object. Select [Game Object > Fungus > Camera > View] to create a View object.")]
|
||
10 years ago
|
public class MoveToView : Command
|
||
10 years ago
|
{
|
||
10 years ago
|
[Tooltip("Time for move effect to complete")]
|
||
10 years ago
|
public float duration = 1;
|
||
10 years ago
|
|
||
|
[Tooltip("View to transition to when move is complete")]
|
||
10 years ago
|
public Fungus.View targetView;
|
||
10 years ago
|
|
||
|
[Tooltip("Wait until the fade has finished before executing next command")]
|
||
10 years ago
|
public bool waitUntilFinished = true;
|
||
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
CameraController cameraController = CameraController.GetInstance();
|
||
|
|
||
|
if (waitUntilFinished)
|
||
|
{
|
||
|
cameraController.waiting = true;
|
||
|
}
|
||
|
|
||
|
Vector3 targetPosition = targetView.transform.position;
|
||
|
Quaternion targetRotation = targetView.transform.rotation;
|
||
|
float targetSize = targetView.viewSize;
|
||
|
|
||
|
cameraController.PanToPosition(targetPosition, targetRotation, targetSize, duration, delegate {
|
||
|
if (waitUntilFinished)
|
||
|
{
|
||
|
cameraController.waiting = false;
|
||
|
Continue();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
if (!waitUntilFinished)
|
||
|
{
|
||
|
Continue();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override string GetSummary()
|
||
|
{
|
||
|
if (targetView == null)
|
||
|
{
|
||
10 years ago
|
return "Error: No view selected";
|
||
10 years ago
|
}
|
||
|
else
|
||
|
{
|
||
10 years ago
|
return targetView.name;
|
||
10 years ago
|
}
|
||
|
}
|
||
10 years ago
|
|
||
|
public override Color GetButtonColor()
|
||
|
{
|
||
|
return new Color32(216, 228, 170, 255);
|
||
|
}
|
||
10 years ago
|
}
|
||
|
|
||
|
}
|