コード例 #1
0
ファイル: Thruster.cs プロジェクト: charlierix/AsteroidMiner
        public ThrusterToolItem(EditorOptions options, ThrusterType thrusterType)
            : base(options)
        {
            if (thrusterType == ThrusterType.Custom)
            {
                throw new ArgumentException("Can't pass custom into this overload");
            }

            this.ThrusterType = thrusterType;

            _subName = thrusterType.ToString().ToLower().Replace('_', ' ');
            _directions = null;

            this.TabName = PartToolItemBase.TAB_SHIPPART;

            _visual2D = PartToolItemBase.GetVisual2D(this.Name, this.Description, options, this);
        }
コード例 #2
0
ファイル: Thruster.cs プロジェクト: charlierix/AsteroidMiner
        public static Vector3D[] GetThrusterDirections(ThrusterType thrusterType)
        {
            Vector3D[] retVal = null;

            switch (thrusterType)
            {
                case ThrusterType.One:
                    #region OneWay

                    // Directions
                    retVal = new Vector3D[1];
                    retVal[0] = new Vector3D(0, 0, 1);		// the visual's bottle points down, but the thrust is up

                    #endregion
                    break;

                case ThrusterType.Two:
                    #region TwoWay

                    // Directions
                    retVal = new Vector3D[2];
                    retVal[0] = new Vector3D(0, 0, 1);
                    retVal[1] = new Vector3D(0, 0, -1);

                    #endregion
                    break;

                case ThrusterType.Two_One:
                    #region Two_One

                    // Directions
                    retVal = new Vector3D[3];
                    retVal[0] = new Vector3D(0, 0, 1);
                    retVal[1] = new Vector3D(0, 0, -1);
                    retVal[2] = new Vector3D(1, 0, 0);

                    #endregion
                    break;

                case ThrusterType.Two_Two:
                    #region Two_Two

                    // Directions
                    retVal = new Vector3D[4];
                    retVal[0] = new Vector3D(0, 0, 1);
                    retVal[1] = new Vector3D(0, 0, -1);
                    retVal[2] = new Vector3D(1, 0, 0);
                    retVal[3] = new Vector3D(-1, 0, 0);

                    #endregion
                    break;

                case ThrusterType.Two_Two_One:
                    #region Two_Two_One

                    // Directions
                    retVal = new Vector3D[5];
                    retVal[0] = new Vector3D(0, 0, 1);
                    retVal[1] = new Vector3D(0, 0, -1);
                    retVal[2] = new Vector3D(1, 0, 0);
                    retVal[3] = new Vector3D(-1, 0, 0);
                    retVal[4] = new Vector3D(0, 1, 0);

                    #endregion
                    break;

                case ThrusterType.Two_Two_Two:
                    #region Two_Two_Two

                    // Directions
                    retVal = new Vector3D[6];
                    retVal[0] = new Vector3D(0, 0, 1);
                    retVal[1] = new Vector3D(0, 0, -1);
                    retVal[2] = new Vector3D(1, 0, 0);
                    retVal[3] = new Vector3D(-1, 0, 0);
                    retVal[4] = new Vector3D(0, 1, 0);
                    retVal[5] = new Vector3D(0, -1, 0);

                    #endregion
                    break;

                case ThrusterType.Custom:
                    #region Custom

                    throw new ApplicationException("finish implementing custom thrusters");

                    #endregion
                    break;

                default:
                    throw new ApplicationException("Unknown ThrusterType: " + thrusterType.ToString());
            }

            // Exit Function
            return retVal;
        }