Esempio n. 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;
            }
        }
    }
Esempio n. 2
0
 public override void StudentExit(StudentMovement studentMoveScript)
 {
     if (studentsInside.Contains(studentMoveScript))
     {
         CancelReservation(studentMoveScript.myPolyNavAgent);
         base.StudentExit(studentMoveScript);
     }
 }
Esempio n. 3
0
 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");
     }
 }
Esempio n. 4
0
 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);
     }
 }