示例#1
0
 //A bounding box is created in intialise to check for input using collision detection with the mouse position.
 public override void Initialise()
 {
     _renderComponent         = new RenderComponent(this);
     _renderComponent.Texture = this._texture;
     _boundingBox             = new Rectangle((int)this._position.X, (int)this._position.Y, _renderComponent.Texture.Width, _renderComponent.Texture.Height);
     _inputComponent          = new InputComponent(this);
     _audioComponent          = new AudioComponent(this);
     _audioComponent.SoundEffect(_sound);
     base.Initialise();
 }
示例#2
0
        //Sets up the components as well as the starting position of the town.
        public override void Initialise()
        {
            _renderComponent         = new RenderComponent(this);
            _renderComponent.Texture = this._texture;
            _inputComponent          = new InputComponent(this);
            _townComponent           = new TownComponent(this);
            _townUtility             = new TownProperties(this);
            _audioComponent          = new AudioComponent(this);
            _audioComponent.SoundEffect(_sound);

            _townComponent.TownName   = _townUtility.getName;
            _townComponent.Population = _townUtility.getPopulation;
            this.setPosition(_townUtility.getPosition);
            _townComponent.setPosition(this.getPosition);
            _boundingBox = new Rectangle((int)this._position.X, (int)this._position.Y, _renderComponent.Texture.Width, _renderComponent.Texture.Height);
            base.Initialise();
        }