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

public class OnPossessAllowPlayerControl : MonoBehaviour, Event.ILocalAction<PossessEvent>, Event.ILocalAction<DepossessEvent>
{
    private void Start()
    {

        GetComponent<EnemyBehaviour>().enabled = GetComponent<UnitController>() != PlayerManager.I.unit;
    }
    public void OnEvent(PossessEvent arg)
    {
        GetComponent<BasicWeapon>().owner = Ownership.PLAYER;
        PlayerManager.I.unit = GetComponent<UnitController>();
        // GetComponent<EnemyBehaviour>().enabled = false;
    }

    public void OnEvent(DepossessEvent arg)
    {
        GetComponent<BasicWeapon>().owner = Ownership.ENEMY;
        GetComponent<EnemyBehaviour>().enabled = true;
    }
}
