Example #1
0
    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;
            }
        }
    }
Example #2
0
 public override void LecturerExit(LecturerMovement lecturerMoveScript)
 {
     if (lecturersInside.Contains(lecturerMoveScript))
     {
         CancelReservation(lecturerMoveScript.myPolyNavAgent);
         base.LecturerExit(lecturerMoveScript);
     }
 }
Example #3
0
 public virtual void LecturerExit(LecturerMovement lecturerMoveScript)
 {
     if (lecturersInside.Contains(lecturerMoveScript))
     {
         lecturersInside.Remove(lecturerMoveScript);
         lecturerMoveScript.ShowLecturer();
     }
     else
     {
         Debug.LogWarning("Lecturer " + lecturerMoveScript.name + " tried to exit " + gameObject.name + " and failed");
     }
 }
Example #4
0
 public bool LecturerEnter(LecturerMovement lecturerMoveScript)
 {
     if (LecturerSpaceRemaining() > 0)
     {
         lecturersInside.Add(lecturerMoveScript);
         lecturerMoveScript.HideLecturer();
         return(true);
     }
     else
     {
         Debug.Log("No space for lecturer in " + gameObject.name);
         return(false);
     }
 }