现在我正在为角色制作技巧,我想添加冷却时间,但我不知道如何设置时间,但我想我知道哪些变量它应该有:System.nanoTime()和其他与时间有关的类
private long currentTime; <-- this is the actual cooldown
private long cooldownTime; <--- this is the time it must pass before its ready
private boolean onCooldown; <---- game uses this to check if its on cooldown
private long elapsed = System.nanoTime(); <-- this takes the exact time when a skill is used and is setOnCooldown.
因此,这是基本的变量,但我不知道,我怎么可以设置他们在所有的,我得到了一个update()方法,在游戏中铸造()方法。请senpais中止!让巧克力饼干的人愿意HALPS NN
System.nanoTime返回'long';不要将它转换为'float',否则你会遇到问题。 – immibis 2015-01-21 04:36:46
提示Ty,更新它。 – 2015-01-21 04:37:37
你真的需要nanotime吗? timeMillis对于游戏应该足够好,并且在重新启动时可能不一致。 – Thilo 2015-01-21 04:37:53