Rectangles
This commit is contained in:
@@ -98,7 +98,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
@Override
|
||||
public void getHitbox(Rectangle rectangle){
|
||||
rectangle.setSize(5).setCenter(x, y);
|
||||
rectangle.setSize(mech.hitsize).setCenter(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@ import io.anuke.mindustry.world.blocks.Floor;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.impl.DestructibleEntity;
|
||||
import io.anuke.ucore.entities.trait.DamageTrait;
|
||||
import io.anuke.ucore.entities.trait.DrawTrait;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
@@ -49,6 +50,11 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
protected CarryTrait carrier;
|
||||
protected float drownTime;
|
||||
|
||||
@Override
|
||||
public boolean movable(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnitInventory getInventory(){
|
||||
return inventory;
|
||||
@@ -94,8 +100,13 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
|
||||
@Override
|
||||
public boolean collides(SolidTrait other){
|
||||
return true;//other instanceof DamageTrait && other
|
||||
// instanceof TeamTrait && state.teams.areEnemies((((TeamTrait) other).getTeam()), team) && !isDead();
|
||||
if(isDead()) return true;
|
||||
|
||||
if(other instanceof DamageTrait){
|
||||
return other instanceof TeamTrait && state.teams.areEnemies((((TeamTrait) other).getTeam()), team);
|
||||
}else{
|
||||
return other instanceof Unit && ((Unit) other).isFlying() == isFlying();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.entities.traits;
|
||||
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.ucore.entities.trait.PosTrait;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
import io.anuke.ucore.entities.trait.VelocityTrait;
|
||||
|
||||
/**
|
||||
@@ -14,10 +15,16 @@ public interface TargetTrait extends PosTrait, VelocityTrait{
|
||||
Team getTeam();
|
||||
|
||||
default float getTargetVelocityX(){
|
||||
if(this instanceof SolidTrait){
|
||||
return ((SolidTrait) this).getDeltaX();
|
||||
}
|
||||
return getVelocity().x;
|
||||
}
|
||||
|
||||
default float getTargetVelocityY(){
|
||||
if(this instanceof SolidTrait){
|
||||
return ((SolidTrait) this).getDeltaY();
|
||||
}
|
||||
return getVelocity().y;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class UnitType extends UnlockableContent{
|
||||
public final String name;
|
||||
public final String description;
|
||||
public float health = 60;
|
||||
public float hitsize = 5f;
|
||||
public float hitsize = 7f;
|
||||
public float hitsizeTile = 4f;
|
||||
public float speed = 0.4f;
|
||||
public float range = 160;
|
||||
|
||||
Reference in New Issue
Block a user