Examples of MovementType


Examples of be.demmel.jgws.MovementType

        }
    }

    private void movePlayer(Channel movingPlayer, Channel recipient) throws Exception {
        CharacterData character = movingPlayer.attr(SessionKey.SESSION_KEY).get().getCurrentCharacter();
        MovementType moveType = character.getMoveType();

        if (moveType == MovementType.FORWARD || moveType == MovementType.DIAG_FW_LEFT || moveType == MovementType.DIAG_FW_RIGHT || moveType == MovementType.STOP) {
            character.setSpeedModifier(1f);
        } else if (moveType == MovementType.BACKWARD || moveType == MovementType.DIAG_BW_LEFT || moveType == MovementType.DIAG_BW_RIGHT) {
            character.setSpeedModifier(.066f);
        } else if (moveType == MovementType.SIDE_LEFT || moveType == MovementType.SIDE_RIGHT) {
            character.setSpeedModifier(0.75f);
        } else if (moveType == MovementType.COLLISION) {
            // dont change speed modifier, as it is dynamically set.
            // reset movetype, cause 10 is non existant for the client
            moveType = MovementType.FORWARD;
        }

        if (moveType != MovementType.STOP && character.getMoveState() == MovementState.MOVE_CHANGE_DIR) {
            P026_MovementDirection movementDirection = new P026_MovementDirection();
            movementDirection.setAgentId(character.getAgentID());
            Vector2 direction = new Vector2(character.getDirection().getX(), character.getDirection().getY());
            movementDirection.setDirection(direction);
            movementDirection.setMoveType((short) moveType.getValue());
            recipient.write(movementDirection);
           
            // reset the moving state here
            character.setMoveState(MovementState.MOVE_KEEP_DIR);
        }

        P032_MovementSpeedModifier movementSpeedModifier = new P032_MovementSpeedModifier();
        movementSpeedModifier.setAgentId(character.getAgentID());
        movementSpeedModifier.setSpeed(character.getSpeedModifier());
        movementSpeedModifier.setMoveType((short) moveType.getValue());
        recipient.write(movementSpeedModifier);

        P030_MovementAim movementAim = new P030_MovementAim();
        movementAim.setAgentId(character.getAgentID());
        Vector2 position = new Vector2(character.getPosition().getX(), character.getPosition().getY());
View Full Code Here

Examples of gwlpr.mapshard.models.enums.MovementType

                action.getPositionVector(),
                (int) action.getPositionPlane());

        Vector2 direction = action.getMoveDirection();

        MovementType moveType = MovementType.fromInt((int)action.getMovementType());
       
        // this should not be done directly:
        pos.position = position;
        dir.direction = direction;
       
View Full Code Here

Examples of gwlpr.mapshard.models.enums.MovementType

    public static void sendChangeDirection(Channel channel, Entity entity)
    {
        // retrieve the entity related data we need...
        int agentID = entity.get(AgentIdentifiers.class).agentID;
        Vector2 dir = entity.get(Direction.class).direction;
        MovementType movT = entity.get(Movement.class).moveType;
       
        // construct the message
        P026_AgentMoveDirection moveDir = new P026_AgentMoveDirection();
        moveDir.init(channel);
        moveDir.setAgentID(agentID);
        moveDir.setDirection(dir);
        moveDir.setMovementType(movT.getVal());

        channel.writeAndFlush(moveDir);
    }
View Full Code Here

Examples of gwlpr.mapshard.models.enums.MovementType

        // retrieve the entity related data we need...
        int agentID = entity.get(AgentIdentifiers.class).agentID;
        Movement move = entity.get(Movement.class);
        WorldPosition curPos = entity.get(Position.class).position;
        WorldPosition moveTo = move.moveAim;
        MovementType movT = move.moveType;
       
        // send the messages
        P032_SpeedModifier speedMod = new P032_SpeedModifier();
        speedMod.init(channel);
        speedMod.setAgentID(agentID);
        speedMod.setModifier(movT.getSpeedModifier());
        speedMod.setMovementType(movT.getVal());

        channel.writeAndFlush(speedMod);

        // TODO check me: this is probably the place that the player would reach within
        // the next time step.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.