本文整理匯總了Java中com.badlogic.gdx.utils.Timer.Task方法的典型用法代碼示例。如果您正苦於以下問題:Java Timer.Task方法的具體用法?Java Timer.Task怎麽用?Java Timer.Task使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.utils.Timer
的用法示例。
在下文中一共展示了Timer.Task方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setTimersAndTasks
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public void setTimersAndTasks()
{
endTask = new Timer.Task()
{
public void run()
{
Gdx.app.log("timer", "Ending game");
endGameWorld(won());
}
};
endClock = new CGCTimer(endTask, endTime, false, "endClock");
respawnTask = new Timer.Task()
{
public void run()
{
respawnHeight = getPlayerAverageY();
}
};
respawnClock = new CGCTimer(respawnTask, CAMERA_DELAY, (int)respawnTime * 60);
respawnClock.name = "respawnClock";
}
示例2: Helicopter
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public Helicopter(CGCWorld theWorld, Animation newLowAnimation, Animation newMidAnimation,
Animation newHighAnimation, EntityType entityType, Body body)
{
super(newLowAnimation, newMidAnimation, newHighAnimation, entityType, body);
gameWorld = theWorld;
Gdx.app.log("In the pipe", "five by five");
rotation = 90;
//SoundManager.playSound("helicopter", false);
hoverTask = new Timer.Task() {
public void run()
{
stopped = false;
returnTrip = true;
getBody().setLinearVelocity(new Vector2(4,0));
}
};
hoverClock = new CGCTimer(hoverTask, hoverTime, false, "hoverClock");
body.setLinearVelocity(new Vector2(4, 0));
}
示例3: RookieCop
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public RookieCop(CGCWorld theWorld, CharacterArt art, EntityType pEntityType, Body attachedBody, short pID) {
super(art, pEntityType, attachedBody, pID);
gameWorld = theWorld;
maxGrabStrength = MAX_GRAB_STRENGTH_BASE + Math.round(((float)(Math.random() * 2) - 1.0f) * MAX_GRAB_RANGE);
currentGrabStrength = maxGrabStrength;
noGrab = false;
setCoins(0);
grabCooldownTask = new Timer.Task()
{
public void run()
{
currentGrabStrength = maxGrabStrength;
noGrab = false;
}
};
grabCooldownTimer = new CGCTimer(grabCooldownTask, grabCooldown, false, "grabCooldownTimer");
}
示例4: Sheriff
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public Sheriff(Animation newLowAnimation, Animation newMidAnimation,
Animation newHighAnimation, EntityType pEntityType,
Body attachedBody, Boss bo, float startAlpha)
{
super(newLowAnimation, newMidAnimation, newHighAnimation, pEntityType,
attachedBody, startAlpha);
boss = bo;
fireTask = new Timer.Task()
{
public void run()
{
fire();
}
};
fireTimer = new CGCTimer(fireTask, fireTime, true, "fireTimer");
do
{
target = CGCWorld.getPrisoners().random();
}while(!target.isAlive() || target == null);
TimerManager.addTimer(fireTimer);
}
示例5: SoundEffect
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public SoundEffect(FileHandle f)
{
mySound = Gdx.audio.newSound(f);
playTime = (float)(f.length())/(float)(16384);
playTask = new Timer.Task() {
public void run()
{
if(!looping)
{
playing = false;
paused = false;
}
}
};
playTimer = new CGCTimer(playTask, playTime, looping, "playTimer");
}
示例6: show
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public void show() {
splash0 = new Timer.Task(){
public void run() {
stage = 1;
Timer.schedule(splash1, 1.5F);
loadAssets();
}
};
splash1 = new Timer.Task(){
public void run() {
NerdShooter.shooter.setScreen(new StartScreen());
}
};
Timer.schedule(splash0, 1.5F);
}
示例7: setTimersAndTasks
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public void setTimersAndTasks()
{
blinkTask = new Timer.Task()
{
public void run()
{
//showArrows = !showArrows;
}
};
blinkClock = new CGCTimer(blinkTask, blinkTime, true, "blinkClock");
}
示例8: setTimersAndTasks
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public void setTimersAndTasks()
{
blinkTask = new Timer.Task()
{
public void run()
{
showArrows = !showArrows;
}
};
blinkClock = new CGCTimer(blinkTask, blinkTime, false, "blinkClock");
}
示例9: SteelHorseRider
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public SteelHorseRider(CGCWorld theWorld, Animation newLowAnimation,
Animation newMidAnimation, Animation newHighAnimation,
EntityType pEntityType, Body attachedBody, short pID, SteelHorse sh)
{
super(theWorld, newLowAnimation, newMidAnimation, newHighAnimation, pEntityType, attachedBody, pID);
body.getFixtureList().get(0).setSensor(true);
epona = sh;
Body b = CGCWorld.getBF().createCircle(body.getWorldCenter().x,
body.getWorldCenter().y, 0.5f, BodyType.DynamicBody,
BodyFactory.CAT_NON_INTERACTIVE, BodyFactory.MASK_NON_INTERACTIVE);
b.getFixtureList().get(0).setSensor(true);
b.setFixedRotation(true);
target = new Targeter(null, null, com.percipient24.cgc.art.TextureAnimationDrawer.targetingAnims[0],
EntityType.TARGETER, b, CGCWorld.getCamera(), playerID);
b.setUserData(target);
target.addToWorldLayers(CGCWorld.getLH());
fireTask = new Timer.Task()
{
public void run() {
canFire = true;
}
};
fireTimer = new CGCTimer(fireTask, fireTime, true, "fireTimer");
TimerManager.addTimer(fireTimer);
alive = true;
lowState = AnimationState.STAND;
noGrab = true;
canJump = false;
}
示例10: CarrierCop
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public CarrierCop(CGCWorld theWorld, Animation newLowAnimation,
Animation newMidAnimation, Animation newHighAnimation,
EntityType pEntityType, Body attachedBody, short pID) {
super(theWorld, newLowAnimation, newMidAnimation, newHighAnimation,
pEntityType, attachedBody, pID);
setSpeedMod(0.5f);
noGrab = true;
rechargeTask = new Timer.Task() {
public void run() {
speedMul = 1.0f;
canSprint = true;
sprintLeft = maxSprint;
}
};
rechargeTimer = new CGCTimer(rechargeTask, rechargeTime, false, "rechargeTimer");
resetTask = new Timer.Task() {
public void run() {
noGrab = false;
}
};
resetTimer = new CGCTimer(resetTask, resetTime, false, "ccResetTimer");
canJump = false;
chainLinkContacts = new Array<ChainLink>();
}
示例11: Tank
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public Tank(Animation newLowAnimation, Animation newMidAnimation,
Animation newHighAnimation, EntityType pEntityType,
Body attachedBody, boolean ai, Targeter targeter)
{
super(newLowAnimation, newMidAnimation, newHighAnimation, pEntityType, attachedBody);
moveForce = new Vector2(0, currentSpeed);
aiControl = ai;
if (ai)
{
fireTask = new Timer.Task()
{
public void run()
{
fire();
}
};
fireTimer = new CGCTimer(fireTask, fireTime, true, "fireTimer");
TimerManager.addTimer(fireTimer);
target = getTargetPlayer();
}
else
{
target = targeter;
}
slowTask = new Timer.Task()
{
public void run()
{
slowed = false;
}
};
slowTimer = new CGCTimer(slowTask, slowTime, false, "slowTimer");
}
示例12: setUpTimer
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
private void setUpTimer()
{
startTask = new Timer.Task()
{
public void run()
{
if (!controllersFound)
{
Gdx.app.exit();
}
}
};
startClock = new CGCTimer(startTask, startTime, false, "startClock");
}
示例13: getPlayerAttackCalculationTimer
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
private Timer.Task getPlayerAttackCalculationTimer() {
return new Timer.Task() {
@Override
public void run() {
int currentOpponentHP = _currentOpponent.getHealthPoint();//Integer.parseInt(_currentOpponent.getEntityConfig().getPropertyValue(EntityConfig.EntityProperties.ENTITY_HEALTH_POINTS.toString()));
int currentOpponentDP = _currentOpponent.getDefensePoint();//Integer.parseInt(_currentOpponent.getEntityConfig().getPropertyValue(EntityConfig.EntityProperties.ENTITY_DEFENSE_POINTS.toString()));
int damage = MathUtils.clamp(_currentPlayerAP - currentOpponentDP, 0, _currentPlayerAP);
Gdx.app.error(TAG, "ENEMY HAS " + currentOpponentHP + " hit with damage: " + damage);
currentOpponentHP = MathUtils.clamp(currentOpponentHP - damage, 0, currentOpponentHP);
// _currentOpponent.getEntityConfig().setPropertyValue(EntityConfig.EntityProperties.ENTITY_HEALTH_POINTS.toString(), String.valueOf(currentOpponentHP));
_currentOpponent.setHealthPoint(currentOpponentHP);
Gdx.app.error(TAG, "Player attacks " + _currentOpponent.getEntityId() + " leaving it with HP: " + currentOpponentHP);
// _currentOpponent.getEntityConfig().setPropertyValue(EntityConfig.EntityProperties.ENTITY_HIT_DAMAGE_TOTAL.toString(), String.valueOf(damage));
_currentOpponent.setHitDamageTotal(damage);
if( damage > 0 ){
BattleState.this.battleUI.updateEvent(_currentOpponent, BattleEvent.OPPONENT_HIT_DAMAGE);
}
if (currentOpponentHP == 0) {
BattleState.this.battleUI.updateEvent(_currentOpponent, BattleEvent.OPPONENT_DEFEATED);
}
BattleState.this.battleUI.updateEvent(_currentOpponent, BattleEvent.PLAYER_TURN_DONE);
}
};
}
示例14: getOpponentAttackCalculationTimer
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
private Timer.Task getOpponentAttackCalculationTimer(final Role player) {
return new Timer.Task() {
@Override
public void run() {
// int currentOpponentHP = Integer.parseInt(_currentOpponent.getEntityConfig().getPropertyValue(EntityConfig.EntityProperties.ENTITY_HEALTH_POINTS.toString()));
int currentOpponentHP = _currentOpponent.getHealthPoint();
if (currentOpponentHP <= 0) {
BattleState.this.battleUI.updateEvent(_currentOpponent, BattleEvent.OPPONENT_TURN_DONE);
return;
}
// int currentOpponentAP = Integer.parseInt(_currentOpponent.getEntityConfig().getPropertyValue(EntityConfig.EntityProperties.ENTITY_ATTACK_POINTS.toString()));
int currentOpponentAP = _currentOpponent.getAttackPoint();
int damage = MathUtils.clamp(currentOpponentAP - _currentPlayerDP, 0, currentOpponentAP);
// int hpVal = ProfileManager.getInstance().getProperty("currentPlayerHP", Integer.class);
int hpVal = player.getHealthPoint();
hpVal = MathUtils.clamp( hpVal - damage, 0, hpVal);
// ProfileManager.getInstance().setProperty("currentPlayerHP", hpVal);
player.setHealthPoint(hpVal);
if( damage > 0 ) {
BattleState.this.battleUI.updateEvent(_currentOpponent, BattleEvent.PLAYER_HIT_DAMAGE);
}
Gdx.app.error(TAG, "Player HIT for " + damage + " BY " + _currentOpponent.getEntityId() + " leaving player with HP: " + hpVal);
BattleState.this.battleUI.updateEvent(_currentOpponent, BattleEvent.OPPONENT_TURN_DONE);
}
};
}
示例15: setUpTimer
import com.badlogic.gdx.utils.Timer; //導入方法依賴的package包/類
public void setUpTimer()
{
tipTask = new Timer.Task()
{
public void run()
{
showAlternateTips = !showAlternateTips;
}
};
tipClock = new CGCTimer(tipTask, tipTime, true, "tipClock");
}