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

public class ForceField : MonoBehaviour
{
    [SerializeField] private AudioSource deflect;
    public Ownership owner;

    void OnTriggerEnter(Collider other) {
        if(other.gameObject.GetComponent<BulletBehaviour>()) {
            BulletBehaviour bullet = other.gameObject.GetComponent<BulletBehaviour>();

            if(bullet.owner != this.owner) {
                deflect.Play();
                bullet.owner = this.owner;
                other.gameObject.transform.forward = -other.gameObject.transform.forward;
            }
        }
    }
}
