using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharBase : MonoBehaviour {

	public virtual void OnRippleTouch(AutomataState state) {}
	protected virtual void OnBeatAction(int absBeat, Entity ent) {}
	protected virtual void OnPulseAction(int absPulse, int relPulse, Entity ent) {}
	protected Entity ent;

	
	void OnPreBeat(int absBeat) {
		if(!ent.seat)
			return;
		OnBeatAction(absBeat, ent);
	}

	void OnPrePulse(int absPulse, int relPulse) {
		if(!ent.seat)
			return;
		OnPulseAction(absPulse, relPulse, ent);
	}

	protected virtual void OnDestroy() {
		Game.instance.OnPreBeat -= OnPreBeat;
		Game.instance.OnPrePulse -= OnPrePulse;
	}

	protected virtual void Start() {
		Game.instance.OnPreBeat += OnPreBeat;
		Game.instance.OnPrePulse += OnPrePulse;
		ent = GetComponent<Entity>();
	}

	//protected virtual void Update() {

	//}
}
