using UnityEngine;
using System.Collections;
using Framework.Entities;

public class WatcherAttack : CoreBehaviour
{
    public class AttackAction : CoreAction
    {
        public Vector3 target;

        public AttackAction(Vector3 target)
        {
            this.target = target;
        }
    }

    protected override void InnerAwake()
    {
        AddActionHandler<AttackAction>(Attack);
    }

    protected override void InnerUpdate()
    {

    }

    private void Attack(AttackAction action)
    {
        MissileBehaviour missileBehaviour = ((GameObject)Instantiate(Resources.Load("WatcherBolt"), this.transform.position + (action.target - this.transform.position).normalized, new Quaternion())).GetComponent<MissileBehaviour>();
        missileBehaviour.targetPosition = action.target;
        missileBehaviour.force = 20f;
    }
}
