当前位置: 首页>>代码示例>>Java>>正文


Java Timer.schedule方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.Timer.schedule方法的典型用法代码示例。如果您正苦于以下问题:Java Timer.schedule方法的具体用法?Java Timer.schedule怎么用?Java Timer.schedule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.Timer的用法示例。


在下文中一共展示了Timer.schedule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendOpenSessionEvent

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
protected void sendOpenSessionEvent() {
    if (!isSessionActive())
        return;

    Map<String, String> params = new HashMap<String, String>();
    addGameIDUserNameUserToken(params);

    final Net.HttpRequest http = buildJsonRequest("sessions/open/", params);

    if (http != null)
        Gdx.net.sendHttpRequest(http, new NoOpResponseListener());

    pingTask = Timer.schedule(new Timer.Task() {
        @Override
        public void run() {
            sendKeepSessionOpenEvent();
        }
    }, GJ_PING_INTERVAL, GJ_PING_INTERVAL);

}
 
开发者ID:MrStahlfelge,项目名称:gdx-gamesvcs,代码行数:21,代码来源:GameJoltClient.java

示例2: create

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
public void create()
{
    enemyStack = new Stack<Enemy>();


    Timer.schedule(new Task()
    {
        @Override
        public void run()
        {
            int choiceToMove = MathUtils.random(3);
            for(int i = 0; i < 5; i++)
            {
                enemyStack.add(new WeakEnemy(choiceToMove, xOffset * i, yOffset * i));
            }
            //Timer.instance().clear();
        }
    }, 0.5f, intervalBetweenSpawn);
}
 
开发者ID:UdealInferno,项目名称:Parasites-of-HellSpace,代码行数:20,代码来源:SpawningEnemy.java

示例3: keepAttacking

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
public void keepAttacking() {
	changeState(Enemy.State.ATTACKING, 1, new GameObject.OnAnimationComplete() {
		@Override public void run(GameObject object) {
			changeState(Enemy.State.STANDING);
		}
	});
	
	context.removeLife();
	if(context.life.isEmpty()) return;
	
	int randomAttack = (int) Math.floor(context.soundsEffectEnemyAttack.size()*Math.random());
	context.soundsEffectEnemyAttack.get(randomAttack).play();
	
	Timer.schedule(new Timer.Task() {
		@Override
		public void run() {
			if(!state.equals(Enemy.State.DYING))
				keepAttacking();
		}
	}, TIME_TO_ATTACK);		
}
 
开发者ID:raphaelbruno,项目名称:ZombieInvadersVR,代码行数:22,代码来源:Enemy.java

示例4: die

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
public void die() {
    final Enemy enemy = this;
    enabled = false;
    context.tweenManager.killTarget(this, GameObjectAccessor.XYZ);
    context.tweenManager.killTarget(this, GameObjectAccessor.ROTATION);
    
	changeState(Enemy.State.DYING, 1);
	
	Timer.schedule(new Timer.Task() {
		@Override
		public void run() {
			Vector3 position = enemy.transform.getTranslation(new Vector3());
			enemy.moveToAnimation(position.x, -0.5f, position.z, 2, new GameObject.OnAnimationComplete() {
				@Override public void run(GameObject object) {
					context.instances.remove(enemy);
				}
			});
		}
	}, TIME_TO_ATTACK);		
}
 
开发者ID:raphaelbruno,项目名称:ZombieInvadersVR,代码行数:21,代码来源:Enemy.java

示例5: SpawnItemThread

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
public SpawnItemThread(int numberOfItemFields, Server server)
{
    this.itemFields = numberOfItemFields;
    this.server = server;
    
    /*--------------INCREASE BOMB RANGE--------------*/
        Timer.schedule(new Timer.Task()
        {
            @Override
            public void run() 
            {
                if(cubicRange < Constants.MAXCUBICRANGE)
                {
                    cubicRange += 1;
                }
                
                if(normalRange < Constants.MAXBOMBRANGE)
                {
                    normalRange += 1;
                }
            }
        }
         ,60 // first execute delay
         ,60  // delay between executes     
        );
}
 
开发者ID:Aeo-Informatik,项目名称:Space-Bombs,代码行数:27,代码来源:SpawnItemThread.java

示例6: Transfer

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
/********************************************
 * Triggle Event
 *************************************/
public void Transfer(final String mapName, final Vector2 pos, final Role.Direction dir) {
    float delay = 0.1000f; // seconds
    player.setVisible(false);
    Timer.schedule(new Timer.Task() {
        @Override
        public void run() {
            mapMgr.loadMap(mapName);
            player.setCurrentDir(dir);
            player.setPosInMap(pos);
            player.setVisible(true);
            fighting = 0;
            cycleTime = 0;
        }
    }, delay);
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:19,代码来源:WorldController.java

示例7: tap

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
public Integer tap() {
  if (currentClearTask != null) {
    currentClearTask.cancel();
  }

  currentClearTask = Timer.schedule(clearTask, clearInterval);

  if (tapTimes.size() == numberOfTaps) {
    tapTimes.remove(0);
  }

  tapTimes.add(TimeUtils.nanoTime());

  long sum = 0;
  if (tapTimes.size() > 1) {
    for (int i = 1; i < tapTimes.size(); i++) {
      sum += tapTimes.get(i) - tapTimes.get(i - 1);
    }
    float averageSeconds = sum / (tapTimes.size() - 1) / 1000000000f;
    int bpm = (int) (60f / averageSeconds);
    return bpm;
  } else {
    return null;
  }
}
 
开发者ID:odedw,项目名称:TempoGDX,代码行数:26,代码来源:TapTempoCalculator.java

示例8: loadComplete

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
public void loadComplete() {
//		System.out.print("[");
//		for (Block b : blocks) {
//			System.out.print("[\"" + b.body.getPosition().x + "\"d \"" + b.body.getPosition().y + "\"d]");
//		}
//		System.out.println("]");
////		System.out.print("[");
////		for (Entity b : entities) {
////			System.out.print("[\"" + b.body.getPosition().x + "\"d \"" + b.body.getPosition().y + "\"d]");
////		}
////		System.out.println("]");
		Timer.schedule(new Task() {
			public void run() {
				loaded = true;
			}
		}, 1);
	}
 
开发者ID:lvivtotoro,项目名称:advio,代码行数:18,代码来源:Level.java

示例9: playerAttacks

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
public void playerAttacks(Role player){
        if( _currentOpponent == null ){
            return;
        }

        //Check for magic if used in attack; If we don't have enough MP, then return
//        int mpVal = ProfileManager.getInstance().getProperty("currentPlayerMP", Integer.class);
        int mpVal = player.getMagicPoint();
        battleUI.updateEvent(_currentOpponent, BattleEvent.PLAYER_TURN_START);

        if( _currentPlayerWandAPPoints == 0 ){
            if( !_playerAttackCalculations.isScheduled() ){
                Timer.schedule(_playerAttackCalculations, 1);
            }
        }else if(_currentPlayerWandAPPoints > mpVal ){
            BattleState.this.battleUI.updateEvent(_currentOpponent, BattleEvent.PLAYER_TURN_DONE);
            return;
        }else{
            if( !_checkPlayerMagicUse.isScheduled() && !_playerAttackCalculations.isScheduled() ){
                Timer.schedule(_checkPlayerMagicUse, .5f);
                Timer.schedule(_playerAttackCalculations, 1);
            }
        }
    }
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:25,代码来源:BattleState.java

示例10: create

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
public void create() {
	batch = new SpriteBatch();
	sr = new ShapeRenderer();

	bg[0] = new Sprite(new Texture(Gdx.files.internal("gfx/loadingscreens/layout.png")));
	bg[1] = new Sprite(new Texture(Gdx.files.internal("gfx/loadingscreens/layout-dif.png")));

	fps = new Button("Fps: " + 60, 32, 678);

	Timer.schedule(new Timer.Task() {
		@Override
		public void run() {
			fps.text = "Fps: " + (int) (1 / Gdx.graphics.getDeltaTime());
		}
	}, 1f, 1f);
}
 
开发者ID:ahmetkasif,项目名称:KittenMaxit,代码行数:17,代码来源:State.java

示例11: handleMessage

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
@Override
public boolean handleMessage (Telegram msg) {
	TelegramMessage telegramMsg = TelegramMessage.values()[msg.message];
	switch (telegramMsg) {
	
	case SQUAD_INPUT_SELECTED:
		int index = (Integer)msg.extraInfo;
		setSelected(index, true);
		return true;
		
	case GUI_INSUFFICIENT_RESOURCES:
		if(resourceAlertTask.isScheduled())
			resourceAlertTask.cancel();
		Timer.schedule(resourceAlertTask, 0.0f, 0.15f, 5);
		return true;

	default:
		return false;
	}
}
 
开发者ID:libgdx-jam,项目名称:GDXJam,代码行数:21,代码来源:GUISystem.java

示例12: encryptGameTitle

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
private void encryptGameTitle() {
    char oldCharTmp;
    int indexTmp;

    do {
        indexTmp = (int)(Math.random() * gameTitle.getText().length());
        oldCharTmp = gameTitle.getText().charAt(indexTmp);
    } while (!Character.isLetter(oldCharTmp) || oldCharTmp == 'M');

    final char oldChar = oldCharTmp;
    final int index = indexTmp;
    int number = (int)(Math.random() * 10);

    gameTitle.setText(gameTitle.getText().substring(0, index) + number + gameTitle.getText().substring(index + 1));
    Timer.schedule(new Timer.Task() {
        @Override
        public void run() {
            gameTitle.setText(gameTitle.getText().substring(0, index) + oldChar + gameTitle.getText().substring(index + 1));
        }
    }, ENCRYPTION_DURATION);
}
 
开发者ID:naomiHauret,项目名称:OdysseeDesMaths,代码行数:22,代码来源:MenuPrincipal.java

示例13: 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);
}
 
开发者ID:Xemplar,项目名称:NerdShooter,代码行数:17,代码来源:SplashScreen.java

示例14: RespawnEnemy

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
public void RespawnEnemy() { 	 
	 Timer.schedule(new Task(){
         @Override
         public void run() {
             tics++;
             if(tics > 25){                          	                 	 
                 tics = 1;
             }
              if (tics == 1) {enemigoSpamea = true;}
              if (tics == 2) {enemigoSpamea = true;}
              if (tics == 3) {enemigoSpamea = true;}
              if (tics == 5) {enemigoSpamea = false;}
              if(tics % 2 == 0) {go=1;} else {go=0;}
             }
     }
     ,0,30/30.0f); 	 
}
 
开发者ID:programacion2VideojuegosUM2015,项目名称:practicos,代码行数:18,代码来源:Respawn.java

示例15: animacionGameOver

import com.badlogic.gdx.utils.Timer; //导入方法依赖的package包/类
public void animacionGameOver() { 	 
	 Timer.schedule(new Task(){
         @Override
         public void run() {
             tics++;
             
             if(tics > 60){                          	                 	 
                 tics = 0;                   
             }
             
             if(tics%10==0){if(timer>0 && Juego.gameOver==0 && Juego.titleScreen==0){timer--;}}
             if(tics==20 && Juego.gameOver==1){Juego.titleScreen=1;}
             if(tics==20){Juego.gameOver=0;}
                            
          }
     }
     ,0,30/35.0f); 	 
}
 
开发者ID:programacion2VideojuegosUM2015,项目名称:practicos,代码行数:19,代码来源:PantallaGameOver.java


注:本文中的com.badlogic.gdx.utils.Timer.schedule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。