void OnEnable() { rhandor = target as RhandorController; rhandor.LoadNeutralPatrol(); rhandor.LoadAlertPatrol(); }
/// <summary> /// CheckVisibleTargets() checks every Transform gameObject returned by FindVisibleTargets() and checks its Tag. /// If player is found, the level resets. If an enemy corpse is found, alert mode is activated. /// </summary> public void CheckVisibleTargets() { if (enemy_manager.god_mode == true) //Don't check visible characters if god mode is activated. { return; } foreach (Transform t in visible_targets) { // Response for players! if (t.tag.Equals(Tags.player)) { if (t.GetComponent <Invisible>().IsInvisible()) { continue; } if (!player_found) { player_found = true; main_camera.MoveCameraTo(transform.position); screen_fader.EndScene(0); // Debug part //--------------------------- // Tint yellow the enemy who discovered a character GetComponent <MeshRenderer>().material.SetColor("_Color", new Color(1.0f, 1.0f, 0.0f, 0.0f)); //--------------------------- } } if (!enemy_manager.IsElementAlreadyIdentify(t.gameObject)) { // Response: If something is found, the enemy will move // to a near position to cleary identify that element if ((t.tag.Equals(Tags.corpse) || t.tag.Equals(Tags.portal)) && !IsElementIdentificationPending(t.gameObject)) { pending_identification_elements.Enqueue(t.gameObject); RhandorController rhandor = GetComponent <RhandorController>(); last_spotted_position.LastPosition = t.transform.position; rhandor.ChangeStateTo(rhandor.spotted_state); } } } }
// Constructor public RhandorAlertState(RhandorController enemy_controller) { rhandor = enemy_controller; }
// Use this for initialization void Awake() { rhandor = GetComponentInParent <RhandorController>(); }
// Constructor public RhandorPatrolState(RhandorController enemy_controller) { rhandor = enemy_controller; }