using System; using Unity.VisualScripting; using UnityEngine; namespace Parking { public class Driver { public readonly ParkingPreference ParkingPreference; public readonly int Number; public readonly Size Size; public DateTime[] Times; public Spot Spot; public bool Parked = false; public GameObject GameObject; public bool Rejected = false; public Driver(Size size, int number, ParkingPreference parkingPreference) { Size = size; Number = number; ParkingPreference = parkingPreference; } public void Reset() { Parked = false; Rejected = false; if(Spot != null) Spot.Free = true; Spot = null; if(GameObject != null) GameObject.Destroy(GameObject); } } public class Spot : IComparable { public Size Size; public bool Flipped; public GameObject GameObject; public bool Free = true; public bool Reserved = false; public Driver ReservedDriver = null; public ParkingPreference ParkingDirection = ParkingPreference.Any; public Spot(Size size, bool flipped) { Size = size; Flipped = flipped; } public int CompareTo(Spot obj) { return Size.CompareTo(obj.Size); } } public enum Size { A = 0, B = 1, C = 2, D = 3 } public enum ParkingPreference { Any = 0, Front = 1, Back = 2 } }