Created
June 6, 2015 14:32
-
-
Save 7yl4r/5e50f3a5e90fcf796abf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WeaponListener implements BaseComponentListener { | |
@Override | |
public void run(BaseComponent comp, BaseComponentMessage msg, ListenableData data) { | |
ShootToMessage shootTo = (ShootToMessage) msg; | |
WeaponComponent wc = (WeaponComponent) comp; | |
// access to the player position | |
float x = data.x; | |
float y = data.y; | |
float angle = 0; | |
wc.shoot(angle); | |
} | |
@Override | |
public boolean validate(BaseComponentMessage msg) { | |
return msg instanceof ShootToMessage; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment