Esempio n. 1
0
        /// <summary>
        /// Creates a vanilla Turret that will be at the given location and 
        /// facing the given rotation. The turret is able to turn at the given
        /// speed and is controlled with the given keyboard Device.
        /// </summary>
        /// <param name="location">Location of the TurretHead in game</param>
        /// <param name="rotation">Rotation the TurretHead is facing</param>
        /// <param name="scale">Scale of the TurretHead</param>
        /// <param name="turretRotationSpeed">
        /// Speed the TurretHead can rotate at
        /// </param>
        /// <param name="keyboard">
        /// Keyboard Device used to control the TurretHead
        /// </param>
        public TurretHead(Vector3 location, Vector3 rotation, Vector3 scale, float headRotationSpeed, float barrelRotationSpeed, DI.Device keyboard)
            : base(location, rotation, scale)
        {
            this.headRotationSpeed = headRotationSpeed;
            this.barrelRotationSpeed = barrelRotationSpeed;
            this.keyboard = keyboard;
            this.barrels = new List<TurretBarrel>();

            this.scripts.Add(new TurretHeadRotationScript(this));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a single TurretBarrel which will be represented by the
        /// given Model at the given location facing the given rotation. The
        /// TurretBarrel will be controlled by the given keyboard Device.
        /// </summary>
        /// <param name="barrelModel">
        /// Model to represent the TurretBarrel
        /// </param>
        /// <param name="location">Location of the TurretBarrel</param>
        /// <param name="rotation">Rotation the TurretBarrel is facing</param>
        /// <param name="scale">Scale of the TurretBarrel</param>
        /// <param name="keyboard">
        /// Keyboard Device used to control the TurretBarrel
        /// </param>
        public TurretBarrel(Vector3 location, Vector3 rotation, Vector3 scale, Model barrelModel, float maxRotation,
            float minRotation, float shootDelay, float pushSpeed, float pullSpeed, DI.Device keyboard)
            : base(location, rotation, scale)
        {
            this.keyboard = keyboard;
            this.minRotation = minRotation;
            this.maxRotation = maxRotation;
            this.drawLocation = location;
            this.shootDelay = shootDelay;
            this.pushSpeed = pushSpeed;
            this.pullSpeed = pullSpeed;

            this.models.Add(barrelModel);
            this.scripts.Add(new TurretShootScript(this));
        }
        /// <summary>
        ///		Used to convert a DirectInput.Key enum val to a Axiom.Input.KeyCodes enum val.
        /// </summary>
        /// <param name="key">DirectInput.Key code to query.</param>
        /// <returns>The equivalent enum value in the Axiom.KeyCodes enum.</returns>
        private Axiom.Input.KeyCodes ConvertKeyEnum(DInput.Key key)
        {
            // TODO: Quotes
            Axiom.Input.KeyCodes axiomKey = 0;

            switch(key) {
                case DInput.Key.SysRq:
                    axiomKey = Axiom.Input.KeyCodes.PrintScreen;
                    break;
                case DInput.Key.A:
                    axiomKey = Axiom.Input.KeyCodes.A;
                    break;
                case DInput.Key.B:
                    axiomKey = Axiom.Input.KeyCodes.B;
                    break;
                case DInput.Key.C:
                    axiomKey = Axiom.Input.KeyCodes.C;
                    break;
                case DInput.Key.D:
                    axiomKey = Axiom.Input.KeyCodes.D;
                    break;
                case DInput.Key.E:
                    axiomKey = Axiom.Input.KeyCodes.E;
                    break;
                case DInput.Key.F:
                    axiomKey = Axiom.Input.KeyCodes.F;
                    break;
                case DInput.Key.G:
                    axiomKey = Axiom.Input.KeyCodes.G;
                    break;
                case DInput.Key.H:
                    axiomKey = Axiom.Input.KeyCodes.H;
                    break;
                case DInput.Key.I:
                    axiomKey = Axiom.Input.KeyCodes.I;
                    break;
                case DInput.Key.J:
                    axiomKey = Axiom.Input.KeyCodes.J;
                    break;
                case DInput.Key.K:
                    axiomKey = Axiom.Input.KeyCodes.K;
                    break;
                case DInput.Key.L:
                    axiomKey = Axiom.Input.KeyCodes.L;
                    break;
                case DInput.Key.M:
                    axiomKey = Axiom.Input.KeyCodes.M;
                    break;
                case DInput.Key.N:
                    axiomKey = Axiom.Input.KeyCodes.N;
                    break;
                case DInput.Key.O:
                    axiomKey = Axiom.Input.KeyCodes.O;
                    break;
                case DInput.Key.P:
                    axiomKey = Axiom.Input.KeyCodes.P;
                    break;
                case DInput.Key.Q:
                    axiomKey = Axiom.Input.KeyCodes.Q;
                    break;
                case DInput.Key.R:
                    axiomKey = Axiom.Input.KeyCodes.R;
                    break;
                case DInput.Key.S:
                    axiomKey = Axiom.Input.KeyCodes.S;
                    break;
                case DInput.Key.T:
                    axiomKey = Axiom.Input.KeyCodes.T;
                    break;
                case DInput.Key.U:
                    axiomKey = Axiom.Input.KeyCodes.U;
                    break;
                case DInput.Key.V:
                    axiomKey = Axiom.Input.KeyCodes.V;
                    break;
                case DInput.Key.W:
                    axiomKey = Axiom.Input.KeyCodes.W;
                    break;
                case DInput.Key.X:
                    axiomKey = Axiom.Input.KeyCodes.X;
                    break;
                case DInput.Key.Y:
                    axiomKey = Axiom.Input.KeyCodes.Y;
                    break;
                case DInput.Key.Z:
                    axiomKey = Axiom.Input.KeyCodes.Z;
                    break;
                case DInput.Key.LeftArrow :
                    axiomKey = Axiom.Input.KeyCodes.Left;
                    break;
                case DInput.Key.RightArrow:
                    axiomKey = Axiom.Input.KeyCodes.Right;
                    break;
                case DInput.Key.UpArrow:
                    axiomKey = Axiom.Input.KeyCodes.Up;
                    break;
                case DInput.Key.DownArrow:
                    axiomKey = Axiom.Input.KeyCodes.Down;
                    break;
                case DInput.Key.Escape:
                    axiomKey = Axiom.Input.KeyCodes.Escape;
                    break;
                case DInput.Key.F1:
                    axiomKey = Axiom.Input.KeyCodes.F1;
                    break;
                case DInput.Key.F2:
                    axiomKey = Axiom.Input.KeyCodes.F2;
                    break;
                case DInput.Key.F3:
                    axiomKey = Axiom.Input.KeyCodes.F3;
                    break;
                case DInput.Key.F4:
                    axiomKey = Axiom.Input.KeyCodes.F4;
                    break;
                case DInput.Key.F5:
                    axiomKey = Axiom.Input.KeyCodes.F5;
                    break;
                case DInput.Key.F6:
                    axiomKey = Axiom.Input.KeyCodes.F6;
                    break;
                case DInput.Key.F7:
                    axiomKey = Axiom.Input.KeyCodes.F7;
                    break;
                case DInput.Key.F8:
                    axiomKey = Axiom.Input.KeyCodes.F8;
                    break;
                case DInput.Key.F9:
                    axiomKey = Axiom.Input.KeyCodes.F9;
                    break;
                case DInput.Key.F10:
                    axiomKey = Axiom.Input.KeyCodes.F10;
                    break;
                case DInput.Key.D0:
                    axiomKey = Axiom.Input.KeyCodes.D0;
                    break;
                case DInput.Key.D1:
                    axiomKey = Axiom.Input.KeyCodes.D1;
                    break;
                case DInput.Key.D2:
                    axiomKey = Axiom.Input.KeyCodes.D2;
                    break;
                case DInput.Key.D3:
                    axiomKey = Axiom.Input.KeyCodes.D3;
                    break;
                case DInput.Key.D4:
                    axiomKey = Axiom.Input.KeyCodes.D4;
                    break;
                case DInput.Key.D5:
                    axiomKey = Axiom.Input.KeyCodes.D5;
                    break;
                case DInput.Key.D6:
                    axiomKey = Axiom.Input.KeyCodes.D6;
                    break;
                case DInput.Key.D7:
                    axiomKey = Axiom.Input.KeyCodes.D7;
                    break;
                case DInput.Key.D8:
                    axiomKey = Axiom.Input.KeyCodes.D8;
                    break;
                case DInput.Key.D9:
                    axiomKey = Axiom.Input.KeyCodes.D9;
                    break;
                case DInput.Key.F11:
                    axiomKey = Axiom.Input.KeyCodes.F11;
                    break;
                case DInput.Key.F12:
                    axiomKey = Axiom.Input.KeyCodes.F12;
                    break;
                case DInput.Key.Return:
                    axiomKey = Axiom.Input.KeyCodes.Enter;
                    break;
                case DInput.Key.Tab:
                    axiomKey = Axiom.Input.KeyCodes.Tab;
                    break;
                case DInput.Key.LeftShift:
                    axiomKey = Axiom.Input.KeyCodes.LeftShift;
                    break;
                case DInput.Key.RightShift:
                    axiomKey = Axiom.Input.KeyCodes.RightShift;
                    break;
                case DInput.Key.LeftControl:
                    axiomKey = Axiom.Input.KeyCodes.LeftControl;
                    break;
                case DInput.Key.RightControl:
                    axiomKey = Axiom.Input.KeyCodes.RightControl;
                    break;
                case DInput.Key.Period:
                    axiomKey = Axiom.Input.KeyCodes.Period;
                    break;
                case DInput.Key.Comma:
                    axiomKey = Axiom.Input.KeyCodes.Comma;
                    break;
                case DInput.Key.Home:
                    axiomKey = Axiom.Input.KeyCodes.Home;
                    break;
                case DInput.Key.PageUp:
                    axiomKey = Axiom.Input.KeyCodes.PageUp;
                    break;
                case DInput.Key.PageDown:
                    axiomKey = Axiom.Input.KeyCodes.PageDown;
                    break;
                case DInput.Key.End:
                    axiomKey = Axiom.Input.KeyCodes.End;
                    break;
                case DInput.Key.SemiColon:
                    axiomKey = Axiom.Input.KeyCodes.Semicolon;
                    break;
                case DInput.Key.Subtract:
                    axiomKey = Axiom.Input.KeyCodes.Subtract;
                    break;
                case DInput.Key.Add:
                    axiomKey = Axiom.Input.KeyCodes.Add;
                    break;
                case DInput.Key.BackSpace:
                    axiomKey = Axiom.Input.KeyCodes.Backspace;
                    break;
                case DInput.Key.Delete:
                    axiomKey = Axiom.Input.KeyCodes.Delete;
                    break;
                case DInput.Key.Insert:
                    axiomKey = Axiom.Input.KeyCodes.Insert;
                    break;
                case DInput.Key.LeftAlt:
                    axiomKey = Axiom.Input.KeyCodes.LeftAlt;
                    break;
                case DInput.Key.RightAlt:
                    axiomKey = Axiom.Input.KeyCodes.RightAlt;
                    break;
                case DInput.Key.Space:
                    axiomKey = Axiom.Input.KeyCodes.Space;
                    break;
                case DInput.Key.Grave:
                    axiomKey = Axiom.Input.KeyCodes.Tilde;
                    break;
                case DInput.Key.LeftBracket:
                    axiomKey = Axiom.Input.KeyCodes.OpenBracket;
                    break;
                case DInput.Key.RightBracket:
                    axiomKey = Axiom.Input.KeyCodes.CloseBracket;
                    break;
                case DInput.Key.Equals:
                    axiomKey = KeyCodes.Plus;
                    break;
                case DInput.Key.Minus:
                    axiomKey = KeyCodes.Subtract;
                    break;
                case DInput.Key.Slash:
                    axiomKey = KeyCodes.QuestionMark;
                    break;
                case DInput.Key.Apostrophe:
                    axiomKey = KeyCodes.Quotes;
                    break;
                case DInput.Key.BackSlash:
                    axiomKey = KeyCodes.Backslash;
                    break;
                case DInput.Key.NumPad0:
                    axiomKey = Axiom.Input.KeyCodes.NumPad0;
                    break;
                case DInput.Key.NumPad1:
                    axiomKey = Axiom.Input.KeyCodes.NumPad1;
                    break;
                case DInput.Key.NumPad2:
                    axiomKey = Axiom.Input.KeyCodes.NumPad2;
                    break;
                case DInput.Key.NumPad3:
                    axiomKey = Axiom.Input.KeyCodes.NumPad3;
                    break;
                case DInput.Key.NumPad4:
                    axiomKey = Axiom.Input.KeyCodes.NumPad4;
                    break;
                case DInput.Key.NumPad5:
                    axiomKey = Axiom.Input.KeyCodes.NumPad5;
                    break;
                case DInput.Key.NumPad6:
                    axiomKey = Axiom.Input.KeyCodes.NumPad6;
                    break;
                case DInput.Key.NumPad7:
                    axiomKey = Axiom.Input.KeyCodes.NumPad7;
                    break;
                case DInput.Key.NumPad8:
                    axiomKey = Axiom.Input.KeyCodes.NumPad8;
                    break;
                case DInput.Key.NumPad9:
                    axiomKey = Axiom.Input.KeyCodes.NumPad9;
                    break;
                case DInput.Key.Numlock:
                    axiomKey = Axiom.Input.KeyCodes.NumLock;
                    break;
            }

            return axiomKey;
        }