getPosition() 공개 메소드

public getPosition ( ) : Vector3
리턴 Vector3
예제 #1
0
        /// <summary>
        /// Constructs a new projectile.
        /// </summary>
        public Projectile(ParticleSystem explosionParticles, ParticleSystem explosionSmokeParticles, ParticleSystem projectileTrailParticles, MovableEntity origin, MovableEntity aTarget)
        {
            this.explosionParticles = explosionParticles;
            this.explosionSmokeParticles = explosionSmokeParticles;

            // Start at the origin, firing in a random (but roughly upward) direction.
            position = origin.getPosition();
            target = aTarget.getPosition();
            targetEntity = aTarget;

            //velocity.X = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange;
            //velocity.Y = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange;
            //velocity.Z = (float)(random.NextDouble() + 0.5) * verticalVelocityRange;

            double step = Math.PI / 60;
            //Vector3 mid = (aTarget + aPosition) / 2;
            float radius = Math.Abs(Vector3.Distance(target, position) / 2);
            List<Vector3> path = new List<Vector3>();
            for (int i = 0; i <= 60; i++)
            {
                float thisX = MathHelper.Lerp(position.X, target.X, ((float)i) / 60);
                float thisY = MathHelper.Lerp(position.Y, target.Y, ((float)i) / 60);
                float thisZ = MathHelper.Lerp(position.Z, target.Z, ((float)i) / 60) + radius * (float)Math.Cos(step*(i - 30));
                path.Add(new Vector3(thisX, thisY, thisZ));
            }
            myPath = new Path(path);

            // Use the particle emitter helper to output our trail particles.
            trailEmitter = new ParticleEmitter(projectileTrailParticles, trailParticlesPerSecond, position);
        }
예제 #2
0
 /* Plays a sound positioned in 3D space, with panning and volume adjustments. */
 public void playSound(SoundHandle theSound, MovableEntity emitterEntity)
 {
     if (soundOn) {
         if (emitterEntity == null) playSound(theSound); //if the listener isn't set, just play the sound normally
         AudioEmitter emitter = new AudioEmitter();
         emitter.Position = emitterEntity.getPosition();
         switch (theSound) {
             case SoundHandle.Truck:
                 Cue newCue = soundBank.GetCue("truck");
                 Sound newSound = new Sound(newCue, emitterEntity);
                 newCue.Apply3D(listener, emitter);
                 newCue.Play();
                 soundList.Add(newSound);
                 break;
             //case SoundHandle.Punch: soundBank.PlayCue("punch", listener, emitter); break;
             //case SoundHandle.BGM: soundBank.PlayCue("bgm"); break;
         }
     }
 }
예제 #3
0
 public void sendPos(MovableEntity entity)
 {
     packetWriter.Write(entity.uniqueID);
     packetWriter.Write(entity.getPosition());
     packetWriter.Write(entity.getOrientation());
     session.LocalGamers[0].SendData(packetWriter, SendDataOptions.None);
 }