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

public class AirplaneEnemy : Enemy
{
	protected override void InitializeStateMachine()
	{
		State idle = new State("idle");
		State detected = new State("detected");
		State attack = new State("attack");

		idle.StateUpdate += delegate
		{
			if (DetectPlayer())
			{
				stateMachine.Transtion("detected");
			}
		};

		detected.StateUpdate += ShotProjectile;
		detected.StateUpdate += delegate
		{
			if (!DetectPlayer())
			{
				stateMachine.Transtion("idle");
			}
		};

		State[] states = { idle, detected, attack };
		stateMachine.AddNewStates(states);

		stateMachine.Transtion("idle");
	}
}
