예제 #1
0
        /// <summary>
        /// This Method fills the _neighbourTiles List with the respective Tiles
        /// It should be called when _world is completely created.
        /// </summary>
        public void BuildNeighbourTiles()
        {
            Vector2i otherTilePos = _positionInTiles + new Vector2i(1, 0);

            NeighbourTiles.Add(_world.GetTileOnPosition(otherTilePos));

            otherTilePos = _positionInTiles + new Vector2i(-1, 0);
            NeighbourTiles.Add(_world.GetTileOnPosition(otherTilePos));

            otherTilePos = _positionInTiles + new Vector2i(0, 1);
            NeighbourTiles.Add(_world.GetTileOnPosition(otherTilePos));

            otherTilePos = _positionInTiles + new Vector2i(0, -1);
            NeighbourTiles.Add(_world.GetTileOnPosition(otherTilePos));
        }
예제 #2
0
        public void Update(TimeObject timeObject)
        {
            _totalTime += timeObject.ElapsedGameTime;
            IsRaining   = (Math.Sin(_rainOffset + _rainFrequency * _totalTime) > 0);

            _absolutePosition += _moveVector * _moveSpeed * timeObject.ElapsedGameTime * 2.0f;

            _moveTimer -= timeObject.ElapsedGameTime;
            if (_moveTimer <= 0)
            {
                _moveTimer = _moveTimerMax;
                _moveSpeed = GetMoveSpeedOnTileProperties(_world.GetTileOnPosition(PositionInTiles).GetTileProperties());
            }
        }