private Vector3 RandomGuidedMissilePos() { /* int rand = Random.Range(0, 2); * bool top = rand == 0 ? true : false; * Vector3 topLeft = aux.GetUpperLeftCorner(); * Vector3 topRight = aux.GetUpperRightCorner(); * Vector3 downRight = aux.GetLowerRightCorner(); * Vector3 downLeft = aux.GetLowerLeftCorner();*/ /*if (top) * {*/ //return new Vector3(Random.Range(topLeft.x + 10, topRight.x), topRight.y + 7); /*} * else * { * return new Vector3(topRight.x + 3, Random.Range(topRight.y, downRight.y + 10)); * }*/ int option = Random.Range(0, 3); switch (option) { //top case 0: Vector3 topLeft = aux.GetUpperLeftCorner(); Vector3 topRight = aux.GetUpperRightCorner(); return(new Vector3(Random.Range(topLeft.x + 10, topRight.x), topRight.y + 10)); //down case 1: Vector3 downRight = aux.GetLowerRightCorner(); Vector3 downLeft = aux.GetLowerLeftCorner(); return(new Vector3(Random.Range(downLeft.x, downRight.x), downRight.y - 10)); //right case 2: Vector3 topRight1 = aux.GetUpperRightCorner(); Vector3 downRight1 = aux.GetLowerRightCorner(); return(new Vector3(topRight1.x + 10, Random.Range(topRight1.y, downRight1.y))); default: Vector3 topLeft2 = aux.GetUpperLeftCorner(); Vector3 topRight2 = aux.GetUpperRightCorner(); return(new Vector3(Random.Range(topLeft2.x + 10, topRight2.x), topRight2.y + 10)); } }