示例#1
0
        public MovableEntity(GameState gameState, LevelInfo aLevelInfo, Model3D aModel, Path aPath, int uid, float spd, float rad, int maxh, int maxw, float waterSuckAmt, int waterRadius)
        {
            levelInfo = aLevelInfo;
            this.model = aModel;
            path = aPath;
            uniqueID = uid;
            speed = spd;
            radius = rad;
            maxHealth = maxh;
            health = maxh;
            maxWater = maxw;
            water = 0;
            this.waterSuckAmt = waterSuckAmt;
            this.waterRadius = waterRadius;

            position = path.getPosition();
            prevPosition = path.getPosition();
            hasMoved = true;
            waiting = 0;
            heading = new Vector3((float)Math.Cos(uid), (float)Math.Sin(uid), 0);
            normal = levelInfo.getNormal(position.X, position.Y);
            orientation = Matrix.Identity;
            setOrientation();

            selected = false;
            infoBar = new InfoBox(gameState);
            pathTool = new LineTool(gameState.getGraphics());
            ringTool = new LineTool(gameState.getGraphics());
            ringTool.setColor(new Vector3(1.0f, 0.0f, 0.0f));

            rebuildRing();
        }
示例#2
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);
        }
示例#3
0
 public Guard(GameState gameState, LevelInfo levelInfo, ModelLoader modelLoader, Path path, int uid, ProjectileManager proj)
     : base(gameState, levelInfo, modelLoader.getModel3D(modelType.Tank), path, uid, SPEED, RADIUS, FULL_HEALTH, WATER_CAPACITY, 0, 0)
 {
     attackRadiusTool = new LineTool(gameState.getGraphics());
     attackRadiusTool.setColor(Color.Green.ToVector3());
     attackTarget = null;
     projectiles = proj;
 }
示例#4
0
 public void setPath(Path aPath)
 {
     path = aPath;
 }
示例#5
0
 public Tanker(GameState gameState, LevelInfo levelInfo, ModelLoader modelLoader, Path path, int uid)
     : base(gameState, levelInfo, modelLoader.getModel3D(modelType.Truck), path, uid, SPEED, RADIUS, FULL_HEALTH, WATER_CAPACITY, WATER_SUCK_AMOUNT, WATER_RADIUS)
 {
 }