示例#1
0
 public void FireBolt(ProjectileData prjData, Vector3 velocity, float duration, SpaceShip ship, Vector2 offset, float minDev, float maxDev, int minDevTime, int maxDevTime, Vector3 originPos, Vector3 targetPos)
 {
     for (int i = 0; i < MAXBULLETS; i++)
     {
         if (!bolts[i].isActive)
         {
             //brute force search for inactive bolt.
             InitializeBolt(i, prjData, velocity, duration, ship, offset, minDev, maxDev, minDevTime, maxDevTime, originPos, targetPos);
             return;
         }
     }
 }
示例#2
0
        public void Initialize(ProjectileData prjdata, Vector3 velocity, float duration, SpaceShip ship, Vector2 offset, float minDev, float maxDev, int minDevTime, int maxDevTime, Vector3 originPos, Vector3 targetPos)
        {
            this.prjData  = prjdata;
            this.velocity = velocity;
            timeRemaining = duration;
            //position = ship.Position;
            Position = originPos;

            Matrix shipOrientation = Matrix.CreateFromQuaternion(ship.Rotation);

            Position += shipOrientation.Right * offset.X;
            Position += shipOrientation.Up * -offset.Y;



            //rotation = ship.Rotation;
            Matrix lookAt = Matrix.CreateLookAt(originPos, targetPos, Vector3.Up);

            Rotation = Quaternion.CreateFromRotationMatrix(Matrix.Invert(lookAt));


            owner            = ship;
            minDeviation     = minDev;
            maxDeviation     = maxDev;
            minDeviationTime = minDevTime;
            maxDeviationTime = maxDevTime;


            if (prjdata.trailType != TrailType.None)
            {
                if (prjdata.trailType == TrailType.RocketTrail)
                {
                    emitter = FrameworkCore.Particles.CreateRockEmitter(this.Position);
                }
                else if (prjdata.trailType == TrailType.TorpedoTrail)
                {
                    emitter = FrameworkCore.Particles.CreateTorpedoEmitter(this.Position);
                }
            }
            else
            {
                emitter = null;
            }



            /*
             * if (idleCue == null)
             * {
             *  idleCue = FrameworkCore.audiomanager.Play3DCue(sounds.Rocket.rocket3, this.audioEmitter);
             * }
             */
        }
示例#3
0
        private void InitializeBolt(int index, ProjectileData prjData, Vector3 velocity, float duration, SpaceShip ship, Vector2 offset, float minDev, float maxDev, int minDevTime, int maxDevTime, Vector3 originPos, Vector3 targetPos)
        {
            bolts[index].Initialize(prjData, velocity, duration, ship, offset, minDev, maxDev, minDevTime, maxDevTime, originPos, targetPos);
            bolts[index].LoadContent(prjData.modelName);
            bolts[index].isActive = true;

            if (ship.owner != null && ship.owner.ShipColor != null)
            {
                FrameworkCore.playbackSystem.AddItem(bolts[index], objectType.bolt, ship.owner.ShipColor);
            }

            activeBolts.Add(index);
        }