-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
195257d
commit 70b5000
Showing
10 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package bluearchive.units; | ||
|
||
import arc.*; | ||
import arc.audio.Sound; | ||
import arc.struct.Seq; | ||
import arc.util.Interval; | ||
import arc.util.Log; | ||
import arc.util.Time; | ||
import mindustry.content.UnitTypes; | ||
import mindustry.game.EventType; | ||
import mindustry.game.EventType.*; | ||
import mindustry.Vars; | ||
import mindustry.gen.Unit; | ||
|
||
|
||
public class UnitSound { | ||
public static Seq<Sound> arrivalSound = Seq.with(); | ||
public static Seq<Sound> hitSound = Seq.with(); | ||
protected static Sound lastSound; | ||
protected static Sound currentSound; | ||
static Interval hitInterval = new Interval(5); | ||
public static void init() { | ||
// tecta atlas start | ||
Events.on(UnitUnloadEvent.class, e -> { | ||
if (e.unit.type == Vars.content.unit("tecta")) { | ||
arrivalSound = Seq.with(new Sound(Vars.tree.get("sounds/units/tecta-arrival1.ogg")), new Sound(Vars.tree.get("sounds/units/tecta-arrival2.ogg"))); | ||
arrivalSound.random().play(); | ||
} | ||
}); | ||
Events.on(PickupEvent.class, e -> { | ||
if (e.unit.type == Vars.content.unit("tecta")) { | ||
Sound pickedSound = new Sound(Vars.tree.get("sounds/units/tecta-pickup.ogg")); | ||
pickedSound.play(); | ||
} | ||
}); | ||
Events.on(UnitDamageEvent.class, e -> { | ||
/* Check if the unit is same as intended, hit sound was being interval */ | ||
if (e.unit.type == Vars.content.unit("tecta") && hitInterval.get(300)) { | ||
hitSound = Seq.with(new Sound(Vars.tree.get("sounds/units/tecta-hit1.ogg")), new Sound(Vars.tree.get("sounds/units/tecta-hit2.ogg")), new Sound(Vars.tree.get("sounds/units/tecta-hit3.ogg"))); | ||
if (!e.unit.dead) { | ||
Time.run(0f, () -> { | ||
hitSound.random().play(); | ||
}); | ||
} | ||
} | ||
}); | ||
UnitTypes.tecta.deathSound = new Sound(Vars.tree.get("sounds/units/tecta-death.ogg")); | ||
// tecta atlas end | ||
|
||
Log.infoTag("ArchiveDustry", "Unit Sounds Loaded!"); | ||
} | ||
} |