package com.saltosion.sog.multiplayer.actions;

import com.saltosion.sog.components.CPlayer;

public class UpdateMovement extends Action {
	
	private boolean left, up, right, down;

	@Override
	public void runServer() {
		CPlayer playerComponent = getPlayer().getControlledEntity().getComponent(CPlayer.class);
		if (playerComponent == null) {
			return; // Something is wrong? Player has no CPlayer component, but it should have.
		}

		playerComponent.up = up;
		playerComponent.left = left;
		playerComponent.down = down;
		playerComponent.right = right;
	}

	@Override
	public void runClient() {
		
	}
	
	public void setDirection(boolean up, boolean left, boolean down, boolean right) {
		this.up = up;
		this.left = left;
		this.down = down;
		this.right = right;
	}

}
