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 override void Check(CustomFlatRide RA)
 {
     foreach (RotatorHP R in RA.motors.OfType<RotatorHP>().ToList())
         if (R.Identifier == identifierMotor)
             rotator = R;
     base.Check(RA);
 }
Example #3
0
 public override void Check(CustomFlatRide RA)
 {
     foreach (PendulumRotatorHP R in RA.motors.OfType<PendulumRotatorHP>().ToList())
         if (R.Identifier == identifierMotor)
         {
             rotator = R;
         }
     base.Check(RA);
 }
Example #4
0
 public override void Check(CustomFlatRide RA)
 {
     foreach (MultipleRotationsHP R in RA.motors.OfType<MultipleRotationsHP>().ToList())
         if (R.Identifier == identifierMotor)
         {
             rotator = R;
         }
     base.Check(RA);
 }
Example #5
0
    public static List <motor> LoadMotors(XmlNode ObjNode, GameObject GO, CustomFlatRide CFR)
    {
        List <motor> motors = new List <motor>();

        foreach (XmlNode motorN in ObjNode.SelectSingleNode("Animation/motors").ChildNodes)
        {
            switch (motorN.Name)
            {
            case "Rotator":
                RotatorHP R = GO.AddComponent <RotatorHP>();
                R.Identifier        = motorN["Identifier"].InnerText;
                R.axisPath          = motorN["axis"].InnerText;
                R.axis              = GO.transform.FindChild(motorN["axis"].InnerText);
                R.maxSpeed          = float.Parse(motorN["maxSpeed"].InnerText);
                R.accelerationSpeed = float.Parse(motorN["accelerationSpeed"].InnerText);
                R.rotationAxis      = getVector3(motorN["rotationAxis"].InnerText);
                motors.Add(R);
                break;

            case "RotateBetween":
                RotateBetweenHP RB = GO.AddComponent <RotateBetweenHP>();
                RB.Identifier   = motorN["Identifier"].InnerText;
                RB.axisPath     = motorN["axis"].InnerText;
                RB.axis         = GO.transform.FindChild(motorN["axis"].InnerText);
                RB.rotationAxis = getVector3(motorN["rotationAxis"].InnerText);
                RB.duration     = float.Parse(motorN["duration"].InnerText);
                motors.Add(RB);
                break;

            case "Mover":
                MoverHP M = GO.AddComponent <MoverHP>();
                M.Identifier = motorN["Identifier"].InnerText;
                M.axisPath   = motorN["axis"].InnerText;
                M.axis       = GO.transform.FindChild(motorN["axis"].InnerText);
                M.toPosition = getVector3(motorN["toPosition"].InnerText);
                M.duration   = float.Parse(motorN["duration"].InnerText);
                motors.Add(M);
                break;

            case "MultipleRotations":
                MultipleRotationsHP MR = GO.AddComponent <MultipleRotationsHP>();
                MR.Identifier = motorN["Identifier"].InnerText;
                MR.axisPath   = motorN["MainAxis"].InnerText;
                XmlNodeList axisNs = motorN.SelectNodes("axis");
                foreach (XmlNode axisN in axisNs)
                {
                    MR.AxissPath.Add(axisN.InnerText);
                }
                motors.Add(MR);
                break;
            }
        }

        return(motors);

        throw new NotImplementedException();
    }
Example #6
0
    public static List<motor> LoadMotors(XmlNode ObjNode, GameObject GO, CustomFlatRide CFR)
    {
        List<motor> motors = new List<motor>();
        
        foreach(XmlNode motorN in ObjNode.SelectSingleNode("Animation/motors").ChildNodes)
        {
            switch(motorN.Name)
            {
                
                case "Rotator":
                    RotatorHP R = GO.AddComponent<RotatorHP>();
                    R.Identifier = motorN["Identifier"].InnerText;
                    R.axisPath = motorN["axis"].InnerText;
                    R.axis = GO.transform.FindChild(motorN["axis"].InnerText);
                    R.maxSpeed = float.Parse(motorN["maxSpeed"].InnerText);
                    R.accelerationSpeed = float.Parse(motorN["accelerationSpeed"].InnerText);
                    R.rotationAxis = getVector3(motorN["rotationAxis"].InnerText);
                    motors.Add(R);
                    break;
                case "RotateBetween":
                    RotateBetweenHP RB = GO.AddComponent<RotateBetweenHP>();
                    RB.Identifier = motorN["Identifier"].InnerText;
                    RB.axisPath = motorN["axis"].InnerText;
                    RB.axis = GO.transform.FindChild(motorN["axis"].InnerText);
                    RB.rotationAxis = getVector3(motorN["rotationAxis"].InnerText);
                    RB.duration = float.Parse(motorN["duration"].InnerText);
                    motors.Add(RB);
                    break;
                case "Mover":
                    MoverHP M = GO.AddComponent<MoverHP>();
                    M.Identifier = motorN["Identifier"].InnerText;
                    M.axisPath = motorN["axis"].InnerText;
                    M.axis = GO.transform.FindChild(motorN["axis"].InnerText);
                    M.toPosition = getVector3(motorN["toPosition"].InnerText);
                    M.duration = float.Parse(motorN["duration"].InnerText);
                    motors.Add(M);
                    break;
                case "MultipleRotations":
                    MultipleRotationsHP MR = GO.AddComponent<MultipleRotationsHP>();
                    MR.Identifier = motorN["Identifier"].InnerText;
                    MR.axisPath = motorN["MainAxis"].InnerText;
                    XmlNodeList axisNs = motorN.SelectNodes("axis");
                    foreach (XmlNode axisN in axisNs)
                    {
                        MR.AxissPath.Add(axisN.InnerText);
                    }
                    motors.Add(MR);
                    break;

            }
        }

        return motors;
        throw new NotImplementedException();
    }
Example #7
0
 public override void Check(CustomFlatRide RA)
 {
     foreach (MultipleRotationsHP R in RA.motors.OfType <MultipleRotationsHP>().ToList())
     {
         if (R.Identifier == identifierMotor)
         {
             rotator = R;
         }
     }
     base.Check(RA);
 }
Example #8
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);
    }
Example #10
0
 public virtual void Check(CustomFlatRide RA)
 {
 }
Example #11
0
    public static List <Phase> LoadPhases(XmlNode ObjNode, GameObject GO, CustomFlatRide CFR)
    {
        List <Phase> Phases = new List <Phase>();

        foreach (XmlNode PhaseN in ObjNode.SelectSingleNode("Animation/phases").ChildNodes)
        {
            Phase phase = GO.AddComponent <Phase>();
            foreach (XmlNode EventN in PhaseN.SelectSingleNode("events").ChildNodes)
            {
                switch (EventN.Name)
                {
                case "Wait":
                    Wait W = GO.AddComponent <Wait>();
                    W.seconds = float.Parse(EventN["Seconds"].InnerText);
                    phase.Events.Add(W);
                    break;

                case "StartRotator":
                    StartRotator SR = GO.AddComponent <StartRotator>();
                    SR.identifierMotor = EventN["Identifier"].InnerText;
                    phase.Events.Add(SR);
                    break;

                case "SpinRotator":
                    SpinRotater SpR = GO.AddComponent <SpinRotater>();
                    SpR.identifierMotor = EventN["Identifier"].InnerText;
                    SpR.spin            = Boolean.Parse(EventN["spin"].InnerText);
                    SpR.spins           = float.Parse(EventN["spins"].InnerText);
                    phase.Events.Add(SpR);
                    break;

                case "StopRotator":
                    StopRotator StR = GO.AddComponent <StopRotator>();
                    StR.identifierMotor = EventN["Identifier"].InnerText;
                    phase.Events.Add(StR);
                    break;

                case "FromToRot":
                    FromToRot FTR = GO.AddComponent <FromToRot>();
                    FTR.identifierMotor = EventN["Identifier"].InnerText;
                    phase.Events.Add(FTR);
                    break;

                case "ToFromRot":
                    ToFromRot TFR = GO.AddComponent <ToFromRot>();
                    TFR.identifierMotor = EventN["Identifier"].InnerText;
                    phase.Events.Add(TFR);
                    break;

                case "FromToMove":
                    FromToMove FTM = GO.AddComponent <FromToMove>();
                    FTM.identifierMotor = EventN["Identifier"].InnerText;
                    phase.Events.Add(FTM);
                    break;

                case "ToFromMove":
                    ToFromMove TFM = GO.AddComponent <ToFromMove>();
                    TFM.identifierMotor = EventN["Identifier"].InnerText;
                    phase.Events.Add(TFM);
                    break;

                case "ApplyRotation":
                    ApplyRotation AR = GO.AddComponent <ApplyRotation>();
                    AR.identifierMotor = EventN["Identifier"].InnerText;
                    phase.Events.Add(AR);
                    break;

                case "ChangePendulum":
                    ChangePendulum CP = GO.AddComponent <ChangePendulum>();
                    CP.identifierMotor = EventN["Identifier"].InnerText;
                    CP.Friction        = float.Parse(EventN["Friction"].InnerText);
                    CP.Pendulum        = Boolean.Parse(EventN["Pendulum"].InnerText);
                    phase.Events.Add(CP);
                    break;

                default:
                    Debug.Log("Couln't detect the right event called: " + EventN.Name);
                    break;
                }
            }

            Phases.Add(phase);
        }
        return(Phases);

        throw new NotImplementedException();
    }
Example #12
0
    public static List<Phase> LoadPhases(XmlNode ObjNode, GameObject GO, CustomFlatRide CFR)
    {
        List<Phase> Phases = new List<Phase>();

        foreach (XmlNode PhaseN in ObjNode.SelectSingleNode("Animation/phases").ChildNodes)
        {

            Phase phase = GO.AddComponent<Phase>();
            foreach (XmlNode EventN in PhaseN.SelectSingleNode("events").ChildNodes)
            {

                switch (EventN.Name)
                {
                    case "Wait":
                        Wait W = GO.AddComponent<Wait>();
                        W.seconds = float.Parse(EventN["Seconds"].InnerText);
                        phase.Events.Add(W);
                        break;
                    case "StartRotator":
                        StartRotator SR = GO.AddComponent<StartRotator>();
                        SR.identifierMotor = EventN["Identifier"].InnerText;
                        phase.Events.Add(SR);
                        break;
                    case "SpinRotator":
                        SpinRotater SpR = GO.AddComponent<SpinRotater>();
                        SpR.identifierMotor = EventN["Identifier"].InnerText;
                        SpR.spin = Boolean.Parse(EventN["spin"].InnerText);
                        SpR.spins = Int32.Parse(EventN["spins"].InnerText);
                        phase.Events.Add(SpR);
                        break;
                    case "StopRotator":
                        StopRotator StR = GO.AddComponent<StopRotator>();
                        StR.identifierMotor = EventN["Identifier"].InnerText;
                        phase.Events.Add(StR);
                        break;
                    case "FromToRot":
                        FromToRot FTR = GO.AddComponent<FromToRot>();
                        FTR.identifierMotor = EventN["Identifier"].InnerText;
                        phase.Events.Add(FTR);
                        break;
                    case "ToFromRot":
                        ToFromRot TFR = GO.AddComponent<ToFromRot>();
                        TFR.identifierMotor = EventN["Identifier"].InnerText;
                        phase.Events.Add(TFR);
                        break;
                    case "FromToMove":
                        FromToMove FTM = GO.AddComponent<FromToMove>();
                        FTM.identifierMotor = EventN["Identifier"].InnerText;
                        phase.Events.Add(FTM);
                        break;
                    case "ToFromMove":
                        ToFromMove TFM = GO.AddComponent<ToFromMove>();
                        TFM.identifierMotor = EventN["Identifier"].InnerText;
                        phase.Events.Add(TFM);
                        break;
                    case "ApplyRotation":
                        ApplyRotation AR = GO.AddComponent<ApplyRotation>();
                        AR.identifierMotor = EventN["Identifier"].InnerText;
                        phase.Events.Add(AR);
                        break;

                }
            }

            Phases.Add(phase);
        }
        return Phases;

        throw new NotImplementedException();
    }
Example #13
0
    public virtual void Check(CustomFlatRide RA)
    {

    }