Merge branches 'master' and 'tutorial' of https://github.com/Anuken/Mindustry into tutorial
This commit is contained in:
@@ -24,6 +24,7 @@ public enum Gamemode{
|
||||
rules.unitDrops = true;
|
||||
rules.waves = false;
|
||||
rules.attackMode = true;
|
||||
rules.waves = true;
|
||||
}, map -> map.teams.contains(waveTeam.ordinal())),
|
||||
pvp(rules -> {
|
||||
rules.pvp = true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.annotations.Annotations.*;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.audio.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.util.*;
|
||||
@@ -9,24 +10,29 @@ import io.anuke.arc.util.*;
|
||||
public class MusicControl{
|
||||
private static final float finTime = 80f, foutTime = 80f;
|
||||
private @Nullable Music current;
|
||||
private float fade;
|
||||
|
||||
public void play(@Nullable Music music){
|
||||
if(current != null){
|
||||
current.setVolume(fade * Core.settings.getInt("musicvol") / 100f);
|
||||
}
|
||||
|
||||
if(current == null && music != null){
|
||||
current = music;
|
||||
current.setLooping(true);
|
||||
current.setVolume(0f);
|
||||
current.setVolume(fade = 0f);
|
||||
current.play();
|
||||
}else if(current == music && music != null){
|
||||
current.setVolume(Mathf.clamp(current.getVolume() + Time.delta()/finTime));
|
||||
fade = Mathf.clamp(fade + Time.delta()/finTime);
|
||||
}else if(current != null){
|
||||
current.setVolume(Mathf.clamp(current.getVolume() - Time.delta()/foutTime));
|
||||
fade = Mathf.clamp(fade - Time.delta()/foutTime);
|
||||
|
||||
if(current.getVolume() <= 0.01f){
|
||||
if(fade <= 0.01f){
|
||||
current.stop();
|
||||
current = null;
|
||||
if(music != null){
|
||||
current = music;
|
||||
current.setVolume(0f);
|
||||
current.setVolume(fade = 0f);
|
||||
current.setLooping(true);
|
||||
current.play();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class Rules{
|
||||
/** Whether the tutorial is enabled. False by default.*/
|
||||
public boolean tutorial = false;
|
||||
/** Starting items put in cores */
|
||||
public Array<ItemStack> loadout = Array.with(ItemStack.with(Items.copper, 200));
|
||||
public Array<ItemStack> loadout = Array.with(ItemStack.with(Items.copper, 100));
|
||||
|
||||
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
|
||||
public Rules copy(){
|
||||
|
||||
@@ -2,14 +2,15 @@ package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.Color;
|
||||
import io.anuke.mindustry.graphics.*;
|
||||
|
||||
public enum Team{
|
||||
none(Color.valueOf("4d4e58")),
|
||||
blue(Color.valueOf("4169e1")),
|
||||
red(Color.valueOf("e84737")),
|
||||
green(Color.valueOf("1dc645")),
|
||||
purple(Color.valueOf("ba5bd9")),
|
||||
orange(Color.valueOf("e8c66a"));
|
||||
derelict(Color.valueOf("4d4e58")),
|
||||
sharded(Pal.accent),
|
||||
crux(Color.valueOf("e82d2d")),
|
||||
green(Color.valueOf("4dd98b")),
|
||||
purple(Color.valueOf("9a4bdf")),
|
||||
blue(Color.ROYAL.cpy());
|
||||
|
||||
public final static Team[] all = values();
|
||||
public final Color color;
|
||||
|
||||
Reference in New Issue
Block a user