現在我正在爲角色製作技巧,我想添加冷卻時間,但我不知道如何設置時間,但我想我知道哪些變量它應該有: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