void Update() { // Check the position in case the collision bugs out if (transform.position.y < (transform.localScale.y / 2f) + 0.1f) { // TODO: make this not ugly // case that the x is in court if (Mathf.Abs(transform.localPosition.x) < 5f) { // check whether we are on the yellow side or blue side if (transform.localPosition.z > 0f && transform.localPosition.z < 10f) { // yellow scores area.GoalTouched(RectAgent.RectTeam.Yellow); } else if (transform.localPosition.z < 0f && transform.localPosition.z > -10f) { // blue scores area.GoalTouched(RectAgent.RectTeam.Blue); } else { //oob area.OutOfBounds(area.prevTouchedTeam); } } else { // oob area.OutOfBounds(area.prevTouchedTeam); } } // Check the position for out of bounds if (Mathf.Abs(transform.localPosition.x) > 15 || Mathf.Abs(transform.localPosition.z) > 20) { area.OutOfBounds(area.prevTouchedTeam); } }
void Update() { // Check the position for out of bounds if (Mathf.Abs(transform.localPosition.x) > 15 || Mathf.Abs(transform.localPosition.z) > 20) { area.OutOfBounds(this.team); } if (Mathf.Abs(transform.localPosition.x) > 5f || Mathf.Abs(transform.localPosition.z) > 10f) { m_OutOfBoundsReward = 0f; if (Mathf.Abs(transform.localPosition.x) > 5f) { m_OutOfBoundsReward += 0.001f * (Mathf.Abs(transform.localPosition.x) - 5f); } if (Mathf.Abs(transform.localPosition.z) > 10f) { m_OutOfBoundsReward += 0.001f * (Mathf.Abs(transform.localPosition.z) - 10f); } } }