Esempio n. 1
0
	public final void Update(GameTime gameTime) {
		for (int i = this.bullets.size() - 1; i >= 0; i--) {
			this.bullets.get(i).Update(gameTime);
			if (this.bullets.get(i).totalDistance > this.Range) {
				this.bullets.remove(this.bullets.get(i));
			}
		}
		if (this.isAlive()) {
			if (this.destination.size() > 0) {
				Vector2f vector = this.destination.get(0);
				float num2 = Vector2f.dst(vector, this.position);
				float num3 = MathUtils.atan2((vector.y - this.position.y),
						(vector.x - this.position.x));
				this.rotation = num3;
				this.position.addLocal(((new Vector2f(MathUtils.cos(num3),
						MathUtils.sin(num3)).mul(this.MoveSpeed).mul(gameTime
						.getElapsedGameTime())).mul(40f)));
				if (num2 <= this.MoveSpeed) {
					this.position.set(vector);
					this.destination.remove(0);
				}

				this.animationPlayer.PlayAnimation(this.walkAnimation);
			} else {
				this.animationPlayer.PlayAnimation(this.idleAnimation);
			}
			this.reloadTime += gameTime.getElapsedGameTime();
		}
	}
Esempio n. 2
0
	public void Update(MenuScreen screen, boolean isSelected, GameTime gameTime) {
		isSelected = false;
		float num = ((float) gameTime.getElapsedGameTime()) * 4f;
		if (isSelected) {
			this.selectionFade = Math.min((float) (this.selectionFade + num),
					(float) 1f);
		} else {
			this.selectionFade = Math.max((float) (this.selectionFade - num),
					(float) 0f);
		}
	}
Esempio n. 3
0
	public final void Draw(GameTime gameTime, SpriteBatch batch) {
		for (Bullet bullet : this.bullets) {
			bullet.Draw(batch);
		}
		if (!this.isAlive()) {
			this.removeTime = Math.max(
					(this.removeTime - gameTime.getElapsedGameTime()), 0f);
		}

		LColor colour = LColor.white;
		this.animationPlayer
				.Draw(gameTime,
						batch,
						this.position,
						colour,
						0f,
						(Math.abs(this.rotation) > 1.570796f) ? SpriteEffects.FlipHorizontally
								: SpriteEffects.None);
		batch.draw(
				this.gameContent.weapon[(int) this.rank.getValue()],
				this.position,
				null,
				colour,
				MathUtils.radToDeg(this.rotation),
				15,
				15,
				1f,
				(Math.abs(this.rotation) > 1.570796f) ? SpriteEffects.FlipVertically
						: SpriteEffects.None);
		if (this.isAlive()) {
			batch.draw(this.gameContent.healthBar, this.position.sub(
					(this.gameContent.healthBar.getWidth() / 2), 20f),
					LColor.white);
			rect.setBounds(
					0,
					0,
					(int) ((this.health / this.MaxHealth) * this.gameContent.healthBar
							.getWidth()), this.gameContent.healthBar
							.getHeight());
			batch.draw(this.gameContent.healthBar, this.position.sub(
					(this.gameContent.healthBar.getWidth() / 2), 20f), rect,
					LColor.red);
			batch.flush();
		}
	}
Esempio n. 4
0
	public final void DrawPath(GameTime gameTime, SpriteBatch batch) {
		LColor color = LColor.white;
		for (int i = 0; i < (this.destination.size() - 1); i++) {
			float rotation = MathUtils
					.atan2((this.destination.get(i + 1).y - this.destination
							.get(i).y),
							(this.destination.get(i + 1).x - this.destination
									.get(i).x));
			batch.draw(this.gameContent.pathArrow, this.destination.get(i),
					null, color, MathUtils.radToDeg(rotation), 15f, 15f, 1f,
					SpriteEffects.None);
		}
		if (this.destination.size() > 0) {
			batch.draw(this.gameContent.pathCross,
					this.destination.get(this.destination.size() - 1), null,
					color, 0f, 15f, 15f, 1f, SpriteEffects.None);
		}
		this.pathVisibleTime = MathUtils.max(
				(this.pathVisibleTime - (gameTime.getElapsedGameTime())), 0f);

	}