public VehicleDoor this[VehicleDoorIndex index]
        {
            get
            {
                VehicleDoor vehicleDoor = null;

                if (!_vehicleDoors.TryGetValue(index, out vehicleDoor))
                {
                    vehicleDoor = new VehicleDoor(_owner, index);
                    _vehicleDoors.Add(index, vehicleDoor);
                }

                return(vehicleDoor);
            }
        }
Esempio n. 2
0
        public VehicleDoor GetDoor(VehicleDoors door)
        {
            VehicleDoor res;

            if (m_doorCache == null)
            {
                m_doorCache = new Dictionary <VehicleDoors, VehicleDoor>();
            }
            else
            {
                if (m_doorCache.TryGetValue(door, out res))
                {
                    return(res);
                }
            }

            res = new VehicleDoor(this, door);
            m_doorCache.Add(door, res);

            return(res);
        }