Esempio n. 1
0
        public Thrusters(IMyTerminalBlock referenceBlock, List <IMyTerminalBlock> blocks)
            : base(referenceBlock)
        {
            UpdateThrusters(blocks);

            Dictionary <VRageMath.Vector3, List <IMyThrust> > .ValueCollection.Enumerator enumerator = thrusterBlocks.Values.GetEnumerator();
            enumerator.MoveNext();
            IMyThrust thrust = enumerator.Current[0];

            MinAcceleration     = thrust.GetMininum <float>("Override");
            MaxAcceleration     = thrust.GetMaximum <float>("Override");
            DefaultAcceleration = thrust.GetDefaultValue <float>("Override");
        }
Esempio n. 2
0
            public void UpdateBlocks(List <IMyTerminalBlock> list)
            {
                gyros     = new List <IMyGyro>();
                thrusters = new Dictionary <VRageMath.Vector3, List <IMyThrust> >();
                VRageMath.Matrix tmp = new VRageMath.Matrix();
                for (int i = 0; i < list.Count; ++i)
                {
                    var block = list[i];
                    if (block is IMyGyro)
                    {
                        IMyGyro gyro = (IMyGyro)block;
                        if (gyros.Count == 0)
                        {
                            gyroRotateMin = gyro.GetMininum <float>(GyroAction.Pitch.GetName());
                            gyroRotateMax = gyro.GetMaximum <float>(GyroAction.Pitch.GetName());
                        }
                        gyros.Add(gyro);
                    }
                    else if (block is IMyThrust)
                    {
                        IMyThrust thruster = block as IMyThrust;

                        if (thrusters.Count == 0)
                        {
                            thrusterOverrideMin = thruster.GetMininum <float>("Override");
                            thrusterOverrideMax = thruster.GetMaximum <float>("Override");
                        }

                        block.Orientation.GetMatrix(out tmp);
                        // The exhaust is directed to the Forward vector of the thruster, so it accelerates to Backward.
                        VRageMath.Vector3 dir = tmp.Backward;
                        if (!thrusters.ContainsKey(dir))
                        {
                            thrusters[dir] = new List <IMyThrust>();
                        }
                        thrusters[dir].Add(thruster);
                    }
                }
            }