com.threerings.tudey.server.logic
Class Logic

java.lang.Object
  extended by com.threerings.util.ShallowObject
      extended by com.threerings.tudey.server.logic.Logic
Direct Known Subclasses:
ActionLogic, ActivityLogic, ActorLogic, BehaviorLogic, ConditionLogic, EffectLogic, EntryLogic, ExpressionLogic, HandlerLogic, RegionLogic, ScriptLogic, TargetLogic

public abstract class Logic
extends ShallowObject

Handles the server-side processing for some entity.


Nested Class Summary
static interface Logic.ShapeObserver
          An interface for objects interested in updates to the logic's shape (as returned by getShape()).
 
Constructor Summary
Logic()
           
 
Method Summary
 void addShapeObserver(Logic.ShapeObserver observer)
          Adds an observer for changes to the logic's shape.
 EntityKey getEntityKey()
          Returns the entity key for this logic, if any.
 ConfigReference<ModelConfig> getModel()
          Returns a reference to the model associated with this logic, if any.
 Vector2f[] getPatrolPath()
          Returns a patrol path for this logic.
 float getRotation()
          Returns the rotation of this logic for the purpose of spawning actors, etc.
 TudeySceneManager getSceneManager()
          Returns a reference to the scene manager that owns the logic.
 Shape getShape()
          Returns a reference to this logic's shape, or returns null for none.
 String[] getTags()
          Returns the tags for this logic, if any.
 Transform2D getTransform()
          Convenience method to retrieve the translation and rotation in a new transform.
 Transform2D getTransform(Transform2D result)
          Convenience method to retrieve the translation and rotation in a transform.
 Vector2f getTranslation()
          Returns the translation of this logic for the purpose of spawning actors, etc.
 Object getVariable(String name)
          Retrieves the value of a variable (or null if unset).
 void init(TudeySceneManager scenemgr)
          Initializes the logic.
 boolean isActive()
          Determines whether this logic object is still active in the scene.
 boolean isDefaultEntrance()
          Checks whether this logic object corresponds to a default entrance.
 boolean isVisible(ActorLogic actor)
          Determines whether this logic object is "visible" to the specified actor.
 void removeShapeObserver(Logic.ShapeObserver observer)
          Removes a shape observer.
 void request(int timestamp, PawnLogic source, String name)
          Notifies the logic of a client request.
 Logic resolveTarget()
          Resolve the appropriate source target logic.
 void setVariable(int timestamp, Logic source, String name, Object value)
          Sets the value of a variable.
 void signal(int timestamp, Logic source, String name)
          Sends a generic "signal" to the logic.
 void transfer(Logic source, Map<Object,Object> refs)
          Transfers state from the specified source logic.
 
Methods inherited from class com.threerings.util.ShallowObject
equals, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Logic

public Logic()
Method Detail

init

public void init(TudeySceneManager scenemgr)
Initializes the logic.


getSceneManager

public TudeySceneManager getSceneManager()
Returns a reference to the scene manager that owns the logic.


getTags

public String[] getTags()
Returns the tags for this logic, if any.


isDefaultEntrance

public boolean isDefaultEntrance()
Checks whether this logic object corresponds to a default entrance.


isActive

public boolean isActive()
Determines whether this logic object is still active in the scene.


isVisible

public boolean isVisible(ActorLogic actor)
Determines whether this logic object is "visible" to the specified actor.


getEntityKey

public EntityKey getEntityKey()
Returns the entity key for this logic, if any.


getTransform

public Transform2D getTransform()
Convenience method to retrieve the translation and rotation in a new transform.


getTransform

public Transform2D getTransform(Transform2D result)
Convenience method to retrieve the translation and rotation in a transform.

Returns:
a reference to the result transform, for chaining.

getTranslation

public Vector2f getTranslation()
Returns the translation of this logic for the purpose of spawning actors, etc.


getRotation

public float getRotation()
Returns the rotation of this logic for the purpose of spawning actors, etc.


getShape

public Shape getShape()
Returns a reference to this logic's shape, or returns null for none.


getPatrolPath

public Vector2f[] getPatrolPath()
Returns a patrol path for this logic.


addShapeObserver

public void addShapeObserver(Logic.ShapeObserver observer)
Adds an observer for changes to the logic's shape.


removeShapeObserver

public void removeShapeObserver(Logic.ShapeObserver observer)
Removes a shape observer.


getModel

public ConfigReference<ModelConfig> getModel()
Returns a reference to the model associated with this logic, if any.


signal

public void signal(int timestamp,
                   Logic source,
                   String name)
Sends a generic "signal" to the logic.

Parameters:
timestamp - the signal timestamp.
source - the source of the signal.

setVariable

public void setVariable(int timestamp,
                        Logic source,
                        String name,
                        Object value)
Sets the value of a variable.

Parameters:
timestamp - the set timestamp.
source - the source of the request.

getVariable

public Object getVariable(String name)
Retrieves the value of a variable (or null if unset).


request

public void request(int timestamp,
                    PawnLogic source,
                    String name)
Notifies the logic of a client request.

Parameters:
timestamp - the request timestamp.
source - the source of the request.

resolveTarget

public Logic resolveTarget()
Resolve the appropriate source target logic.


transfer

public void transfer(Logic source,
                     Map<Object,Object> refs)
Transfers state from the specified source logic. Where relevant, this also takes the place of addition/startup notification.



Copyright © 2011. All Rights Reserved.