Package com.benkyou.common

Source Code of com.benkyou.common.Player

/*
* Project Beknyou
* Copyright (c) 2010-2011 Saint Paul College, All Rights Reserved
* Redistributions in source code form must reproduce the above
* Copyright and this condition.
* The contents of this file are subject to the GNU General Public
* License, Version 2 (the "License"); you may not use this file
* except in compliance with the License. A copy of the License is
* available at http://www.opensource.org/licenses/gpl-license.php.
*/
package com.benkyou.common;

import com.jme3.asset.AssetManager;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;
import com.jme3.bullet.control.CharacterControl;
import com.jme3.scene.Geometry;

/**
*
* @author Austin Allman
*/
public class Player extends Node {

    private Avatar avatarInfo;
    private Node avatar;
    private AssetManager mgr;
    private String name;
    private CharacterControl character_phys;
    private CapsuleCollisionShape capsuleShape;
    private boolean attached;
    private boolean physicsSetup;
    private Vector3f moveDirection;
    private String uuid;
    private int id;
    private boolean atachementUpdate;
    public static final Vector3f spawnLocation = new Vector3f(10.0f, 50.0f, 10.0f);
    private boolean markedForDeletion;

    public Player(String name, int id, String uuid) {
        this.name = name;
        this.id = id;
        this.uuid = uuid;
    }



    public Vector3f getPosition() {
        return avatar.getWorldTranslation();
    }

    public Spatial getAvatar() {
        return avatar;
    }

    public String getName() {
        return name;
    }

    public Player setupCharacterPhysics() {
        capsuleShape = new CapsuleCollisionShape(3f, 4f);
        character_phys = new CharacterControl(capsuleShape, 0.05f);
        character_phys.setApplyPhysicsLocal(true);
        this.addControl(character_phys);
        // avatar.addControl(character_phys);

        return this;
    }

    public CharacterControl getCharacterPhysics() {
        return character_phys;
    }

    public String toString() {
        return name;
    }
    Geometry cube_translucent;
    /*public void test(){
   
    Box boxshape3 = new Box(Vector3f.ZERO, 3f,1f,3f);
    cube_translucent = new Geometry("translucent cube", boxshape3);
    Material mat_tt = new Material(gameClient.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    Texture2D tex = new Texture2D(500,500,Format.RGB8);
    mat_tt.setTexture("ColorMap", tex);
    tex.setImage(new TextImageGenerator(name).getTextImage());
   
    mat_tt.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
    cube_translucent.setMaterial(mat_tt);
    attachChild(cube_translucent);
    cube_translucent.setLocalTranslation(10f, 10f, -30f);
    }*/

    public String getUUID() {
        return uuid;
    }

    public boolean isAttached() {
        return attached;
    }

    public void setAttached(boolean attached) {
        this.attached = attached;
    }

    public boolean isPhysicsSetup() {
        return physicsSetup;
    }

    public void setPhysicsSetup(boolean physicsSetup) {
        this.physicsSetup = physicsSetup;
    }

    public Vector3f getWalkDirection() {
        return moveDirection;
    }

    public void setWalkDirection(float x, float y, float z) {
        moveDirection = new Vector3f(x, y, z);
    }

    public int getID() {
        return id;
    }

    public boolean isAtachementUpdate() {
        return atachementUpdate;
    }

    public void setAtachementUpdate(Boolean bol) {
        atachementUpdate = bol;
    }

    public void markedForDeletion() {
        markedForDeletion = true;
    }
    public void setMarkedForDeletion(boolean markedForDeletion){
        this.markedForDeletion = markedForDeletion;
    }

    public boolean isMarkedForDeletion() {
        return markedForDeletion;
    }
}
TOP

Related Classes of com.benkyou.common.Player

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.