Package de.nameless.gameEngine.gameObjects

Source Code of de.nameless.gameEngine.gameObjects.NEGameObject

package de.nameless.gameEngine.gameObjects;

import java.util.Vector;

import de.nameless.gameEngine.system.NEObject;
import de.nameless.graphicEngine.NEabstractGraphicObject;
import de.nameless.graphicEngine.NEgfx;
import de.nameless.graphicEngine.texture.NEMaterialManager;

public abstract class NEGameObject extends NEObject {
 
  /**
   * Die x position des objektes in der Positionsmatrix
   */
  protected float x = 0;
 
  /**
   * Die  y position des objektes in der Positionsmatrix
   */
  protected float y = 0;
 
  public float h = 1;
 
  public float w = 1;
 
  /**
   * Hier werden die Grafikobjekte gekapselt, welche zur darstellung des GameObjekts n�tig sind
   */
  protected  NEgfx gfx;
 
  /**
   * gespeicherte kinder
   */
  public Vector<NEGameObject> children = null;
 
 
  /**
   * elter
   */
  public NEGameObject parent = null;
 
  /**
   * Standartkonstruktur
   */
  public NEGameObject() {
    children = new Vector<NEGameObject>();
  }
 
  /**
   * Generiert die Grafikobjekte, oder liefert die bestehenden.
   * @return the gfx
   */
  public Vector<NEabstractGraphicObject> getGfx(){
    if(gfx == null){   
      gfx = new NEgfx(this);     
      gfx.addAll(this.getOwnGfx());   
    }
   
    if (children.size()>0){   
      gfx = new NEgfx(this);     
      gfx.addAll(this.getOwnGfx());     
      gfx.addAllNoPathCorr(this.getChildGfx());
    }
   
    return gfx.getContent();
 
 
  public abstract void putGfxPos();
 
  private Vector<NEabstractGraphicObject> getChildGfx(){
    Vector<NEabstractGraphicObject> result = new Vector<NEabstractGraphicObject>();
   
    for (NEGameObject child : children) {
      result.addAll(child.getGfx());
    }
   
    return result;
  }
 
  protected abstract Vector<NEabstractGraphicObject> getOwnGfx();
 
  /**
   * @return the x
   */
  public float getGLX() {   
    return x;
  }

  /**
   * @param x the x to set
   */
  public void setGLX(float x) {
    this.x = x;
  }

  /**
   * @return the y
   */
  public float getGLY() {
    return y;
  }

  /**
   * @param y the y to set
   */
  public void setGLY(float y) {
    this.y = y;
  }
 
  public void addgfx(NEabstractGraphicObject o){
    o.setCausingGameObject(this);
    this.gfx.add(o);
  }
 
}
TOP

Related Classes of de.nameless.gameEngine.gameObjects.NEGameObject

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.