Minor optimization
This commit is contained in:
@@ -110,7 +110,6 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
return !type.flying && world.tiles.in(tileX, tileY) && type.pathCost.getCost(team.id, pathfinder.get(tileX, tileY)) == -1;
|
return !type.flying && world.tiles.in(tileX, tileY) && type.pathCost.getCost(team.id, pathfinder.get(tileX, tileY)) == -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @return approx. square size of the physical hitbox for physics */
|
/** @return approx. square size of the physical hitbox for physics */
|
||||||
public float physicSize(){
|
public float physicSize(){
|
||||||
return hitSize * 0.7f;
|
return hitSize * 0.7f;
|
||||||
|
|||||||
@@ -1344,16 +1344,17 @@ public class UnitType extends UnlockableContent implements Senseable{
|
|||||||
|
|
||||||
//draw back items
|
//draw back items
|
||||||
if(unit.item() != null && unit.itemTime > 0.01f){
|
if(unit.item() != null && unit.itemTime > 0.01f){
|
||||||
float size = (itemSize + Mathf.absin(Time.time, 5f, 1f)) * unit.itemTime;
|
float sin = Mathf.absin(Time.time, 5f, 1f);
|
||||||
|
float size = (itemSize + sin) * unit.itemTime;
|
||||||
|
|
||||||
Draw.mixcol(Pal.accent, Mathf.absin(Time.time, 5f, 0.1f));
|
Draw.mixcol(Pal.accent, sin * 0.1f);
|
||||||
Draw.rect(unit.item().fullIcon,
|
Draw.rect(unit.item().fullIcon,
|
||||||
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
||||||
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY),
|
unit.y + Angles.trnsy(unit.rotation + 180f, itemOffsetY),
|
||||||
size, size, unit.rotation);
|
size, size, unit.rotation);
|
||||||
Draw.mixcol();
|
Draw.mixcol();
|
||||||
|
|
||||||
size = ((3f + Mathf.absin(Time.time, 5f, 1f)) * unit.itemTime + 0.5f) * 2;
|
size = ((3f + sin) * unit.itemTime + 0.5f) * 2;
|
||||||
Draw.color(Pal.accent);
|
Draw.color(Pal.accent);
|
||||||
Draw.rect(itemCircleRegion,
|
Draw.rect(itemCircleRegion,
|
||||||
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
unit.x + Angles.trnsx(unit.rotation + 180f, itemOffsetY),
|
||||||
|
|||||||
Reference in New Issue
Block a user