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

public class ShielderWeapon : BasicWeapon
{
    // [SerializeField] private List<ShielderPlate> plates;
    [SerializeField] private ForceField forceField;
    private ShielderAI enemyPsyche;

    protected override void Awake() {
        base.Awake();
        enemyPsyche = GetComponent<ShielderAI>();
    }

    protected override void Update() {
        base.Update();
        forceField.owner = this.owner;
        if(this.owner == Ownership.ENEMY && enemyPsyche != null) {
            enemyPsyche.enabled = true;
            this.health.owner = Ownership.ENEMY;
            // if(plates != null) {
            //     foreach(ShielderPlate plate in plates) {
            //         plate.SetShieldParent(Ownership.ENEMY);
            //     }
            // }
        }
        else if(this.owner == Ownership.PLAYER) {
            // enemyPsyche.enabled = false;
            PlayerManager.I.unit = GetComponent<ShielderUnitController>();
            this.health.owner = Ownership.PLAYER;
            // if(plates != null) {
            //     foreach(ShielderPlate plate in plates) {
            //         plate.SetShieldParent(Ownership.PLAYER);
            //     }
            // }
        }
    }
}
