mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-20 09:17:29 +07:00
Added teleport spell code
Spells may require encapsulation to allow easier management
This commit is contained in:
parent
7a1c32105e
commit
55cae9cc8b
@ -12,9 +12,11 @@ import com.badlogic.gdx.math.Vector2;
|
||||
import com.riiablo.Riiablo;
|
||||
import com.riiablo.codec.excel.Skills;
|
||||
import com.riiablo.engine.Engine;
|
||||
import com.riiablo.engine.server.component.Box2DBody;
|
||||
import com.riiablo.engine.server.component.Casting;
|
||||
import com.riiablo.engine.server.component.Class;
|
||||
import com.riiablo.engine.server.component.MovementModes;
|
||||
import com.riiablo.engine.server.component.Position;
|
||||
import com.riiablo.engine.server.component.Sequence;
|
||||
import com.riiablo.engine.server.event.AnimDataFinishedEvent;
|
||||
import com.riiablo.engine.server.event.AnimDataKeyframeEvent;
|
||||
@ -29,6 +31,10 @@ public class Actioneer extends PassiveSystem {
|
||||
protected ComponentMapper<MovementModes> mMovementModes;
|
||||
protected ComponentMapper<Casting> mCasting;
|
||||
|
||||
// teleport-specific components
|
||||
protected ComponentMapper<Position> mPosition;
|
||||
protected ComponentMapper<Box2DBody> mBox2DBody;
|
||||
|
||||
protected EventSystem events;
|
||||
|
||||
public void cast(int entityId, int skillId, Vector2 target) {
|
||||
@ -92,6 +98,11 @@ public class Actioneer extends PassiveSystem {
|
||||
break;
|
||||
case 1: // attack
|
||||
break;
|
||||
case 27: // teleport
|
||||
mPosition.get(entityId).position.set(target);
|
||||
Box2DBody box2dWrapper = mBox2DBody.get(entityId);
|
||||
if (box2dWrapper != null) box2dWrapper.body.setTransform(target, 0);
|
||||
break;
|
||||
default:
|
||||
log.warn("Unsupported srvdofunc({}) for {}", srvdofunc, entityId);
|
||||
// TODO: default case will log an error when all valid cases are enumerated
|
||||
|
Loading…
Reference in New Issue
Block a user