// LateUpdate is called after Update each frame void LateUpdate() { if (target == null) { checkWASDCamera(); } else { smoothCamera(); } checkMouseInput(); // If space bar is pressed detach from the current focucs if (target != null && Input.GetKey(KeyCode.Space)) { if (target.gameObject.tag == "PreyAgent") { PreyAgent targetScript = target.gameObject.GetComponent <PreyAgent>(); targetScript.deselect(); } if (target.gameObject.tag == "PredatorAgent") { PredatorAgent targetScript = target.gameObject.GetComponent <PredatorAgent>(); targetScript.deselect(); } target = null; } checkScreenshotInput(); }
public void changeObjectFocus(Transform agentPos) { if (target != null && target.gameObject.tag.Equals("PreyAgent")) { PreyAgent targetScript = target.gameObject.GetComponent <PreyAgent>(); targetScript.deselect(); } if (target != null && target.gameObject.tag.Equals("PredatorAgent")) { PredatorAgent targetScript = target.gameObject.GetComponent <PredatorAgent>(); targetScript.deselect(); } target = agentPos; }