Beispiel #1
0
    public void UpdatePlayerPosition(Direction d)
    {
        //Get the current player position
        var playerPos = m_player.Position;
        var newPos    = DirectionUtility.GetPoint(d, playerPos);

        Debug.Log(newPos);
        if (this.m_map.GetTileData(newPos.X, newPos.Y) == TileType.Floor || this.m_map.GetTileData(newPos.X, newPos.Y) == TileType.Stone)
        {
            this.m_map.UpdateEntity(this.m_player, newPos.X, newPos.Y);
            this.m_map.UpdateLighting(playerPos, newPos, m_player.LineOfSight);
            this.m_entityMap.UpdateEntity(this.m_player, newPos.X, newPos.Y);
            //TODO This call should just take an IEnumerable to set the lighting
            this.m_lightingMap.UpdateLighting(Lighting.NotVisible, this.m_map.GetNeighboringPoints(playerPos, this.m_player.LineOfSight));
            this.m_lightingMap.UpdateLighting(Lighting.Visible, this.m_map.GetNeighboringPoints(newPos, this.m_player.LineOfSight));
            this.m_player.Position         = newPos;
            Camera.main.transform.position = new Vector3(newPos.X * TileSize, 10, (SizeY - newPos.Y) * -TileSize);
        }
    }