mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-08 14:57:18 +07:00
Cleanup
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 266 KiB |
Binary file not shown.
Before Width: | Height: | Size: 77 KiB |
@ -1,8 +1,14 @@
|
|||||||
package mindustry.content;
|
package mindustry.content;
|
||||||
|
|
||||||
|
import arc.*;
|
||||||
|
import arc.graphics.g2d.*;
|
||||||
|
import arc.math.*;
|
||||||
|
import arc.util.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
|
import static mindustry.Vars.world;
|
||||||
|
|
||||||
public class Weathers implements ContentList{
|
public class Weathers implements ContentList{
|
||||||
public static Weather
|
public static Weather
|
||||||
rain,
|
rain,
|
||||||
@ -11,9 +17,35 @@ public class Weathers implements ContentList{
|
|||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
snow = new Weather("snow"){
|
snow = new Weather("snow"){
|
||||||
|
Rand rand = new Rand();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(){
|
public void draw(){
|
||||||
|
rand.setSeed(0);
|
||||||
|
float yspeed = 2f, xspeed = 0.25f;
|
||||||
|
float padding = 16f;
|
||||||
|
float size = 12f;
|
||||||
|
Core.camera.bounds(Tmp.r1);
|
||||||
|
Tmp.r1.grow(padding);
|
||||||
|
|
||||||
|
for(int i = 0; i < 100; i++){
|
||||||
|
float scl = rand.random(0.5f, 1f);
|
||||||
|
float scl2 = rand.random(0.5f, 1f);
|
||||||
|
float sscl = rand.random(0.2f, 1f);
|
||||||
|
float x = (rand.random(0f, world.unitWidth()) + Time.time() * xspeed * scl2);
|
||||||
|
float y = (rand.random(0f, world.unitHeight()) - Time.time() * yspeed * scl);
|
||||||
|
|
||||||
|
x += Mathf.sin(y, rand.random(30f, 80f), rand.random(1f, 7f));
|
||||||
|
|
||||||
|
x -= Tmp.r1.x;
|
||||||
|
y -= Tmp.r1.y;
|
||||||
|
x = Mathf.mod(x, Tmp.r1.width);
|
||||||
|
y = Mathf.mod(y, Tmp.r1.height);
|
||||||
|
x += Tmp.r1.x;
|
||||||
|
y += Tmp.r1.y;
|
||||||
|
|
||||||
|
Draw.rect("circle-shadow", x, y, size * sscl, size * sscl);
|
||||||
|
}
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -32,7 +32,7 @@ public class Logic implements ApplicationListener{
|
|||||||
public Logic(){
|
public Logic(){
|
||||||
Events.on(WorldLoadEvent.class, event -> {
|
Events.on(WorldLoadEvent.class, event -> {
|
||||||
//TODO remove later
|
//TODO remove later
|
||||||
Weathers.snow.create();
|
//Weathers.snow.create();
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(WaveEvent.class, event -> {
|
Events.on(WaveEvent.class, event -> {
|
||||||
|
@ -79,8 +79,8 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
|||||||
Vec2 v = Geometry.overlap(Tmp.r1, Tmp.r2, true);
|
Vec2 v = Geometry.overlap(Tmp.r1, Tmp.r2, true);
|
||||||
float tm = mass() + unit.mass();
|
float tm = mass() + unit.mass();
|
||||||
float s1 = mass() / tm, s2 = unit.mass() / tm;
|
float s1 = mass() / tm, s2 = unit.mass() / tm;
|
||||||
impulse(v.x*s2/scale, v.y*s2/scale);
|
move(v.x*s2/scale, v.y*s2/scale);
|
||||||
unit.impulse(-v.x*s1/scale, -v.y*s1/scale);
|
unit.move(-v.x*s1/scale, -v.y*s1/scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -139,6 +139,11 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
|||||||
tile.entity.unitOn(this);
|
tile.entity.unitOn(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//kill when stuck in wall
|
||||||
|
if(isGrounded() && tile.solid()){
|
||||||
|
kill();
|
||||||
|
}
|
||||||
|
|
||||||
//apply damage
|
//apply damage
|
||||||
if(floor.damageTaken > 0f){
|
if(floor.damageTaken > 0f){
|
||||||
damageContinuous(floor.damageTaken);
|
damageContinuous(floor.damageTaken);
|
||||||
|
@ -28,7 +28,7 @@ public class AIController implements UnitController{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean retarget(){
|
protected boolean retarget(){
|
||||||
return timer.get(timerTarget, 20);
|
return timer.get(timerTarget, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void targetClosest(){
|
protected void targetClosest(){
|
||||||
|
Reference in New Issue
Block a user