Example #1
0
        public void Decorate(GameObject go, ParkitectObject PO)
        {
            if (go.GetComponent <Waypoints>())
            {
                go.GetComponent <Waypoints>().waypoints = PO.waypoints;
            }
            else
            {
                go.AddComponent <Waypoints>().waypoints = PO.waypoints;
            }

            CustomFlatRide RA = go.AddComponent <CustomFlatRide>();

            RA.xSize            = (int)PO.XSize;
            RA.zSize            = (int)PO.ZSize;
            RA.excitementRating = float.Parse(PO.XMLNode["Excitement"].InnerText);
            RA.intensityRating  = float.Parse(PO.XMLNode["Intensity"].InnerText);
            RA.nauseaRating     = float.Parse(PO.XMLNode["Nausea"].InnerText);
            RestraintRotationController controller = go.AddComponent <RestraintRotationController>();

            controller.closedAngles = Loader.getVector3(PO.XMLNode["RestraintAngle"].InnerText);


            RA.motors = FlatRideLoader.LoadMotors(PO.XMLNode, go, RA);
            RA.phases = FlatRideLoader.LoadPhases(PO.XMLNode, go, RA);

            foreach (Phase P in RA.phases)
            {
                foreach (RideAnimationEvent RAE in P.Events)
                {
                    RAE.Check(RA);
                }
            }
            BasicFlatRideSettings(RA);
        }
Example #2
0
 public TSelf RotationalControllerStartOpen(String transform, Vector3 closeAngle, int order = 0)
 {
     AddStep("VEHICLE_CONSTRAINT", (payload) =>
     {
         RestraintRotationController controller = payload.Go.AddComponent <RestraintRotationController>();
         controller.transformName = transform;
         controller.closedAngles  = closeAngle;
         controller.startClosed   = false;
         controller.order         = order;
     });
     return(this as TSelf);
 }
Example #3
0
    public override void Decorate()
    {
        //Setup waypoints
        if (Object.GetComponent <Waypoints>())
        {
            Object.GetComponent <Waypoints>().waypoints = waypoints;
        }
        else
        {
            Object.AddComponent <Waypoints>().waypoints = waypoints;
        }

        //Flat Ride sSettings
        CustomFlatRide FR = Object.AddComponent <CustomFlatRide>();

        FR.xSize            = XSize;
        FR.zSize            = ZSize;
        FR.excitementRating = Excitement;
        FR.intensityRating  = Intensity;
        FR.nauseaRating     = Nausea;

        //Restraints
        RestraintRotationController controller = Object.AddComponent <RestraintRotationController>();

        controller.closedAngles = closedAngleRetraints;

        //Setup Animation
        FR.motors = Animation.motors;
        FR.phases = Animation.phases;
        foreach (Phase P in FR.phases)
        {
            foreach (RideAnimationEvent RAE in P.Events)
            {
                RAE.Check(FR);
            }
        }

        //Basic FlatRide Settings
        Debug.Log("==[Basic Settings]==");
        Debug.Log(AssetManager.Instance.rideFenceGO);
        FR.fenceGO = AssetManager.Instance.rideFenceGO;
        Debug.Log(AssetManager.Instance.attractionEntranceGO);
        FR.entranceGO = AssetManager.Instance.attractionEntranceGO;
        Debug.Log(AssetManager.Instance.attractionExitGO);
        FR.exitGO             = AssetManager.Instance.attractionExitGO;
        FR.categoryTag        = "Attractions/Flat Ride";
        FR.defaultEntranceFee = 1f;
        Debug.Log(AssetManager.Instance.flatRideEntranceExitBuilderGO);
        FR.entranceExitBuilderGO = AssetManager.Instance.flatRideEntranceExitBuilderGO;
        base.Decorate();
    }
    public override void BindToParkitect(GameObject hider, AssetBundle bundle)
    {
        BaseDecorator        baseDecorator        = DecoratorByInstance <BaseDecorator>();
        WaypointDecorator    waypointDecorator    = DecoratorByInstance <WaypointDecorator>();
        BoundingBoxDecorator boundingBoxDecorator = DecoratorByInstance <BoundingBoxDecorator>();
        ColorDecorator       colorDecorator       = DecoratorByInstance <ColorDecorator>();

        GameObject gameObject = Instantiate(bundle.LoadAsset <GameObject>(Key));

        RemapUtility.RemapMaterials(gameObject);

        waypointDecorator.Decorate(gameObject, hider, this, bundle);


        CustomFlatRide flatride = gameObject.AddComponent <CustomFlatRide>();

        baseDecorator.Decorate(gameObject, hider, this, bundle);
        colorDecorator.Decorate(gameObject, hider, this, bundle);


        _flatRide                 = flatride;
        _flatRide.name            = Key;
        flatride.xSize            = XSize;
        flatride.zSize            = ZSize;
        flatride.excitementRating = Excitement;
        flatride.intensityRating  = Intensity;
        flatride.nauseaRating     = Nausea;


        RestraintRotationController controller = gameObject.AddComponent <RestraintRotationController>();

        controller.closedAngles = ClosedAngleRetraints;


        //Basic FlatRide Settings
        flatride.fenceStyle            = AssetManager.Instance.rideFenceStyles.rideFenceStyles[0].identifier;
        flatride.entranceGO            = AssetManager.Instance.attractionEntranceGO;
        flatride.exitGO                = AssetManager.Instance.attractionExitGO;
        flatride.categoryTag           = FlatRideCategory;
        flatride.defaultEntranceFee    = 1f;
        flatride.entranceExitBuilderGO = AssetManager.Instance.flatRideEntranceExitBuilderGO;

        AssetManager.Instance.registerObject(_flatRide);
    }
        public void CreateCustomCoasterType()
        {
            TrackedRide TR    = new TrackedRide();
            GameObject  hider = new GameObject();

            char dsc = System.IO.Path.DirectorySeparatorChar;

            using (WWW www = new WWW("file://" + Path + dsc + "assetbundle" + dsc + "mod"))
            {
                AssetBundle       bundle      = www.assetBundle;
                List <Attraction> attractions = AssetManager.Instance.getAttractionObjects().ToList();
                foreach (TrackedRide attraction in attractions.OfType <TrackedRide>())
                {
                    if (attraction.getUnlocalizedName() == "Steel Coaster")
                    {
                        TR = Instantiate(attraction);
                        TR.dropsImportanceExcitement        = 0.665f;
                        TR.inversionsImportanceExcitement   = 0.673f;
                        TR.averageLatGImportanceExcitement  = 0.121f;
                        TR.accelerationImportanceExcitement = 0.525f;
                        TR.meshGenerator = ScriptableObject.CreateInstance <CustomCoasterMeshGenerator>();
                        TR.meshGenerator.stationPlatformGO   = attraction.meshGenerator.stationPlatformGO;
                        TR.meshGenerator.material            = attraction.meshGenerator.material;
                        TR.meshGenerator.liftMaterial        = attraction.meshGenerator.liftMaterial;
                        TR.meshGenerator.frictionWheelsGO    = attraction.meshGenerator.frictionWheelsGO;
                        TR.meshGenerator.supportInstantiator = attraction.meshGenerator.supportInstantiator;
                        GameObject asset = Instantiate(bundle.LoadAsset("Corkscrew Coaster@Crossbeam")) as GameObject;
                        TR.meshGenerator.crossBeamGO = SetUV(asset, 15, 14);
                        break;
                    }
                }


                /* foreach (TrackedRide attraction in attractions.OfType<TrackedRide>())
                 * {
                 *  if (attraction.getName() == "Log Flume")
                 *  {
                 *      TR.meshGenerator = Instantiate(attraction.meshGenerator);
                 *  }
                 * }*/

                int pillar    = 89;
                int center    = 100;
                int crossbeam = 255;
                int beams     = 175;

                Color[] colors = new Color[] { new Color(pillar / 255f, pillar / 255f, pillar / 255f, 1), new Color(center / 255f, center / 255f, center / 255f, 1), new Color(crossbeam / 255f, crossbeam / 255f, crossbeam / 255f, 1), new Color(beams / 255f, beams / 255f, beams / 255f, 1) };
                TR.meshGenerator.customColors = colors;
                TR.meshGenerator.customColors = colors;
                TR.setDisplayName("Corkscrew Coaster");
                TR.price = 3600;
                TR.name  = "Corkscrew_coaster_GO";
                AssetManager.Instance.registerObject(TR);

                //Get cars from assetbundle
                GameObject carGO    = bundle.LoadAsset("Corkscrew Coaster@Car") as GameObject;
                Rigidbody  carRigid = carGO.AddComponent <Rigidbody>();
                carRigid.isKinematic = true;
                carGO.AddComponent <BoxCollider>();
                GameObject frontCarGO    = bundle.LoadAsset("Corkscrew Coaster@FrontCar") as GameObject;
                Rigidbody  frontCarRigid = frontCarGO.AddComponent <Rigidbody>();
                frontCarRigid.isKinematic = true;
                frontCarGO.AddComponent <BoxCollider>();

                //Add car type
                CustomCar car      = carGO.AddComponent <CustomCar>();
                CustomCar frontCar = frontCarGO.AddComponent <CustomCar>();

                car.Decorate(carGO, false);
                frontCar.Decorate(frontCarGO, true);

                //Create Instantiator
                List <CoasterCarInstantiator> TypeList        = new List <CoasterCarInstantiator>();
                CoasterCarInstantiator        CarInstantiator = ScriptableObject.CreateInstance <CoasterCarInstantiator>();

                CarInstantiator.name = "Corkscrew Coaster@CoasterCarInstantiator";
                CarInstantiator.defaultTrainLength = 5;
                CarInstantiator.maxTrainLength     = 7;
                CarInstantiator.minTrainLength     = 2;
                CarInstantiator.carGO      = carGO;
                CarInstantiator.frontCarGO = frontCarGO;

                //Register
                AssetManager.Instance.registerObject(car);
                AssetManager.Instance.registerObject(frontCar);

                //Offset
                float CarOffset = .02f;
                car.offsetBack      = CarOffset;
                frontCar.offsetBack = CarOffset;

                //Restraints
                RestraintRotationController controller      = carGO.AddComponent <RestraintRotationController>();
                RestraintRotationController controllerFront = frontCarGO.AddComponent <RestraintRotationController>();
                controller.closedAngles      = new Vector3(0, 0, 120);
                controllerFront.closedAngles = new Vector3(0, 0, 120);

                //Custom Colors
                Color[] CarColors = new Color[] { new Color(168f / 255, 14f / 255, 14f / 255), new Color(234f / 255, 227f / 255, 227f / 255), new Color(73f / 255, 73f / 255, 73f / 255) };

                MakeRecolorble(frontCarGO, "CustomColorsDiffuse", CarColors);
                MakeRecolorble(carGO, "CustomColorsDiffuse", CarColors);

                CarInstantiator.displayName = "Corkscrew Car";
                AssetManager.Instance.registerObject(CarInstantiator);
                TypeList.Add(CarInstantiator);

                TR.carTypes = TypeList.ToArray();

                bundle.Unload(false);

                carGO.transform.parent      = hider.transform;
                frontCarGO.transform.parent = hider.transform;
                hider.SetActive(false);

                loadedList.Add(TR);
                loadedList.Add(car);
                loadedList.Add(frontCar);
                loadedList.Add(CarInstantiator);

                Debug.Log(TR.getName() + " Loaded");
            }
        }
Example #6
0
        public void AddRestraints(GameObject asset, Vector3 closeAngle)
        {
            RestraintRotationController controller = asset.AddComponent <RestraintRotationController>();

            controller.closedAngles = closeAngle;
        }