Beispiel #1
0
        /// <summary>
        /// Rotate the arrow or swords/shield if present.
        /// </summary>
        public void RotateObjects()
        {
            float deltaTime = (float)ServiceManager.Game.DeltaTime;

            if (this.arrowRenderId != -1)
            {
                if (Arrow == null)
                {
                    Arrow = ServiceManager.Scene.Access3D(arrowRenderId);
                }

                Arrow.RotateZ(ROTATION_VELOCITY * deltaTime);

                if (arrowVerticalPosition >= 120)
                {
                    this.bobstate = ArrowBobState.Down;
                }
                else if (arrowVerticalPosition <= 80)
                {
                    this.bobstate = ArrowBobState.Up;
                }

                if (this.bobstate == ArrowBobState.Up)
                {
                    Arrow.Translate(upVector);
                    this.arrowVerticalPosition++;
                }
                else if (this.bobstate == ArrowBobState.Down)
                {
                    Arrow.Translate(downVector);
                    this.arrowVerticalPosition--;
                }
            }

            if (this.swordOrShieldRenderId != -1)
            {
                if (SwordOrShield == null)
                {
                    SwordOrShield = ServiceManager.Scene.Access3D(swordOrShieldRenderId);
                }

                this.SwordOrShield.RotateZ(ROTATION_VELOCITY * deltaTime);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Rotate the arrow or swords/shield if present.
        /// </summary>
        public void RotateObjects()
        {
            float deltaTime = (float)ServiceManager.Game.DeltaTime;

            if (this.arrowRenderId != -1)
            {
                if (Arrow == null)
                    Arrow = ServiceManager.Scene.Access3D(arrowRenderId);

                Arrow.RotateZ(ROTATION_VELOCITY * deltaTime);

                if (arrowVerticalPosition >= 120)
                {
                    this.bobstate = ArrowBobState.Down;
                }
                else if (arrowVerticalPosition <= 80)
                {
                    this.bobstate = ArrowBobState.Up;
                }

                if (this.bobstate == ArrowBobState.Up)
                {
                    Arrow.Translate(upVector);
                    this.arrowVerticalPosition++;
                }
                else if (this.bobstate == ArrowBobState.Down)
                {
                    Arrow.Translate(downVector);
                    this.arrowVerticalPosition--;
                }
            }

            if ( this.swordOrShieldRenderId != -1)
            {
                if (SwordOrShield == null)
                    SwordOrShield = ServiceManager.Scene.Access3D(swordOrShieldRenderId);

                this.SwordOrShield.RotateZ(ROTATION_VELOCITY * deltaTime);
            }
        }