1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using UnityEngine;
- using UnityEngine.Events;
- using System;
- using System.Collections;
- public abstract class Tween
- {
- public virtual bool InOrigin
- {
- get { return _InOrigin; }
- set { _InOrigin = value; }
- }
- public virtual bool InDestination
- {
- get { return _InDestination; }
- set { _InDestination = value; }
- }
- protected bool _InOrigin;
- protected bool _InDestination;
- public bool InForward;
- public bool InBackward;
- public UnityAction OnForwardStart;
- public UnityAction OnForwardFinish;
- public UnityAction OnBackwardStart;
- public UnityAction OnBackwardFinish;
- public float Duration;
- protected float Timer;
- protected bool DestActive;
- protected bool OriginActive;
- public abstract bool DoForward();
- public abstract bool DoBackward();
- public void ConfineForward()
- {
- if (InOrigin)
- {
- StartForward();
- }
- }
- public void ConfineBackward()
- {
- if (InDestination)
- {
- StartBackward();
- }
- }
- public virtual void StartForward()
- {
- InForward = true;
- if (OnForwardStart != null)
- {
- OnForwardStart.Invoke();
- }
- ManaAnim.TweenForList.Add(this);
- ManaAnim.TweenBacList.Remove(this);
- }
- public virtual void StartBackward()
- {
- InBackward = true;
- if (OnBackwardStart != null)
- {
- OnBackwardStart.Invoke();
- }
- ManaAnim.TweenForList.Remove(this);
- ManaAnim.TweenBacList.Add(this);
- }
- }
|