public void Launch() { RocketTrail.SetActive(true); startPos = this.transform.position; endPos = this.transform.position + new Vector3(0, 70f, 0); startTime = Time.time; len = Vector3.Distance(startPos, endPos); activate = true; this.transform.parent = null; float maxDistance = 1000000; foreach (GameObject o in PlayerManager.ins.playersInScene) { if (o.name != whoFired.name) { float d = Vector3.Distance(this.transform.position, o.transform.position); if (d < maxDistance) { maxDistance = d; target = o; } } } }