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

public class CharSalaryman : CharBase {

	Queue<AutomataState> q = new Queue<AutomataState>();

	public override void OnRippleTouch(AutomataState state) {
		//if(!ent.seat)	//Nonsense, without seat ripple wont touch
		//	return;
		if(state.instigator == this)
			return;
		//if(q.Count == 0)
		//	wait = 2;
		var copy = state.Clone();
		copy.instigator = this;
		copy.pending.Clear();
		copy.pending.Enqueue(ent.seat);
		copy.visited.Clear();
		copy.ttl = 1;
		q.Enqueue(copy);

		//	Cry();
		//	curr = 0;
		//}
	}

	protected override void OnBeatAction(int absBeat, Entity ent) {
		if(q.Count > 0) {
			var state = q.Dequeue();
			ent.seat.grid.automata.Add(state);
			ent.HeadBump();
			Game.instance.ui.Play(state.instigatorSound);
		}
	}

}
