using System; using UnityEngine; using Object = UnityEngine.Object; namespace Parking { public class Driver { public readonly int Number; public readonly ParkingPreference ParkingPreference; public readonly Size Size; public GameObject GameObject; public bool Parked; public int Priority; public bool Rejected; public Spot Spot; public DateTime[] Times; public int UpdateInterval; public Driver(Size size, int number, ParkingPreference parkingPreference, int priority, int updateInterval) { Size = size; Number = number; ParkingPreference = parkingPreference; Priority = priority; UpdateInterval = updateInterval; } public void Reset() { Parked = false; Rejected = false; if (Spot != null) Spot.Free = true; Spot = null; if (GameObject != null) Object.Destroy(GameObject); } } public class Spot : IComparable { public bool AlignToTop = true; public bool Flipped; public bool Free = true; public GameObject GameObject; public int Lane = 0; public ParkingPreference ParkingDirection = ParkingPreference.Any; public bool Perpendicular = true; public bool Reserved = false; public int ReservedPriority = 0; public Size Size; public TimeSpan LastReconfiguration = TimeSpan.Zero; public Spot(Size size, bool flipped) { Size = size; Flipped = flipped; } public Spot() { } 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 } }