62 lines
1.7 KiB
C#
62 lines
1.7 KiB
C#
/// <summary>
|
|
/// SURGE FRAMEWORK
|
|
/// Author: Bob Berkebile
|
|
/// Email: bobb@pixelplacement.com
|
|
/// </summary>
|
|
|
|
using UnityEngine;
|
|
using System;
|
|
using Pixelplacement;
|
|
|
|
namespace Pixelplacement.TweenSystem
|
|
{
|
|
class FieldOfView : TweenBase
|
|
{
|
|
//Public Properties:
|
|
public float EndValue {get; private set;}
|
|
|
|
//Private Variables:
|
|
Camera _target;
|
|
float _start;
|
|
|
|
//Constructor:
|
|
public FieldOfView (Camera target, float endValue, float duration, float delay, bool obeyTimescale, AnimationCurve curve, Tween.LoopType loop, Action startCallback, Action completeCallback)
|
|
{
|
|
//set essential properties:
|
|
SetEssentials (Tween.TweenType.FieldOfView, target.GetInstanceID (), duration, delay, obeyTimescale, curve, loop, startCallback, completeCallback);
|
|
|
|
//catalog custom properties:
|
|
_target = target;
|
|
EndValue = endValue;
|
|
}
|
|
|
|
//Processes:
|
|
protected override bool SetStartValue ()
|
|
{
|
|
if (_target == null) return false;
|
|
_start = _target.fieldOfView;
|
|
return true;
|
|
}
|
|
|
|
protected override void Operation (float percentage)
|
|
{
|
|
float calculatedValue = TweenUtilities.LinearInterpolate (_start, EndValue, percentage);
|
|
_target.fieldOfView = calculatedValue;
|
|
}
|
|
|
|
//Loops:
|
|
public override void Loop ()
|
|
{
|
|
ResetStartTime ();
|
|
_target.fieldOfView = _start;
|
|
}
|
|
|
|
public override void PingPong ()
|
|
{
|
|
ResetStartTime ();
|
|
_target.fieldOfView = EndValue;
|
|
EndValue = _start;
|
|
_start = _target.fieldOfView;
|
|
}
|
|
}
|
|
} |