Beispiel #1
0
    private bool RiseAngleCoast(Vector3Int point, char waterFlag)
    {
        MovementDirection[] movementDirections = XonixUtils.GetXYDirections();

        for (int i = 0; i < movementDirections.Length; i++)
        {
            var fDirection = movementDirections[i];
            var fPosition  = XonixUtils.GetNextPosition(point, fDirection);

            var sDirection = movementDirections[(i == movementDirections.Length - 1 ? 0 : i + 1)];
            var sPosition  = XonixUtils.GetNextPosition(point, sDirection);

            var mDirection = XonixUtils.GetDiagonalDirectionOfXY(fDirection, sDirection);
            var mPosition  = XonixUtils.GetNextPosition(point, mDirection);

            if (!HasWaterTile(fPosition, waterFlag) &&
                !HasWaterTile(sPosition, waterFlag) &&
                !HasWaterTile(mPosition, waterFlag))
            {
                waterTilemap.SetTile(point, GetCoastTileByDirection(mDirection));
                return(true);
            }
        }

        return(false);
    }
Beispiel #2
0
    private void RiseOutAngleCoast(Vector3Int trackPoint, char waterFlag)
    {
        MovementDirection[] movementDirections = XonixUtils.GetXYDirections();

        for (int i = 0; i < movementDirections.Length; i++)
        {
            var fDirection = movementDirections[i];
            var fPosition  = XonixUtils.GetNextPosition(trackPoint, fDirection);

            var sDirection = movementDirections[(i == movementDirections.Length - 1 ? 0 : i + 1)];
            var sPosition  = XonixUtils.GetNextPosition(trackPoint, sDirection);

            var mDirection = XonixUtils.GetDiagonalDirectionOfXY(fDirection, sDirection);
            var mPosition  = XonixUtils.GetNextPosition(trackPoint, mDirection);

            if (HasWaterTile(fPosition, waterFlag) &&
                HasWaterTile(sPosition, waterFlag) &&
                HasWaterTile(mPosition, waterFlag))
            {
                waterTilemap.SetTile(fPosition, GetCoastTileByDirection(fDirection));
                waterTilemap.SetTile(mPosition, GetCoastTileByDirection(mDirection, true));
                waterTilemap.SetTile(sPosition, GetCoastTileByDirection(sDirection));
                break;
            }
        }
    }
Beispiel #3
0
    private void RiseCoast(Vector3Int trackPoint, char waterFlag)
    {
        MovementDirection[] directionsXY = XonixUtils.GetXYDirections();

        foreach (var xyDirection in directionsXY)
        {
            var nextPos = XonixUtils.GetNextPosition(trackPoint, xyDirection);

            if (HasWaterTile(nextPos, waterFlag))
            {
                if (!RiseAngleCoast(nextPos, waterFlag))
                {
                    waterTilemap.SetTile(nextPos, GetCoastTileByDirection(xyDirection));
                }
            }
        }
    }