using System.Collections; using System.Collections.Generic; using UnityEngine; public class CharacterTiles : MonoBehaviour { //[SerializeField] private public List myTile ; public List neutralList ; [SerializeField] private int nCount; public List enemyTiles; private void Update() { //enemyTiles = new List(FindObjectsOfType()); foreach(GameObject tile in enemyTiles) { if(gameObject.GetComponent().tileOwnerIndex == TileOwner.Neutral) { enemyTiles.Add(FindObjectOfType()); } } } private void OnTriggerEnter(Collider other) { if(other.gameObject.GetComponent() != null) { if((other.gameObject.GetComponent().tileOwnerIndex == GetComponent().ownerIndex || other.gameObject.GetComponent().tileOwnerIndex == TileOwner.Neutral)) { myTile.Add(other.gameObject); } } } }