/* LEARNING PILL: Token default properties. * In the XNA Machinationis Ratio engine tokens have properties that define * how the behave and are visualized. Using the DefaultProperties method * it is possible to assign deafult values to the token's properties, * after the token has been created. */ /// <summary> /// Setup default values for this token's porperties. /// </summary> protected override void DefaultProperties() { // Specify which image should be associated to this token, assigning // the name of the graphic asset to be used ("AquariumVisuals" in this case) // to the property 'GraphicProperties.AssetID' of the token. this.GraphicProperties.AssetID = "AquariumVisuals"; /* LEARNING PILL: Token behaviors in the XNA Machinationis Ratio engine * Some simulation tokens may need to enact specific behaviors in order to * participate in the simulation. The XNA Machinationis Ratio engine * allows a token to enact a behavior by associating an artificial intelligence * mind to it. Mind objects are created from subclasses of the class AIPlayer * included in the engine. In order to associate a mind to a token, a new * mind object must be created, passing to the constructor of the mind a reference * of the object that must be associated with the mind. This must be done in * the DefaultProperties method of the token. Upon creation of the mind, XNA * Machinationis Ratio automatically "injects" its into the token, establishing * a link which is not visible to the programmer (but it there!) * * In this case, instances of the class OrangeFishToken can enact a simple swimming * behavior. The behavior is implemented through the class SimpleSwimind. */ AquariumMind myMind = new AquariumMind(this); // Create mind, implicitly associating it to the token. mind = myMind; // Store explicit reference to mind being used. mind.Aquarium = this; // Provide to mind explicit reference to Aquarium. }
/* LEARNING PILL: Token default properties. * In the XNA Machinationis Ratio engine tokens have properties that define * how the behave and are visualized. Using the DefaultProperties method * it is possible to assign deafult values to the token's properties, * after the token has been created. */ /// <summary> /// Setup default values for this token's porperties. /// </summary> protected override void DefaultProperties() { // Specify which image should be associated to this token, assigning // the name of the graphic asset to be used ("AquariumVisuals" in this case) // to the property 'GraphicProperties.AssetID' of the token. this.GraphicProperties.AssetID = "AquariumVisuals"; AquariumMind myMind = new AquariumMind(this); // Create mind, implicitly associating it to the token. mMind = myMind; // Store explicit reference to mind being used. mMind.Aquarium = this; // Provide to mind explicit reference to Aquarium. }