Drought.Entity.MovableEntity.getPosition C# (CSharp) Method

getPosition() public method

public getPosition ( ) : Vector3
return Vector3
        public Vector3 getPosition()
        {
            return position;
        }

Usage Example

Exemplo n.º 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);
        }
All Usage Examples Of Drought.Entity.MovableEntity::getPosition