Support for unit missiles
This commit is contained in:
28
core/src/mindustry/entities/comp/TimedKillComp.java
Normal file
28
core/src/mindustry/entities/comp/TimedKillComp.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package mindustry.entities.comp;
|
||||
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
//basically just TimedComp but kills instead of removing.
|
||||
@Component
|
||||
abstract class TimedKillComp implements Entityc, Healthc, Scaled{
|
||||
float time, lifetime;
|
||||
|
||||
//called last so pooling and removal happens then.
|
||||
@MethodPriority(100)
|
||||
@Override
|
||||
public void update(){
|
||||
time = Math.min(time + Time.delta, lifetime);
|
||||
|
||||
if(time >= lifetime){
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float fin(){
|
||||
return time / lifetime;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user