static void DeleteBlockNotify(Player player, CSVector3Int position) { CSDeleteBlockNotify notify = new CSDeleteBlockNotify { position = position }; NetworkManager.Enqueue(player.socket, ENUM_CMD.CS_DELETE_BLOCK_NOTIFY, notify); }
public static Vector2Int GetChunk(CSVector3Int position) { int chunkX = (int)Math.Floor((float)position.x / 16); int chunkZ = (int)Math.Floor((float)position.z / 16); Vector2Int ret = new Vector2Int { x = chunkX, y = chunkZ }; return(ret); }
public static bool RemoveBlockInChunk(Vector2Int chunk, CSVector3Int blockPosition) { List <CSBlock> chunkBlocks = GetChunkBlocks(chunk); bool deleted = false; //若存在则删除 foreach (CSBlock block in chunkBlocks) { if (block.position.x == blockPosition.x && block.position.y == blockPosition.y && block.position.z == blockPosition.z) { deleted = true; chunkBlocks.Remove(block); Redis.SetChunkData(chunk, chunkBlocks); break; } } return(deleted); }
public static Vector3Int ToVector3Int(this CSVector3Int csv) { return(new Vector3Int(csv.x, csv.y, csv.z)); }
public static Vector3Int ParseFromCSVector3Int(CSVector3Int v) { return(new Vector3Int { x = v.x, y = v.y, z = v.z }); }