Added placeholder code to allow casting using mobile controls

This commit is contained in:
Collin Smith 2020-08-24 00:59:58 -07:00
parent 579476df2f
commit 5868465bb6
2 changed files with 11 additions and 3 deletions

View File

@ -62,8 +62,10 @@ public class Actioneer extends PassiveSystem {
log.trace("mode changed to {} because it was invalid", mode);
}
if (!targetVec.isZero()) {
Vector2 entityPos = mPosition.get(entityId).position;
mAngle.get(entityId).target.set(targetVec).sub(entityPos).nor();
}
mSequence.create(entityId).sequence(mode, mMovementModes.get(entityId).NU);
mCasting.create(entityId).set(skillId, targetVec);

View File

@ -1,5 +1,7 @@
package com.riiablo.screen.panel;
import net.mostlyoriginal.api.event.common.EventSystem;
import com.badlogic.gdx.assets.AssetDescriptor;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
@ -11,14 +13,14 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Disposable;
import com.riiablo.Riiablo;
import com.riiablo.codec.DC6;
import com.riiablo.engine.client.event.InteractEvent;
import com.riiablo.engine.server.Actioneer;
import com.riiablo.widget.Button;
import com.riiablo.widget.HotkeyButton;
import net.mostlyoriginal.api.event.common.EventSystem;
public class MobileControls extends WidgetGroup implements Disposable {
final AssetDescriptor<DC6> SkilliconDescriptor = new AssetDescriptor<>("data\\global\\ui\\SPELLS\\Skillicon.DC6", DC6.class);
DC6 Skillicon;
@ -27,6 +29,7 @@ public class MobileControls extends WidgetGroup implements Disposable {
DC6 SoSkillicon;
protected EventSystem events;
protected Actioneer actioneer;
Button interact;
HotkeyButton skills[];
@ -87,7 +90,10 @@ public class MobileControls extends WidgetGroup implements Disposable {
}
HotkeyButton actor = (HotkeyButton) event.getListenerActor();
// gameScreen.player.cast(actor.getSkill());
final int skillId = actor.getSkill();
if (skillId == -1) return;
actioneer.cast(Riiablo.game.player, skillId, Vector2.Zero);
// TODO: above target is placeholder
}
};
gestureListener.getGestureDetector().setLongPressSeconds(0.5f);