void Update() { if (Input.GetButtonDown("Fire1")) { GameObject closestHost = FindObject.FindNearestAliveHost(mousePositionWorldSpace); if (closestHost == null) { Debug.Log("no host found/all hosts busy"); } else { closestHost.GetComponent <Host>().DrawAttention(mousePositionWorldSpace); } } if (Input.GetButtonDown("Fire2")) { GameObject[] hosts = GameObject.FindGameObjectsWithTag("Host"); foreach (GameObject host in hosts) { host.GetComponent <Host>().StopDrawingAttention(); } } }
public void EndGameIfNoHostsRemain() { if (FindObject.FindNearestAliveHost(Vector3.zero) == null) { EndGame(); } }
void Update() { if (isKilling) { return; } if (GameOver.instance.gameOver) { ccc.ClearDestination(); return; } GameObject nearestYellingHost = FindObject.FindNearestYellingHost(transform.position); if (nearestYellingHost != null) { ccc.followObject = nearestYellingHost; ccc.isRunning = true; TryKilling(nearestYellingHost); return; } GameObject nearestHost = FindObject.FindNearestAliveHost(transform.position); if (nearestHost != null) { ccc.followObject = nearestHost; ccc.isRunning = false; TryKilling(nearestHost); return; } }
void Update() { if (!isShut) { GameObject nearestHost = FindObject.FindNearestAliveHost(transform.position); if (nearestHost != null && (nearestHost.transform.position - transform.position).magnitude < trapRadius) { nearestHost.GetComponent <Host>().Die(); SnapShut(); return; } GameObject nearestMIB = FindObject.FindNearestAliveMIB(transform.position); if (nearestMIB != null && (nearestMIB.transform.position - transform.position).magnitude < trapRadius) { nearestMIB.GetComponent <MIB>().Die(); SnapShut(); return; } } }