Hi guys, i have a bunch of scripts on my enemys that have a PlayerVisable Boolean. I’ve managed to get all these booleans into an array on my player script, and basically all i want to do is check if any enemy’s see me, and if they do, set my players Alert Boolean to true. it seems really simple but i cant seem to figure out just how it works. thanks so much for your help
using UnityEngine;
using System.Collections;
using System.Linq;
public class Player_manager : MonoBehaviour {
public Transform PlayerCam;
public float Speed;
Rigidbody RB;
public bool Alert;
public GameObject[] enemys;
public Enemy_FOV[] enemyFOV;
public bool[] enemyAlert;
// Use this for initialization
void Start () {
RB = gameObject.GetComponent<Rigidbody> ();
}
// Update is called once per frame
void Update () {
enemys = GameObject.FindGameObjectsWithTag ("Enemy");
enemyFOV = new Enemy_FOV[enemys.Length];
for(int i = 0; i < enemys.Length; i++){
enemyFOV <em>=enemys*.GetComponent<Enemy_FOV> ();*</em>
* }*
* enemyAlert = new bool[enemyFOV.Length];*
* for(int i = 0; i < enemyFOV.Length; i++){*
enemyAlert =enemyFOV*.playerVisable;*
* }*
* if (Input.GetButtonUp (“Fire1”)) {*
* Jump_Start ();
_ }*_
* }*
so basically i just want to make Alert true, when any of the enemyAlert array bools are true.