protected virtual void AddVehicleDoorManager(GameObject vehicle)
        {
            VehicleDoorManager vdm = vehicle.transform.Find("Doors").gameObject.AddComponent <VehicleDoorManager>();

            vdm.frontDoorPoints  = new List <Transform>();
            vdm.rearDoorPoints   = new List <Transform>();
            vdm.cargoDoorPoints  = new List <Transform>();
            vdm.transformsToHide = new List <Transform>();

            foreach (string s in FrontDoorTransforms)
            {
                vdm.frontDoorPoints.Add(vehicle.transform.Find(s));
            }

            foreach (string s in RearDoorTransforms)
            {
                vdm.rearDoorPoints.Add(vehicle.transform.Find(s));
            }

            foreach (string s in CargoDoorTransforms)
            {
                vdm.cargoDoorPoints.Add(vehicle.transform.Find(s));
            }

            // We call Awake() again as we patch into Awake and dont allow it to run if frontDoorPoints or rearDoorPoints is null.
            // This will only affect the VDM we just added above as all other VDM are added in the unity editor so will always be
            // an array of at least size 0.
            vdm.Awake();
        }
Ejemplo n.º 2
0
        public static bool Prefix(VehicleDoorManager __instance)
        {
            if (__instance.frontDoorPoints == null || __instance.rearDoorPoints == null)
            {
                return(false);
            }

            return(true);
        }