void Update() { Collider2D[] colliders = Physics2D.OverlapCircleAll(new Vector2(transform.position.x, transform.position.y), inspectorRadius); foreach (Collider2D collider in colliders) { GameObject currentGameObject = collider.gameObject; StudentMovement studentMoveScript = currentGameObject.GetComponent <StudentMovement>(); LecturerMovement lecturerMoveScript = currentGameObject.GetComponent <LecturerMovement>(); Building buildingScript = currentGameObject.GetComponent <Building>(); if (studentMoveScript != null && !seenStudents.Contains(currentGameObject)) { Debug.Log($"Inspector noted {currentGameObject.GetComponent<StudentStats>().studentName}"); seenStudents.Add(currentGameObject); break; } if (lecturerMoveScript != null && !seenLecturers.Contains(currentGameObject)) { Debug.Log($"Inspector noted {currentGameObject.GetComponent<LecturerStats>().lecturerName}"); seenLecturers.Add(currentGameObject); break; } if (buildingScript != null && !seenBuildings.Contains(currentGameObject)) { Debug.Log($"Inspector noted {buildingScript.name}"); seenBuildings.Add(currentGameObject); break; } } }
public override void StudentExit(StudentMovement studentMoveScript) { if (studentsInside.Contains(studentMoveScript)) { CancelReservation(studentMoveScript.myPolyNavAgent); base.StudentExit(studentMoveScript); } }
public virtual void StudentExit(StudentMovement studentMoveScript) { if (studentsInside.Contains(studentMoveScript)) { studentsInside.Remove(studentMoveScript); studentMoveScript.ShowStudent(); } else { Debug.LogWarning("Student " + studentMoveScript.name + " tried to exit " + gameObject.name + " and failed"); } }
public bool StudentEnter(StudentMovement studentMoveScript) { if (StudentSpaceRemaining() > 0) { studentsInside.Add(studentMoveScript); studentMoveScript.HideStudent(); return(true); } else { Debug.Log("No space for student in " + gameObject.name); return(false); } }