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.
62 lines
1.1 KiB
62 lines
1.1 KiB
10 years ago
|
using UnityEngine;
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
|
||
|
namespace Fungus.Script
|
||
|
{
|
||
|
|
||
10 years ago
|
public class View : FungusCommand
|
||
10 years ago
|
{
|
||
|
public enum Transition
|
||
|
{
|
||
|
Move,
|
||
|
Fade
|
||
|
}
|
||
|
|
||
|
public Transition transition;
|
||
|
public float duration;
|
||
10 years ago
|
public Fungus.View targetView;
|
||
10 years ago
|
public bool waitUntilFinished = true;
|
||
|
|
||
|
public override void OnEnter()
|
||
|
{
|
||
|
Game game = Game.GetInstance();
|
||
|
|
||
|
if (waitUntilFinished)
|
||
|
{
|
||
|
game.waiting = true;
|
||
|
}
|
||
|
|
||
|
if (transition == Transition.Fade)
|
||
|
{
|
||
|
game.cameraController.FadeToView(targetView, duration, delegate {
|
||
|
if (waitUntilFinished)
|
||
|
{
|
||
|
game.waiting = false;
|
||
|
Continue();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
else if (transition == Transition.Move)
|
||
|
{
|
||
|
Vector3 targetPosition = targetView.transform.position;
|
||
|
Quaternion targetRotation = targetView.transform.rotation;
|
||
|
float targetSize = targetView.viewSize;
|
||
|
|
||
|
game.cameraController.PanToPosition(targetPosition, targetRotation, targetSize, duration, delegate {
|
||
|
if (waitUntilFinished)
|
||
|
{
|
||
|
game.waiting = false;
|
||
|
Continue();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
if (!waitUntilFinished)
|
||
|
{
|
||
|
Continue();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|