コード例 #1
0
ファイル: ChuteTemplate.cs プロジェクト: Apoapsis-A/RealChute
        //Initializes the chute
        public void Initialize()
        {
            parachute = pChute.rcModule.parachutes[id];
            this.pChute.materials.TryGetMaterial(parachute.material, ref material);
            materialsID = this.pChute.materials.GetMaterialIndex(parachute.material);
            if (this.pChute.textureLibrary != "none" && !string.IsNullOrEmpty(this.pChute.textureLibrary))
            {
                this.textures.TryGetCanopy(chuteID, ref canopy);
                this.textures.TryGetModel(modelID, ref model);
            }

            if (HighLogic.LoadedSceneIsEditor)
            {
                if (!this.pChute.initiated)
                {
                    if (this.textures.TryGetCanopy(currentCanopy, ref canopy))
                    {
                        chuteID = this.textures.GetCanopyIndex(canopy);
                    }
                    if (this.textures.TryGetModel(parachute.parachuteName, ref model, true))
                    {
                        modelID = this.textures.GetModelIndex(model);
                    }
                    if (RCUtils.types.Contains(currentType))
                    {
                        typeID = RCUtils.types.ToList().IndexOf(currentType);
                    }
                }

                preDepDiam = parachute.preDeployedDiameter.ToString();
                depDiam    = parachute.deployedDiameter.ToString();
                isPressure = parachute.minIsPressure;
                if (isPressure)
                {
                    predepClause = parachute.minPressure.ToString();
                }
                else
                {
                    predepClause = parachute.minDeployment.ToString();
                }
                deploymentAlt = parachute.deploymentAlt.ToString();
                cutAlt        = parachute.cutAlt.ToString();
                if (cutAlt == "-1")
                {
                    cutAlt = string.Empty;
                }
                preDepSpeed = parachute.preDeploymentSpeed.ToString();
                depSpeed    = parachute.deploymentSpeed.ToString();
            }
            position = this.parachute.parachute.position;

            if (HighLogic.LoadedSceneIsFlight)
            {
                UpdateCanopy();
            }
        }
コード例 #2
0
        //Initializes the chute
        public void Initialize()
        {
            this.parachute = this.pChute.rcModule.parachutes[this.id];
            MaterialsLibrary.Instance.TryGetMaterial(this.parachute.material, ref this.material);
            this.templateGUI.materialsId = MaterialsLibrary.Instance.GetMaterialIndex(this.parachute.material);

            if (HighLogic.LoadedSceneIsEditor)
            {
                if (this.Textures != null)
                {
                    if (this.templateGUI.chuteId == -1)
                    {
                        if (this.Textures.TryGetCanopy(this.CurrentCanopy, ref this.canopy))
                        {
                            this.templateGUI.chuteId = this.Textures.GetCanopyIndex(this.canopy.Name);
                        }
                        else
                        {
                            this.templateGUI.modelId = 0;
                        }
                    }

                    if (this.templateGUI.modelId == -1)
                    {
                        this.templateGUI.modelId = this.Textures.TryGetModel(this.parachute.parachuteName, ref this.model, true) ? this.Textures.GetModelIndex(this.model.Name) : 0;
                    }

                    if (this.templateGUI.TypeID == -1)
                    {
                        int index = EnumUtils.IndexOf <ParachuteType>(this.CurrentType);
                        this.templateGUI.TypeID = index != -1 ? index : 0;
                    }
                }
                else if (this.Textures != null)
                {
                    this.Textures.TryGetCanopy(this.templateGUI.chuteId, ref this.canopy);
                    this.Textures.TryGetModel(this.templateGUI.modelId, ref this.model);
                }

                this.templateGUI.preDepDiam    = this.parachute.preDeployedDiameter.ToString();
                this.templateGUI.depDiam       = this.parachute.deployedDiameter.ToString();
                this.templateGUI.isPressure    = this.parachute.minIsPressure;
                this.templateGUI.predepClause  = this.templateGUI.isPressure ? this.parachute.minPressure.ToString() : this.parachute.minDeployment.ToString();
                this.templateGUI.deploymentAlt = this.parachute.deploymentAlt.ToString();
                this.templateGUI.cutAlt        = this.parachute.cutAlt == -1 ? string.Empty : this.parachute.cutAlt.ToString();
                this.templateGUI.preDepSpeed   = this.parachute.preDeploymentSpeed.ToString();
                this.templateGUI.depSpeed      = this.parachute.deploymentSpeed.ToString();
            }
            this.position = this.parachute.parachute.position;

            if (HighLogic.LoadedSceneIsFlight)
            {
                UpdateCanopy();
            }
        }
コード例 #3
0
ファイル: RealChuteModule.cs プロジェクト: diomedea/RealChute
 //Copies stats from the info window to the symmetry counterparts
 private void CopyToCouterparts()
 {
     foreach (Part part in this.part.symmetryCounterparts)
     {
         RealChuteModule module = part.Modules["RealChuteModule"] as RealChuteModule;
         for (int i = 0; i < parachutes.Count; i++)
         {
             Parachute current = parachutes[i], counterpart = module.parachutes[i];
             counterpart.minIsPressure = current.minIsPressure;
             counterpart.minPressure   = current.minPressure;
             counterpart.minDeployment = current.minDeployment;
             counterpart.deploymentAlt = current.deploymentAlt;
         }
     }
 }
コード例 #4
0
        //Updates the canopy model
        internal void UpdateCanopy()
        {
            if (this.Textures == null)
            {
                return;
            }

            if (this.Textures.TryGetModel(this.templateGUI.modelId, ref this.model))
            {
                if (string.IsNullOrEmpty(this.Parameters.ModelURL))
                {
                    Debug.LogWarning("[RealChute]: The " + this.model.Name + " #" + (this.id + 1) + " URL is empty");
                    return;
                }

                GameObject test = GameDatabase.Instance.GetModel(this.Parameters.ModelURL);
                if (test == null)
                {
                    Debug.LogWarning("[RealChute]: The " + this.model.Name + " #" + (this.id + 1) + " GameObject is null");
                    return;
                }

                test.SetActive(true);
                float scale = RCUtils.GetDiameter(this.parachute.DeployedArea / this.model.Count) / this.model.Diameter;
                test.transform.localScale = new Vector3(scale, scale, scale);
                Debug.Log("[RealChute]: " + this.Part.partInfo.title + " " + RCUtils.ParachuteNumber(this.id) + " Scale: " + scale);

                GameObject obj = Object.Instantiate(test);
                Object.Destroy(test);
                Transform toDestroy = this.parachute.parachute;
                obj.transform.parent   = toDestroy.parent;
                obj.transform.position = toDestroy.position;
                obj.transform.rotation = toDestroy.rotation;
                Object.DestroyImmediate(toDestroy.gameObject);
                this.parachute.parachute              = this.Part.FindModelTransform(this.Parameters.TransformName);
                this.parachute.parachuteName          = this.Parameters.TransformName;
                this.parachute.deploymentAnimation    = this.Parameters.DepAnim;
                this.parachute.preDeploymentAnimation = this.Parameters.PreDepAnim;
                this.Part.InitiateAnimation(this.parachute.deploymentAnimation);
                this.Part.InitiateAnimation(this.parachute.preDeploymentAnimation);
                this.parachute.parachute.gameObject.SetActive(false);
            }

            UpdateCanopyTexture();
        }
コード例 #5
0
ファイル: ChuteTemplate.cs プロジェクト: Apoapsis-A/RealChute
        //Copies all fields to the symmetry counterpart
        public void CopyFromOriginal(RealChuteModule module, ProceduralChute pChute)
        {
            Parachute     sym      = module.parachutes[id];
            ChuteTemplate template = pChute.chutes[id];

            parachute = pChute.rcModule.parachutes[id];

            material = sym.mat;
            parachute.deployedDiameter    = sym.deployedDiameter;
            parachute.preDeployedDiameter = sym.preDeployedDiameter;
            isPressure = sym.minIsPressure;
            if (isPressure)
            {
                parachute.minPressure = sym.minPressure;
            }
            else
            {
                parachute.minDeployment = sym.minDeployment;
            }
            parachute.deploymentAlt      = sym.deploymentAlt;
            parachute.cutAlt             = sym.cutAlt;
            parachute.preDeploymentSpeed = sym.preDeploymentSpeed;
            parachute.deploymentSpeed    = sym.deploymentSpeed;
            this.chuteID       = template.chuteID;
            this.typeID        = template.typeID;
            this.modelID       = template.modelID;
            this.materialsID   = template.materialsID;
            this.isPressure    = template.isPressure;
            this.calcSelect    = template.calcSelect;
            this.getMass       = template.getMass;
            this.useDry        = template.useDry;
            this.preDepDiam    = template.preDepDiam;
            this.depDiam       = template.depDiam;
            this.predepClause  = template.predepClause;
            this.mass          = template.mass;
            this.landingSpeed  = template.landingSpeed;
            this.deceleration  = template.deceleration;
            this.refDepAlt     = template.refDepAlt;
            this.chuteCount    = template.chuteCount;
            this.deploymentAlt = template.deploymentAlt;
            this.cutAlt        = template.cutAlt;
            this.preDepSpeed   = template.preDepSpeed;
            this.depSpeed      = template.depSpeed;
        }
コード例 #6
0
        //Applies changes to the parachute
        internal void ApplyChanges(bool toSymmetryCounterparts)
        {
            this.parachute.material = this.material.name;
            this.parachute.mat      = this.material;

            if (this.templateGUI.calcSelect)
            {
                double m = this.templateGUI.getMass ? this.pChute.GetCraftMass(this.templateGUI.useDry) : double.Parse(this.templateGUI.mass);
                double alt = 0, acc = 0;
                switch (this.templateGUI.type)
                {
                case ParachuteType.Main:
                {
                    alt = double.Parse(this.pChute.landingAlt);
                    acc = (this.body.GeeASL * RCUtils.geeToAcc);
                    break;
                }

                case ParachuteType.Drogue:
                {
                    alt = double.Parse(this.templateGUI.refDepAlt);
                    acc = (this.body.GeeASL * RCUtils.geeToAcc);
                    break;
                }

                case ParachuteType.Drag:
                {
                    alt = double.Parse(this.pChute.landingAlt);
                    acc = double.Parse(this.templateGUI.deceleration);
                    break;
                }

                default:
                    break;
                }
                double density = this.body.GetDensityAtAlt(alt, this.body.GetMaxTemperatureAtAlt(alt));
                double speed   = double.Parse(this.templateGUI.landingSpeed);
                speed *= speed;

                Debug.Log(String.Format("[RealChute]: {0} {1} - m: {2}t, alt: {3}m, ρ: {4}kg/m³, v²: {5}m²/s², a: {6}m/s²", this.part.partInfo.title, RCUtils.ParachuteNumber(this.id), m, alt, density, speed, acc));

                this.parachute.deployedDiameter = RCUtils.Round(Math.Sqrt((8000 * m * acc) / (Math.PI * speed * material.dragCoefficient * density * double.Parse(this.templateGUI.chuteCount))));
                float maxDiam = (this.textures != null || this.textures.models.Count > 0) ? this.model.maxDiam : 70;
                if (this.parachute.deployedDiameter > this.model.maxDiam)
                {
                    this.parachute.deployedDiameter = maxDiam;
                    this.editorGUI.warning          = true;
                }
                else
                {
                    this.editorGUI.warning = false;
                }
                this.parachute.preDeployedDiameter = RCUtils.Round(this.templateGUI.type == ParachuteType.Main ? (this.parachute.deployedDiameter / 20) : (this.parachute.deployedDiameter / 2));
                Debug.Log(String.Format("[RealChute]: {0} {1} - depDiam: {2}m, preDepDiam: {3}m", this.part.partInfo.title, RCUtils.ParachuteNumber(this.id), this.parachute.deployedDiameter, this.parachute.preDeployedDiameter));
            }

            else
            {
                this.parachute.preDeployedDiameter = RCUtils.Round(float.Parse(this.templateGUI.preDepDiam));
                this.parachute.deployedDiameter    = RCUtils.Round(float.Parse(this.templateGUI.depDiam));
                Debug.Log(String.Format("[RealChute]: {0} {1} - depDiam: {2}m, preDepDiam: {3}m", this.part.partInfo.title, RCUtils.ParachuteNumber(this.id), this.parachute.deployedDiameter, this.parachute.preDeployedDiameter));
            }

            this.parachute.minIsPressure = this.templateGUI.isPressure;
            if (this.templateGUI.isPressure)
            {
                this.parachute.minPressure = float.Parse(this.templateGUI.predepClause);
            }
            else
            {
                this.parachute.minDeployment = float.Parse(this.templateGUI.predepClause);
            }
            this.parachute.deploymentAlt      = float.Parse(this.templateGUI.deploymentAlt);
            this.parachute.cutAlt             = GUIUtils.ParseEmpty(this.templateGUI.cutAlt);
            this.parachute.preDeploymentSpeed = float.Parse(this.templateGUI.preDepSpeed);
            this.parachute.deploymentSpeed    = float.Parse(this.templateGUI.depSpeed);

            if (toSymmetryCounterparts)
            {
                foreach (Part part in this.part.symmetryCounterparts)
                {
                    Parachute sym = ((RealChuteModule)part.Modules["RealChuteModule"]).parachutes[id];
                    sym.material            = this.material.name;
                    sym.mat                 = this.material;
                    sym.deployedDiameter    = this.parachute.deployedDiameter;
                    sym.preDeployedDiameter = this.parachute.preDeployedDiameter;
                    sym.minIsPressure       = this.templateGUI.isPressure;
                    sym.minPressure         = this.parachute.minPressure;
                    sym.minDeployment       = this.parachute.minDeployment;
                    sym.deploymentAlt       = this.parachute.deploymentAlt;
                    sym.cutAlt              = this.parachute.cutAlt;
                    sym.preDeploymentSpeed  = this.parachute.preDeploymentSpeed;
                    sym.deploymentSpeed     = this.parachute.deploymentSpeed;

                    TemplateGUI template = ((ProceduralChute)part.Modules["ProceduralChute"]).chutes[id].templateGUI;
                    template.chuteID       = this.templateGUI.chuteID;
                    template.typeID        = this.templateGUI.typeID;
                    template.modelID       = this.templateGUI.modelID;
                    template.materialsID   = this.templateGUI.materialsID;
                    template.isPressure    = this.templateGUI.isPressure;
                    template.calcSelect    = this.templateGUI.calcSelect;
                    template.getMass       = this.templateGUI.getMass;
                    template.useDry        = this.templateGUI.useDry;
                    template.preDepDiam    = this.templateGUI.preDepDiam;
                    template.depDiam       = this.templateGUI.depDiam;
                    template.predepClause  = this.templateGUI.predepClause;
                    template.mass          = this.templateGUI.mass;
                    template.landingSpeed  = this.templateGUI.landingSpeed;
                    template.deceleration  = this.templateGUI.deceleration;
                    template.refDepAlt     = this.templateGUI.refDepAlt;
                    template.chuteCount    = this.templateGUI.chuteCount;
                    template.deploymentAlt = this.templateGUI.deploymentAlt;
                    template.cutAlt        = this.templateGUI.cutAlt;
                    template.preDepSpeed   = this.templateGUI.preDepSpeed;
                    template.depSpeed      = this.templateGUI.depSpeed;
                }
            }
        }
コード例 #7
0
ファイル: ChuteTemplate.cs プロジェクト: pcwilcox/RealChute
        //Updates the canopy model
        internal void UpdateCanopy()
        {
            if (this.textures == null) { return; }
            if (this.textures.TryGetModel(this.templateGUI.modelID, ref this.model))
            {
                if (string.IsNullOrEmpty(this.parameters.modelURL))
                {
                    Debug.LogWarning("[RealChute]: The " + this.model.name + " #" + (this.id + 1) + " URL is empty");
                    return;
                }
                GameObject test = GameDatabase.Instance.GetModel(this.parameters.modelURL);
                if (test == null)
                {
                    Debug.LogWarning("[RealChute]: The " + this.model.name + " #" + (this.id + 1) + " GameObject is null");
                    return;
                }
                test.SetActive(true);
                float scale = RCUtils.GetDiameter(this.parachute.deployedArea / this.model.count) / this.model.diameter;
                test.transform.localScale = new Vector3(scale, scale, scale);
                Debug.Log("[RealChute]: " + this.part.partInfo.title + " " + RCUtils.ParachuteNumber(this.id) + " Scale: " + scale);

                GameObject obj = GameObject.Instantiate(test) as GameObject;
                GameObject.Destroy(test);
                Transform toDestroy = this.parachute.parachute;
                obj.transform.parent = toDestroy.parent;
                obj.transform.position = toDestroy.position;
                obj.transform.rotation = toDestroy.rotation;
                GameObject.DestroyImmediate(toDestroy.gameObject);
                this.parachute.parachute = this.part.FindModelTransform(this.parameters.transformName);
                this.parachute.parachuteName = this.parameters.transformName;
                this.parachute.deploymentAnimation = this.parameters.depAnim;
                this.parachute.preDeploymentAnimation = this.parameters.preDepAnim;
                this.part.InitiateAnimation(this.parachute.deploymentAnimation);
                this.part.InitiateAnimation(this.parachute.preDeploymentAnimation);
                this.parachute.parachute.gameObject.SetActive(false);
            }
            UpdateCanopyTexture();
        }
コード例 #8
0
ファイル: ChuteTemplate.cs プロジェクト: pcwilcox/RealChute
        //Initializes the chute
        public void Initialize()
        {
            this.parachute = this.pChute.rcModule.parachutes[this.id];
            this.pChute.materials.TryGetMaterial(this.parachute.material, ref this.material);
            this.templateGUI.materialsID = this.pChute.materials.GetMaterialIndex(this.parachute.material);

            if (HighLogic.LoadedSceneIsEditor)
            {
                if (this.textures != null)
                {
                    if (this.templateGUI.chuteID == -1)
                    {
                        if (this.textures.TryGetCanopy(this.currentCanopy, ref this.canopy))
                        {
                            this.templateGUI.chuteID = this.textures.GetCanopyIndex(this.canopy.name);
                        }
                        else { this.templateGUI.modelID = 0; }
                    }

                    if (this.templateGUI.modelID == -1)
                    {
                        if (this.textures.TryGetModel(this.parachute.parachuteName, ref this.model, true))
                        {
                            this.templateGUI.modelID = this.textures.GetModelIndex(this.model.name);
                        }
                        else { this.templateGUI.modelID = 0; }
                    }

                    if (this.templateGUI.typeID == -1)
                    {
                        int index = EnumUtils.IndexOf<ParachuteType>(this.currentType);
                        if (index != -1) { this.templateGUI.typeID = index; }
                        else { this.templateGUI.typeID = 0; }
                    }
                }
                else if (this.textures != null)
                {
                    this.textures.TryGetCanopy(this.templateGUI.chuteID, ref this.canopy);
                    this.textures.TryGetModel(this.templateGUI.modelID, ref this.model);
                }

                this.templateGUI.preDepDiam = this.parachute.preDeployedDiameter.ToString();
                this.templateGUI.depDiam = this.parachute.deployedDiameter.ToString();
                this.templateGUI.isPressure = this.parachute.minIsPressure;
                if (this.templateGUI.isPressure) { this.templateGUI.predepClause = this.parachute.minPressure.ToString(); }
                else { this.templateGUI.predepClause = this.parachute.minDeployment.ToString(); }
                this.templateGUI.deploymentAlt = this.parachute.deploymentAlt.ToString();
                this.templateGUI.cutAlt = this.parachute.cutAlt == -1 ? string.Empty : this.parachute.cutAlt.ToString();
                this.templateGUI.preDepSpeed = this.parachute.preDeploymentSpeed.ToString();
                this.templateGUI.depSpeed = this.parachute.deploymentSpeed.ToString();
            }
            this.position = this.parachute.parachute.position;

            if (HighLogic.LoadedSceneIsFlight) { UpdateCanopy(); }
        }
コード例 #9
0
ファイル: RealChuteModule.cs プロジェクト: diomedea/RealChute
        public override string GetInfo()
        {
            if (!CompatibilityChecker.IsAllCompatible() || ((IntPtr.Size == 8) && (Environment.OSVersion.Platform == PlatformID.Win32NT)))
            {
                return(string.Empty);
            }
            //Info in the editor part window
            float chuteMass = parachutes.Sum(p => p.mat.areaDensity * p.deployedArea);

            this.part.mass = caseMass + chuteMass;

            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("Case mass: {0}\n", caseMass);
            if (timer > 0)
            {
                builder.AppendFormat("Deployment timer: {0}s\n", timer);
            }
            if (mustGoDown)
            {
                builder.AppendLine("Must go downwards to deploy: true");
            }
            if (deployOnGround)
            {
                builder.AppendLine("Deploys on ground contact: true");
            }
            if (spareChutes >= 0)
            {
                builder.AppendFormat("Spare chutes: {0}\n", spareChutes);
            }
            builder.AppendFormat("Autocut speed: {0}m/s\n", cutSpeed);

            if (!secondaryChute)
            {
                Parachute parachute = parachutes[0];
                builder.AppendFormat("Parachute material: {0}\n", parachute.material);
                builder.AppendFormat("Drag coefficient: {0:0.00}\n", parachute.mat.dragCoefficient);
                builder.AppendFormat("Predeployed diameter: {0}m\n", parachute.preDeployedDiameter);
                builder.AppendFormat("Deployed diameter: {0}m\n", parachute.deployedDiameter);
                if (!parachute.minIsPressure)
                {
                    builder.AppendFormat("Minimum deployment altitude: {0}m\n", parachute.minDeployment);
                }
                else
                {
                    builder.AppendFormat("Minimum deployment pressure: {0}atm\n", parachute.minPressure);
                }
                builder.AppendFormat("Deployment altitude: {0}m\n", parachute.deploymentAlt);
                builder.AppendFormat("Predeployment speed: {0}s\n", parachute.preDeploymentSpeed);
                builder.AppendFormat("Deployment speed: {0}s\n", parachute.deploymentSpeed);
                if (parachute.cutAlt >= 0)
                {
                    builder.AppendFormat("Autocut altitude: {0}m", parachute.cutAlt);
                }
            }

            //In case of more than one chute
            else
            {
                builder.Append("Parachute materials: ").AppendJoin(parachutes.Select(p => p.material), ", ").AppendLine();
                builder.Append("Drag coefficients: ").AppendJoin(parachutes.Select(p => p.mat.dragCoefficient.ToString("0.00")), ", ").AppendLine();
                builder.Append("Predeployed diameters: ").AppendJoin(parachutes.Select(p => p.preDeployedDiameter.ToString()), "m, ").AppendLine("m");
                builder.Append("Deployed diameters: ").AppendJoin(parachutes.Select(p => p.deployedDiameter.ToString()), "m, ").AppendLine("m");
                builder.Append("Minimum deployment clauses: ").AppendJoin(parachutes.Select(p => p.minIsPressure ? p.minPressure + "atm" : p.minDeployment + "m"), ", ").AppendLine();
                builder.Append("Deployment altitudes: ").AppendJoin(parachutes.Select(p => p.deploymentAlt.ToString()), "m, ").AppendLine("m");
                builder.Append("Predeployment speeds: ").AppendJoin(parachutes.Select(p => p.preDeploymentSpeed.ToString()), "s, ").AppendLine("s");
                builder.Append("Deployment speeds: ").AppendJoin(parachutes.Select(p => p.deploymentSpeed.ToString()), "s, ").Append("s");
                if (parachutes.Any(p => p.cutAlt != -1))
                {
                    builder.Append("\nAutocut altitudes: ").AppendJoin(parachutes.Select(p => p.cutAlt == -1 ? "-- " : p.cutAlt + "m"), ", ");
                }
            }
            return(builder.ToString());
        }
コード例 #10
0
ファイル: RealChuteModule.cs プロジェクト: zxzxn3/RealChute
        public override string GetInfo()
        {
            if (!CompatibilityChecker.IsAllCompatible)
            {
                return(string.Empty);
            }
            //Info in the editor part window
            this.part.mass = this.caseMass + this.parachutes.Sum(p => p.ChuteMass);

            StringBuilder builder = new StringBuilder();

            builder.AppendFormat("Case mass: {0}\n", this.caseMass);
            if (this.timer > 0)
            {
                builder.AppendFormat("Deployment timer: {0}s\n", this.timer);
            }
            if (this.mustGoDown)
            {
                builder.AppendLine("Must go downwards to deploy: true");
            }
            if (this.deployOnGround)
            {
                builder.AppendLine("Deploys on ground contact: true");
            }
            if (this.spareChutes >= 0)
            {
                builder.AppendFormat("Spare chutes: {0}\n", this.spareChutes);
            }
            builder.AppendFormat("Autocut speed: {0}m/s\n", this.cutSpeed);

            if (!this.SecondaryChute)
            {
                Parachute parachute = this.parachutes[0];
                builder.AppendFormat("Parachute material: {0}\n", parachute.material);
                builder.AppendFormat("Drag coefficient: {0:0.00}\n", parachute.mat.DragCoefficient);
                builder.AppendFormat("Material max temperature: {0:0.#}°C", parachute.mat.MaxTemp + RCUtils.AbsoluteZero);
                builder.AppendFormat("Predeployed diameter: {0}m\n", parachute.preDeployedDiameter);
                builder.AppendFormat("Deployed diameter: {0}m\n", parachute.deployedDiameter);
                if (!parachute.minIsPressure)
                {
                    builder.AppendFormat("Minimum deployment altitude: {0}m\n", parachute.minDeployment);
                }
                else
                {
                    builder.AppendFormat("Minimum deployment pressure: {0}atm\n", parachute.minPressure);
                }
                builder.AppendFormat("Deployment altitude: {0}m\n", parachute.deploymentAlt);
                builder.AppendFormat("Predeployment speed: {0}s\n", parachute.preDeploymentSpeed);
                builder.AppendFormat("Deployment speed: {0}s\n", parachute.deploymentSpeed);
                if (parachute.cutAlt >= 0)
                {
                    builder.AppendFormat("Autocut altitude: {0}m", parachute.cutAlt);
                }
            }

            //In case of more than one chute
            else
            {
                builder.Append("Parachute materials: ").AppendJoin(this.parachutes.Select(p => p.material), ", ").AppendLine();
                builder.Append("Drag coefficients: ").AppendJoin(this.parachutes.Select(p => p.mat.DragCoefficient.ToString("0.00")), ", ").AppendLine();
                builder.Append("Chute max temperatures: ").AppendJoin(this.parachutes.Select(p => (p.mat.MaxTemp + RCUtils.AbsoluteZero).ToString("0.#")), "°C, ").AppendLine("°C");
                builder.Append("Predeployed diameters: ").AppendJoin(this.parachutes.Select(p => p.preDeployedDiameter.ToString()), "m, ").AppendLine("m");
                builder.Append("Deployed diameters: ").AppendJoin(this.parachutes.Select(p => p.deployedDiameter.ToString()), "m, ").AppendLine("m");
                builder.Append("Minimum deployment clauses: ").AppendJoin(this.parachutes.Select(p => p.minIsPressure ? p.minPressure + "atm" : p.minDeployment + "m"), ", ").AppendLine();
                builder.Append("Deployment altitudes: ").AppendJoin(this.parachutes.Select(p => p.deploymentAlt.ToString()), "m, ").AppendLine("m");
                builder.Append("Predeployment speeds: ").AppendJoin(this.parachutes.Select(p => p.preDeploymentSpeed.ToString()), "s, ").AppendLine("s");
                builder.Append("Deployment speeds: ").AppendJoin(this.parachutes.Select(p => p.deploymentSpeed.ToString()), "s, ").Append("s");
                if (this.parachutes.Exists(p => p.cutAlt != -1))
                {
                    builder.Append("\nAutocut altitudes: ").AppendJoin(this.parachutes.Select(p => p.cutAlt == -1 ? "-- " : p.cutAlt + "m"), ", ");
                }
            }
            return(builder.ToString());
        }
コード例 #11
0
ファイル: ChuteTemplate.cs プロジェクト: kevin-ye/RealChute
        //Initializes the chute
        public void Initialize()
        {
            parachute = pChute.rcModule.parachutes[id];
            this.pChute.materials.TryGetMaterial(parachute.material, ref material);
            materialsID = this.pChute.materials.GetMaterialIndex(parachute.material);
            if (this.pChute.textureLibrary != "none" && !string.IsNullOrEmpty(this.pChute.textureLibrary))
            {
                this.textures.TryGetCanopy(chuteID, ref canopy);
                this.textures.TryGetModel(modelID, ref model);
            }

            if (HighLogic.LoadedSceneIsEditor)
            {
                if (!this.pChute.initiated)
                {
                    if (this.textures.TryGetCanopy(currentCanopy, ref canopy)) { chuteID = this.textures.GetCanopyIndex(canopy); }
                    if (this.textures.TryGetModel(parachute.parachuteName, ref model, true)) { modelID = this.textures.GetModelIndex(model); }
                    if (RCUtils.types.Contains(currentType)) { typeID = RCUtils.types.ToList().IndexOf(currentType); }
                }

                preDepDiam = parachute.preDeployedDiameter.ToString();
                depDiam = parachute.deployedDiameter.ToString();
                isPressure = parachute.minIsPressure;
                if (isPressure) { predepClause = parachute.minPressure.ToString(); }
                else { predepClause = parachute.minDeployment.ToString(); }
                deploymentAlt = parachute.deploymentAlt.ToString();
                cutAlt = parachute.cutAlt.ToString();
                if (cutAlt == "-1") { cutAlt = string.Empty; }
                preDepSpeed = parachute.preDeploymentSpeed.ToString();
                depSpeed = parachute.deploymentSpeed.ToString();
            }
            position = this.parachute.parachute.position;

            if (HighLogic.LoadedSceneIsFlight) { UpdateCanopy(); }
        }
コード例 #12
0
ファイル: ChuteTemplate.cs プロジェクト: kevin-ye/RealChute
        //Copies all fields to the symmetry counterpart
        public void CopyFromOriginal(RealChuteModule module, ProceduralChute pChute)
        {
            Parachute sym = module.parachutes[id];
            ChuteTemplate template = pChute.chutes[id];
            parachute = pChute.rcModule.parachutes[id];

            material = sym.mat;
            parachute.deployedDiameter = sym.deployedDiameter;
            parachute.preDeployedDiameter = sym.preDeployedDiameter;
            isPressure = sym.minIsPressure;
            if (isPressure) { parachute.minPressure = sym.minPressure; }
            else { parachute.minDeployment = sym.minDeployment; }
            parachute.deploymentAlt = sym.deploymentAlt;
            parachute.cutAlt = sym.cutAlt;
            parachute.preDeploymentSpeed = sym.preDeploymentSpeed;
            parachute.deploymentSpeed = sym.deploymentSpeed;
            this.chuteID = template.chuteID;
            this.typeID = template.typeID;
            this.modelID = template.modelID;
            this.materialsID = template.materialsID;
            this.isPressure = template.isPressure;
            this.calcSelect = template.calcSelect;
            this.getMass = template.getMass;
            this.useDry = template.useDry;
            this.preDepDiam = template.preDepDiam;
            this.depDiam = template.depDiam;
            this.predepClause = template.predepClause;
            this.mass = template.mass;
            this.landingSpeed = template.landingSpeed;
            this.deceleration = template.deceleration;
            this.refDepAlt = template.refDepAlt;
            this.chuteCount = template.chuteCount;
            this.deploymentAlt = template.deploymentAlt;
            this.cutAlt = template.cutAlt;
            this.preDepSpeed = template.preDepSpeed;
            this.depSpeed = template.depSpeed;
        }
コード例 #13
0
        //Applies changes to the parachute
        internal void ApplyChanges(bool toSymmetryCounterparts)
        {
            this.parachute.material = this.material.Name;
            this.parachute.mat      = this.material;

            if (this.templateGUI.calcSelect)
            {
                double m = this.templateGUI.getMass ? this.pChute.GetCraftMass(this.templateGUI.useDry) : double.Parse(this.templateGUI.mass);
                double alt = 0, acc = 0;
                switch (this.templateGUI.Type)
                {
                case ParachuteType.MAIN:
                {
                    alt = double.Parse(this.pChute.landingAlt);
                    acc = this.Body.GeeASL * RCUtils.GeeToAcc;
                    break;
                }

                case ParachuteType.DROGUE:
                {
                    alt = double.Parse(this.templateGUI.refDepAlt);
                    acc = this.Body.GeeASL * RCUtils.GeeToAcc;
                    break;
                }

                case ParachuteType.DRAG:
                {
                    alt = double.Parse(this.pChute.landingAlt);
                    acc = double.Parse(this.templateGUI.deceleration);
                    break;
                }
                }

                double density = this.Body.GetDensityAtAlt(alt, this.Body.GetMaxTemperatureAtAlt(alt));
                double speed   = double.Parse(this.templateGUI.landingSpeed);
                speed *= speed;

                Debug.Log($"[RealChute]: {this.Part.partInfo.title} {RCUtils.ParachuteNumber(this.id)} - m: {m}t, alt: {alt}m, ρ: {density}kg/m³, v²: {speed}m²/s², a: {acc}m/s²");

                this.parachute.deployedDiameter = RCUtils.Round(Math.Sqrt((8000 * m * acc) / (Math.PI * speed * this.material.DragCoefficient * density * double.Parse(this.templateGUI.chuteCount))));
                float maxDiam = (this.Textures != null) && (this.Textures.Models.Count > 0) ? this.model.MaxDiam : 70f;
                if (this.parachute.deployedDiameter > this.model.MaxDiam)
                {
                    this.parachute.deployedDiameter = maxDiam;
                    this.EditorGUI.warning          = true;
                }
                else
                {
                    this.EditorGUI.warning = false;
                }
                this.parachute.preDeployedDiameter = RCUtils.Round(this.templateGUI.Type == ParachuteType.MAIN ? this.parachute.deployedDiameter / 20 : this.parachute.deployedDiameter / 2);
                Debug.Log($"[RealChute]: {this.Part.partInfo.title} {RCUtils.ParachuteNumber(this.id)} - depDiam: {this.parachute.deployedDiameter}m, preDepDiam: {this.parachute.preDeployedDiameter}m");
            }

            else
            {
                this.parachute.preDeployedDiameter = RCUtils.Round(float.Parse(this.templateGUI.preDepDiam));
                this.parachute.deployedDiameter    = RCUtils.Round(float.Parse(this.templateGUI.depDiam));
                Debug.Log($"[RealChute]: {this.Part.partInfo.title} {RCUtils.ParachuteNumber(this.id)} - depDiam: {this.parachute.deployedDiameter}m, preDepDiam: {this.parachute.preDeployedDiameter}m");
            }

            this.parachute.minIsPressure = this.templateGUI.isPressure;
            if (this.templateGUI.isPressure)
            {
                this.parachute.minPressure = float.Parse(this.templateGUI.predepClause);
            }
            else
            {
                this.parachute.minDeployment = float.Parse(this.templateGUI.predepClause);
            }
            this.parachute.deploymentAlt      = float.Parse(this.templateGUI.deploymentAlt);
            this.parachute.cutAlt             = GuiUtils.ParseEmpty(this.templateGUI.cutAlt);
            this.parachute.preDeploymentSpeed = float.Parse(this.templateGUI.preDepSpeed);
            this.parachute.deploymentSpeed    = float.Parse(this.templateGUI.depSpeed);

            if (toSymmetryCounterparts)
            {
                foreach (Part part in this.Part.symmetryCounterparts)
                {
                    Parachute sym = ((RealChuteModule)part.Modules["RealChuteModule"]).parachutes[this.id];
                    sym.material            = this.material.Name;
                    sym.mat                 = this.material;
                    sym.deployedDiameter    = this.parachute.deployedDiameter;
                    sym.preDeployedDiameter = this.parachute.preDeployedDiameter;
                    sym.minIsPressure       = this.templateGUI.isPressure;
                    sym.minPressure         = this.parachute.minPressure;
                    sym.minDeployment       = this.parachute.minDeployment;
                    sym.deploymentAlt       = this.parachute.deploymentAlt;
                    sym.cutAlt              = this.parachute.cutAlt;
                    sym.preDeploymentSpeed  = this.parachute.preDeploymentSpeed;
                    sym.deploymentSpeed     = this.parachute.deploymentSpeed;

                    TemplateGUI template = ((ProceduralChute)part.Modules["ProceduralChute"]).chutes[this.id].templateGUI;
                    template.chuteId       = this.templateGUI.chuteId;
                    template.TypeId        = this.templateGUI.TypeId;
                    template.modelId       = this.templateGUI.modelId;
                    template.materialsId   = this.templateGUI.materialsId;
                    template.isPressure    = this.templateGUI.isPressure;
                    template.calcSelect    = this.templateGUI.calcSelect;
                    template.getMass       = this.templateGUI.getMass;
                    template.useDry        = this.templateGUI.useDry;
                    template.preDepDiam    = this.templateGUI.preDepDiam;
                    template.depDiam       = this.templateGUI.depDiam;
                    template.predepClause  = this.templateGUI.predepClause;
                    template.mass          = this.templateGUI.mass;
                    template.landingSpeed  = this.templateGUI.landingSpeed;
                    template.deceleration  = this.templateGUI.deceleration;
                    template.refDepAlt     = this.templateGUI.refDepAlt;
                    template.chuteCount    = this.templateGUI.chuteCount;
                    template.deploymentAlt = this.templateGUI.deploymentAlt;
                    template.cutAlt        = this.templateGUI.cutAlt;
                    template.preDepSpeed   = this.templateGUI.preDepSpeed;
                    template.depSpeed      = this.templateGUI.depSpeed;
                }
            }
        }
コード例 #14
0
ファイル: ChuteTemplate.cs プロジェクト: Apoapsis-A/RealChute
        //Applies changes to the parachute
        internal void ApplyChanges(bool toSymmetryCounterparts)
        {
            parachute.material = material.name;
            parachute.mat      = material;

            if (calcSelect)
            {
                float m = 0;
                if (getMass)
                {
                    m = this.pChute.GetCraftMass(useDry);
                }
                else
                {
                    m = float.Parse(mass);
                }

                double alt     = typeID == 1 ? double.Parse(refDepAlt) : double.Parse(pChute.landingAlt);
                float  density = (float)body.GetDensityAtAlt(alt);

                float speed  = float.Parse(landingSpeed);
                float speed2 = speed * speed;

                float acc = typeID == 2 ? float.Parse(deceleration) : (float)(body.GeeASL * RCUtils.geeToAcc);

                Debug.Log(String.Concat("[RealChute]: ", this.part.partInfo.title, " ", RCUtils.ParachuteNumber(this.id), " - m: ", m, "t, alt: ", alt, "m, rho: ", density, "kg/m³, v²: ", speed2, "m²/s², acceleration: ", acc, "m/s²"));

                parachute.deployedDiameter = RCUtils.Round(Mathf.Sqrt((8000f * m * acc) / (Mathf.PI * speed2 * material.dragCoefficient * density * float.Parse(chuteCount))));
                if ((this.pChute.textureLibrary != "none" || this.textures.modelNames.Length > 0) && parachute.deployedDiameter > model.maxDiam)
                {
                    parachute.deployedDiameter = model.maxDiam;
                    this.editorGUI.warning     = true;
                }
                else if ((this.pChute.textureLibrary == "none" || this.textures.modelNames.Length <= 0) && parachute.deployedDiameter > 70f)
                {
                    parachute.deployedDiameter = 70f;
                    this.editorGUI.warning     = true;
                }
                else
                {
                    this.editorGUI.warning = false;
                }
                parachute.preDeployedDiameter = RCUtils.Round(typeID == 0 ? (parachute.deployedDiameter / 20) : (parachute.deployedDiameter / 2));
                Debug.Log(String.Concat("[RealChute]: ", this.part.partInfo.title, " ", RCUtils.ParachuteNumber(this.id), " - depDiam: ", parachute.deployedDiameter, "m, preDepDiam: ", parachute.preDeployedDiameter, "m"));
            }

            else
            {
                parachute.preDeployedDiameter = RCUtils.Round(float.Parse(preDepDiam));
                parachute.deployedDiameter    = RCUtils.Round(float.Parse(depDiam));
            }

            parachute.minIsPressure = isPressure;
            if (isPressure)
            {
                parachute.minPressure = float.Parse(predepClause);
            }
            else
            {
                parachute.minDeployment = float.Parse(predepClause);
            }
            parachute.deploymentAlt      = float.Parse(deploymentAlt);
            parachute.cutAlt             = RCUtils.ParseWithEmpty(cutAlt);
            parachute.preDeploymentSpeed = float.Parse(preDepSpeed);
            parachute.deploymentSpeed    = float.Parse(depSpeed);

            if (toSymmetryCounterparts)
            {
                foreach (Part part in this.part.symmetryCounterparts)
                {
                    Parachute sym = ((RealChuteModule)part.Modules["RealChuteModule"]).parachutes[id];
                    sym.material            = material.name;
                    sym.mat                 = material;
                    sym.deployedDiameter    = parachute.deployedDiameter;
                    sym.preDeployedDiameter = parachute.preDeployedDiameter;

                    sym.minIsPressure = isPressure;
                    if (isPressure)
                    {
                        sym.minPressure = parachute.minPressure;
                    }
                    else
                    {
                        sym.minDeployment = parachute.minDeployment;
                    }
                    sym.deploymentAlt      = parachute.deploymentAlt;
                    sym.cutAlt             = parachute.cutAlt;
                    sym.preDeploymentSpeed = parachute.preDeploymentSpeed;
                    sym.deploymentSpeed    = parachute.deploymentSpeed;

                    ChuteTemplate template = ((ProceduralChute)part.Modules["ProceduralChute"]).chutes[id];
                    template.chuteID       = this.chuteID;
                    template.typeID        = this.typeID;
                    template.modelID       = this.modelID;
                    template.materialsID   = this.materialsID;
                    template.isPressure    = this.isPressure;
                    template.calcSelect    = this.calcSelect;
                    template.getMass       = this.getMass;
                    template.useDry        = this.useDry;
                    template.preDepDiam    = this.preDepDiam;
                    template.depDiam       = this.depDiam;
                    template.predepClause  = this.predepClause;
                    template.mass          = this.mass;
                    template.landingSpeed  = this.landingSpeed;
                    template.deceleration  = this.deceleration;
                    template.refDepAlt     = this.refDepAlt;
                    template.chuteCount    = this.chuteCount;
                    template.deploymentAlt = this.deploymentAlt;
                    template.cutAlt        = this.cutAlt;
                    template.preDepSpeed   = this.preDepSpeed;
                    template.depSpeed      = this.depSpeed;
                }
            }
        }
コード例 #15
0
ファイル: RealChuteModule.cs プロジェクト: vosechu/RealChute
        public override void OnStart(PartModule.StartState state)
        {
            if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight)
            {
                return;
            }
            if (!CompatibilityChecker.IsCompatible())
            {
                foreach (BaseAction action in Actions)
                {
                    action.active = false;
                }
                foreach (BaseEvent evnt in Events)
                {
                    evnt.active          = false;
                    evnt.guiActive       = false;
                    evnt.guiActiveEditor = false;
                }
                foreach (BaseField field in Fields)
                {
                    field.guiActive       = false;
                    field.guiActiveEditor = false;
                }
                return;
            }
            //Staging icon
            this.part.stagingIcon = "PARACHUTES";

            //Autoarming checkup
            settings = RealChuteSettings.fetch;

            //Part GUI
            Events["GUIDeploy"].active             = true;
            Events["GUICut"].active                = false;
            Events["GUISecCut"].active             = false;
            Events["GUIArm"].active                = true;
            Events["GUICutBoth"].active            = false;
            Events["GUIRepack"].guiActiveUnfocused = false;
            if (spareChutes < 0)
            {
                Fields["chuteCount"].guiActive = false;
            }
            if (!secondaryChute)
            {
                Actions["ActionSecCut"].active  = false;
                Actions["ActionCutBoth"].active = false;
                Actions["ActionCut"].guiName    = "Cut chute";
                Events["GUICut"].guiName        = "Cut chute";
            }

            if (settings.autoArm)
            {
                Events["GUIArm"].active     = false;
                Actions["ActionArm"].active = false;
            }
            else
            {
                Events["GUIArm"].active     = true;
                Actions["ActionArm"].active = true;
            }

            //Tweakables tooltip
            if (this.part.Modules.Contains("ProceduralChute") || !isTweakable)
            {
                foreach (BaseField field in Fields)
                {
                    field.guiActiveEditor = false;
                }
            }
            else if (!secondaryChute)
            {
                Fields["secPreDeployedDiameter"].guiActiveEditor = false;
                Fields["secDeployedDiameter"].guiActiveEditor    = false;
                Fields["secMinIsPressure"].guiActiveEditor       = false;
                Fields["secMinDeployment"].guiActiveEditor       = false;
                Fields["secMinPressure"].guiActiveEditor         = false;
                Fields["secDeploymentAlt"].guiActiveEditor       = false;
                Fields["secCutAlt"].guiActiveEditor             = false;
                Fields["secPreDeploymentSpeed"].guiActiveEditor = false;
                Fields["secDeploymentSpeed"].guiActiveEditor    = false;
            }

            //Initiates animations
            anim = this.part.FindModelAnimators(capName).FirstOrDefault();

            //Initiates the Parachutes
            main = new Parachute(this, false);
            if (secondaryChute)
            {
                secondary = new Parachute(this, true);
            }

            //First initiation of the part
            if (!initiated)
            {
                initiated     = true;
                capOff        = false;
                armed         = false;
                this.baseDrag = this.part.maximum_drag;
                if (spareChutes >= 0)
                {
                    chuteCount = (int)spareChutes;
                }
            }

            //Flight loading
            if (HighLogic.LoadedSceneIsFlight)
            {
                //If the part has been staged in the past
                if (capOff)
                {
                    this.part.stackIcon.SetIconColor(XKCDColors.Red);
                }
                System.Random random = new System.Random();
                main.randomTime = (float)random.NextDouble();
                if (secondaryChute)
                {
                    secondary.randomTime = (float)random.NextDouble();
                }
            }

            //GUI
            window = new Rect(200, 100, 350, 400);
        }
コード例 #16
0
ファイル: RealChuteModule.cs プロジェクト: vosechu/RealChute
        public override void OnStart(PartModule.StartState state)
        {
            if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight) { return; }
            if (!CompatibilityChecker.IsCompatible())
            {
                foreach (BaseAction action in Actions)
                {
                    action.active = false;
                }
                foreach (BaseEvent evnt in Events)
                {
                    evnt.active = false;
                    evnt.guiActive = false;
                    evnt.guiActiveEditor = false;
                }
                foreach (BaseField field in Fields)
                {
                    field.guiActive = false;
                    field.guiActiveEditor = false;
                }
                return;
            }
            //Staging icon
            this.part.stagingIcon = "PARACHUTES";

            //Autoarming checkup
            settings = RealChuteSettings.fetch;

            //Part GUI
            Events["GUIDeploy"].active = true;
            Events["GUICut"].active = false;
            Events["GUISecCut"].active = false;
            Events["GUIArm"].active = true;
            Events["GUICutBoth"].active = false;
            Events["GUIRepack"].guiActiveUnfocused = false;
            if (spareChutes < 0) { Fields["chuteCount"].guiActive = false; }
            if (!secondaryChute)
            {
                Actions["ActionSecCut"].active = false;
                Actions["ActionCutBoth"].active = false;
                Actions["ActionCut"].guiName = "Cut chute";
                Events["GUICut"].guiName = "Cut chute";
            }

            if (settings.autoArm)
            {
                Events["GUIArm"].active = false;
                Actions["ActionArm"].active = false;
            }
            else
            {
                Events["GUIArm"].active = true;
                Actions["ActionArm"].active = true;
            }

            //Tweakables tooltip
            if (this.part.Modules.Contains("ProceduralChute") || !isTweakable)
            {
                foreach (BaseField field in Fields)
                {
                    field.guiActiveEditor = false;
                }
            }
            else if (!secondaryChute)
            {
                Fields["secPreDeployedDiameter"].guiActiveEditor = false;
                Fields["secDeployedDiameter"].guiActiveEditor = false;
                Fields["secMinIsPressure"].guiActiveEditor = false;
                Fields["secMinDeployment"].guiActiveEditor = false;
                Fields["secMinPressure"].guiActiveEditor = false;
                Fields["secDeploymentAlt"].guiActiveEditor = false;
                Fields["secCutAlt"].guiActiveEditor = false;
                Fields["secPreDeploymentSpeed"].guiActiveEditor = false;
                Fields["secDeploymentSpeed"].guiActiveEditor = false;
            }

            //Initiates animations
            anim = this.part.FindModelAnimators(capName).FirstOrDefault();

            //Initiates the Parachutes
            main = new Parachute(this, false);
            if (secondaryChute) { secondary = new Parachute(this, true); }

            //First initiation of the part
            if (!initiated)
            {
                initiated = true;
                capOff = false;
                armed = false;
                this.baseDrag = this.part.maximum_drag;
                if (spareChutes >= 0) { chuteCount = (int)spareChutes; }
            }

            //Flight loading
            if (HighLogic.LoadedSceneIsFlight)
            {
                //If the part has been staged in the past
                if (capOff)
                {
                    this.part.stackIcon.SetIconColor(XKCDColors.Red);
                }
                System.Random random = new System.Random();
                main.randomTime = (float)random.NextDouble();
                if (secondaryChute) { secondary.randomTime = (float)random.NextDouble(); }
            }

            //GUI
            window = new Rect(200, 100, 350, 400);
        }