private void PaintTileIfNeeded() { TacticsTerrainMesh terrain = (TacticsTerrainMesh)target; foreach (TerrainQuad quad in selectedQuads) { if (quad.normal.y > 0.0f) { int originX = (int)primarySelection.pos.x - Mathf.FloorToInt(Mathf.RoundToInt(selectionSize.x) / 2.0f); int originY = (int)primarySelection.pos.z - Mathf.FloorToInt(Mathf.RoundToInt(selectionSize.y) / 2.0f); Tile tile = TileForSelection((int)(quad.pos.x - originX), (int)(quad.pos.z - originY)); UpdateTile(quad, tile); } else { Tile tile; if (quad.normal.x != 0.0f) { int originX = (int)primarySelection.pos.z - Mathf.FloorToInt(Mathf.RoundToInt(selectionSize.x) / 2.0f); int originY = (int)primarySelection.pos.y - Mathf.FloorToInt(Mathf.RoundToInt(selectionSize.y) / 2.0f); tile = TileForSelection((int)(quad.pos.z - originX), (int)(quad.pos.y - originY)); } else { int originX = (int)primarySelection.pos.x - Mathf.FloorToInt(Mathf.RoundToInt(selectionSize.x) / 2.0f); int originY = (int)primarySelection.pos.y - Mathf.FloorToInt(Mathf.RoundToInt(selectionSize.y) / 2.0f); tile = TileForSelection((int)(quad.pos.x - originX), (int)(quad.pos.y - originY)); } if (wraparoundPaintMode) { foreach (OrthoDir dir in Enum.GetValues(typeof(OrthoDir))) { UpdateTile(quad, dir, tile); } } else { UpdateTile(quad, OrthoDirExtensions.DirectionOf3D(quad.normal), tile); } } } RepaintMesh(); primarySelection = GetSelectedQuad(); CaptureSelection(primarySelection); PrefabStage prefabStage = PrefabStageUtility.GetPrefabStage(terrain.gameObject); if (prefabStage != null) { EditorSceneManager.MarkSceneDirty(prefabStage.scene); } }
public OrthoDir DirTo(CellInfo cell) { return(OrthoDirExtensions.DirectionOf3D(new Vector2Int(cell.x - x, cell.y - y))); }
public OrthoDir OrthoDirTo(MapEvent other) { return(OrthoDirExtensions.DirectionOf3D(location - other.location)); }
public override OrthoDir DirectionTo(Vector2Int position) { return(OrthoDirExtensions.DirectionOf3D(position - this.position)); }