Public Member Functions | |
def | __init__ |
def | addInteraction |
def | addTags |
def | removeTags |
def | getSuperClassName |
def | introduction |
def | catchingUp |
Static Public Member Functions | |
def | initTagDomain |
def | objFromId |
def | idFromObj |
Public Attributes | |
objid | |
A GameObject's unique identifier. | |
parent | |
A GameObject's parent. | |
layer | |
The Layer to which the GameObject belongs. | |
tags | |
A list of tags (a subset of GameObject.tagdomain) | |
visibility | |
A list of GameObjects allowed to see the GameObject Implementation of visibility is left to the game developer. | |
interactability | |
A list of GameObjects allowed to interact with the GameObject Implementation of interactability is left to the game developer. | |
position | |
A 3D vector with the GameObject's spacial position relative to self.parent. | |
space | |
A GameSpace object to which all of the GameObject spatial information refers. | |
gridposition | |
A 2D vector with the coordinates of the GameSpace.grid's cell in which the GameObject is. | |
lastgridposition | |
A 2D vector with the coordinates of the GameSpace.grid's cell in which the GameObject was one turn before the current turn. | |
rotation | |
A 3D vector with the GameObject's rotation relative to self.parent. | |
scale | |
A 3D vector with the GameObject's scale relative to self.parent. | |
lookat | |
A 3D vector with the direction at which the GameObject is looking. | |
isrigid | |
A bool that indicates if the GameObject is rigid and, therefore, subject to collisions. | |
interactiondomain | |
A list of possible interaction types (Intreraction,interactiontype) for the GameObject. | |
interactiontimelimit | |
A time limit in which another object must interact with the GameObject in a turn. | |
interactionQ | |
A queue of Interactions yet to be processed. | |
script | |
A Script object to dictate the GameObject's behaviour. | |
score | |
The GameObject's score in the game. | |
team | |
The Team to which the GameObject belongs. | |
latency | |
The number of turns the GameObject must remain inactive. | |
Static Public Attributes | |
list | gameobjects = [] |
A list of every GameObject in play. | |
dictionary | tagdomain = {} |
A dictionary of all possible tags for GameObjects. | |
game = None | |
A reference to an instance of class Game. |
A class that represents all objects in a game. To be inherited by more specific classes
def GameObject.GameObject.__init__ | ( | self, | |
objid, | |||
position, | |||
space, | |||
rotation, | |||
scale, | |||
lookat, | |||
tags, | |||
visibility, | |||
interactability, | |||
interactiondomain, | |||
isrigid = False , |
|||
parent = None , |
|||
layer = None , |
|||
interactiontimelimit = 0 , |
|||
script = None , |
|||
team = None , |
|||
latency = 0 , |
|||
score = 0 |
|||
) |
GameObject.__init__(self, objid, parent, layer, tags, visibility, interactability, position, space, rotation, scale, lookat, isrigid, interactiondomain, fprocessinteraction, interactiontimelimit, script, team = None, latency = 0, score = 0 ) Initialization function for a GameObject. objid is the identification number position is a 3d vector indicating the object's position space is a GameSpace object to which the GameObject's spatial information refers rotation is a 3d vector indicating the object's rotation scale is a 3d vector indicating the object's scale relative to its original size lookat is a 3d vector indicating the direction to which the object is looking isrigid is a boolean to prevent objects from going through each other parent is a parent GameObject to be used in the scene graph at the studio. position, rotation and scale will be relative to parent. layer is the game layer to which the object belongs tags are a subset of GameObject.tagdomain visibility is a list intended to contain everyone who can see the object interactability is a list intended to contain everyone who can interact with the object interactiondomain is a list of possible interactions for the object. interactiontimelimit is the time limit a player has to interact with the object at each turn script is a Script Object who will dictate the object's behavior at each turn team is a Team object that indicates to which team the object belongs latency is the number of turns the object will be inactive. -1 is indefinitely score is the GameObject's score in the game.
def GameObject.GameObject.addInteraction | ( | self, | |
interaction, | |||
interactor, | |||
lcond, | |||
lcons | |||
) |
GameObject.addInteraction(self, interaction, interactor, lcond, lcons) Checks if an Interaction which a GameObject suffered is valid. If so, it adds the Interaction to the GameObject's interactionQ interaction is an object of class Interaction interactor is the GameObject -usually a Player- that made the Interaction lcond is a list of parameters to be passed to interaction.fconditions lcons is a list of parameters to be passed to interactions.fconsequences if interaction.fconditions(lcond) returns True
def GameObject.GameObject.addTags | ( | self, | |
tagkeys | |||
) |
GameObject.addTag(self, tagkeys) adds a list of tags to GameObject.tags. Each element in the argument tags is a key for GameObject.tagdomain, NOT A VALUE. if one of the tags is not in GameObject.tagdomain, it is not added
def GameObject.GameObject.catchingUp | ( | self | ) |
Generates a JSON friendly dictionary with all the object's attributes and values. This function is intended as a update on the object's state, sent to receivers that are already able to identify the object.
Reimplemented in Character.Character.
def GameObject.GameObject.getSuperClassName | ( | self | ) |
A function that returns 'GameObject'. Used to assert that the supermost class of an object is GameObject
def GameObject.GameObject.idFromObj | ( | objct | ) | [static] |
GameObject.idFromObj(objct) [STATIC] Function that retrieves a GameObject objct's objid if objct is in GameObject.gameobjects
def GameObject.GameObject.initTagDomain | ( | tagdomain | ) | [static] |
GameObject.initTagDomain(tagdomain) [STATIC] Function to initialize GameObject.tagdomain with a dictionary tagdomain
def GameObject.GameObject.introduction | ( | self | ) |
Generates a JSON friendly dictionary with all the object's attributes and values. This function is intended as a first introduction of the object, to receivers that are unaware of its existence.
Reimplemented in Character.Character.
def GameObject.GameObject.objFromId | ( | objid | ) | [static] |
GameObject.objFromId(objid) [STATIC] Function that returns a GameObject from his objid or None if there`s no object by objid
def GameObject.GameObject.removeTags | ( | self, | |
tagkeys | |||
) |
GameObject.removeTags(self, tagkeys) removes a list of tags from a GameObject's tags attribute. Each element in the argument tagkeys is a key for GameObject.tagdomain, NOT A VALUE. If a tag in tagkeys is not in the GameObject's tags list, it's ignored
GameObject.GameObject::game = None [static] |
A reference to an instance of class Game.
A list of possible interaction types (Intreraction,interactiontype) for the GameObject.
A 2D vector with the coordinates of the GameSpace.grid's cell in which the GameObject was one turn before the current turn.
The number of turns the GameObject must remain inactive.
-1 indicates an indefinite latency
A GameObject's unique identifier.
A GameObject's parent.
It must be another GameObject or None
dictionary GameObject.GameObject::tagdomain = {} [static] |
A dictionary of all possible tags for GameObjects.
Each GameObject can have any number of tags (self.tags)