Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUC...
If you think the Android project Station42 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.station42.sentries;
/*www.java2s.com*/import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.station42.base.Engine;
import com.station42.base.Entity;
import com.station42.basic.EntityFacing;
import com.station42.basic.EntityLocation;
import com.station42.basic.EntitySprite;
import com.station42.faction.EntityFaction;
import com.station42.game.Station40Game;
import com.station42.hacking.Hackable;
import com.station42.optimizations.RoomResident;
publicfinalclass SentrySpawner {
publicstatic Entity spawnSentry(Engine engine, float x, float y, EntityFaction team) {
Entity sentry = new Entity("Sentry",
new Sentry(0.25f),
new RoomResident(),
new EntityFacing(),
new Hackable("Turncoat", 80, 1f),
new EntityLocation(x - 16, y - 16, 32),
team != null ? team.getTurretSprite() : getNeutralTurretSprite());
if (team != null) {
sentry.setComponent(EntityFaction.class, team);
}
engine.spawnEntity(sentry);
return sentry;
}
privatestatic EntitySprite getNeutralTurretSprite() {
returnnew EntitySprite(Station40Game.manager.get("sprites.png", Texture.class), 96, 32, 32, 32);
}
}