Exemplo n.º 1
0
 /**
  * This method sets up the Node structure for Pot objects.
  *
  * @param parent The parent node of the PotNode.
  */
 private void setupPots(Node parent) {
   CustomNode potNode = new CustomNode("PotNode");
   // Pots are too light by default. A reverse ambient light fixes that
   AmbientLight al;
   al = new AmbientLight();
   al.setColor(ColorRGBA.White.mult(-1.5f));
   potNode.addLight(al);
   parent.attachChild(potNode);
 }
Exemplo n.º 2
0
  private void setupWorld() {
    // Set up the Node structure for game objects
    CustomNode clickableObjectNode = new CustomNode("ClickableObjectNode");
    CustomNode nonClickableObjectNode = new CustomNode("NonClickableObjectNode");
    CustomNode gameObjectNode = new CustomNode("GameObjectNode");

    gameObjectNode.attachChild(clickableObjectNode);
    gameObjectNode.attachChild(nonClickableObjectNode);
    rootNode.attachChild(gameObjectNode);

    // Set up the different tank nodes for storing fish
    // CustomNode arenaTank = new CustomNode("ArenaTank")
    // Fish in the arena tank are stored in the FishNode
    CustomNode stockTank = new CustomNode("StockTank");
    // Fish in the stock and isolation tanks shouldn't be displayed in the arena tank.
    CustomNode isolationTank = new CustomNode("IsolationTank");

    // So, cull the nodes
    stockTank.setCullHint(Spatial.CullHint.Always);
    isolationTank.setCullHint(Spatial.CullHint.Always);

    nonClickableObjectNode.attachChild(stockTank);
    nonClickableObjectNode.attachChild(isolationTank);

    // Register those Nodes with the NodeCollection
    cichlid_sim.game.NodeCollection.addNode(rootNode, "RootNode");
    // CustomNode objects are automatically added to the NodeCollection
    // cichlid_sim.game.NodeCollection.addNode(clickableObjectNode, "ClickableObjects")
    // cichlid_sim.game.NodeCollection.addNode(nonClickableObjectNode, "NonClickableObjects")
    // cichlid_sim.game.NodeCollection.addNode(gameObjectNode, "GameObjectNode")

    // Setup GameObject Nodes
    setupTank(nonClickableObjectNode);
    setupFish(clickableObjectNode);
    setupPots(clickableObjectNode);
    setupPlants(clickableObjectNode);
    setupAxes(nonClickableObjectNode);

    // Setup Lights
    setupLights();

    // Start the AI
    realAI = new RealAI();

    this.isLoaded = true;
  }
Exemplo n.º 3
0
 /**
  * This method sets up the axes node and creates a representation of the default (right handed)
  * world coordinate system.
  *
  * @param parent The parent node of the AxesNode.
  */
 private void setupAxes(Node parent) {
   CustomNode axesNode = new CustomNode("AxesNode");
   axesNode.attachChild(new Axes("Axes", 5f));
   AxesToggleActionHandler.addAxes(axesNode);
   parent.attachChild(axesNode);
 }