Code Search for Developers
 
 
  

Test.java from Riot in Emerald city at Krugle


Show Test.java syntax highlighted

/*
 * Copyright (C) 2001-2005 Pleasant nightmare studio
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
package org.pleasantnightmare.riotinecity.console;

import com.jme.intersection.BoundingCollisionResults;

/**
 * Tests collisions to see if player character collides with
 * any interactible object. If such object is detected, it
 * prints out its ID.
 *
 * @author: deus
 * @since: Mar 26, 2007 2:30:58 PM
 * @version: 1.0
 */
public class Test extends InputProcessor {
    public static final String COMMAND = "ti";
    private BoundingCollisionResults collisionResults;

    public Test() {
        collisionResults = new BoundingCollisionResults();
    }

    public void process(String input) throws ProcessingError {
        collisionResults.clear();
        rootNode.calculateCollisions(rootNode, collisionResults);
        processCollisions();
    }

    public void processCollisions() throws ProcessingError {
        if (collisionResults.getNumber() <= 0)
            throw new ProcessingError("No interactible object detected.");

        for (int i = 0; i < collisionResults.getNumber(); i++)
            model.writeLine(collisionResults.getCollisionData(i).getSourceMesh().getParent().getName());
    }

    public boolean isProcessable(String input) {
        return input.trim().equals(COMMAND);
    }

    public String getCommand() {
        return COMMAND;
    }
}




See more files for this project here

Riot in Emerald city

Cyberpunk third-person 2100. noir RPG thriller using JMonkey. Its going to be mix between Bloodnet, Neuromancer, DeusEx in gameplay, with pieces of Uplink and many other mini-games for dealing with variety of tasks (lockpicking, hacking...)

Project homepage: http://sourceforge.net/projects/riot-in-ecity
Programming language(s): Java,XML
License: other

  ActionList.java
  Call.java
  ConsoleEngine.java
  ConsoleModel.java
  ConsoleSpatial.java
  ConsoleToggleAction.java
  Help.java
  InputProcessor.java
  ProcessingError.java
  Select.java
  Test.java