#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
///
/// base class for all chart item effects
///
public abstract class ChartItemEffect : MonoBehaviour
{
internal int ItemIndex { get; set; }
internal int ItemType { get; set; }
internal object ItemData { get; set; }
CharItemEffectController mController;
protected CharItemEffectController Controller
{
get
{
if (mController == null)
{
mController = GetComponent();
if (mController == null)
mController = gameObject.AddComponent();
}
return mController;
}
}
public event Action Deactivate;
protected void RaiseDeactivated()
{
if (Deactivate != null)
Deactivate(this);
}
private void Register()
{
CharItemEffectController control = Controller;
if (control != null)
control.Register(this);
}
private void Unregister()
{
CharItemEffectController control = Controller;
if (control != null)
control.Unregister(this);
}
protected virtual void OnDisable()
{
Unregister();
}
protected virtual void OnEnable()
{
Register();
}
protected virtual void Start()
{
Register();
}
protected virtual void Destroy()
{
Unregister();
}
public abstract void TriggerIn(bool deactivateOnEnd);
public abstract void TriggerOut(bool deactivateOnEnd);
///
/// applies a scaling to the object
///
internal abstract Vector3 ScaleMultiplier {get;}
///
/// applies rotation to the object
///
internal abstract Quaternion Rotation { get; }
///
/// applies translation to the object
///
internal abstract Vector3 Translation { get; }
}
}