public void updateFlag(float x, float y, float z, int connid) { int rx = ((int)x) % blockSize; int ry = ((int)y) % blockSize; int rz = ((int)z); RegionBlock rb = getRegion(x, y); if (rb != null) { if (rb.removeFlag(rx, ry, rz + 1, connid)) { rb.deleteBlock(rx, ry, rz + 1); PlayerFlagMessage m = new PlayerFlagMessage(); m.removed = true; NetworkServer.SendToClient(connid, LevelMsgType.PlayerFlagRequest, m); refreshMesh(); } else { PlayerFlagMessage m = new PlayerFlagMessage(); m.removed = false; NetworkServer.SendToClient(connid, LevelMsgType.PlayerFlagRequest, m); } } refreshMesh(); }
/// Update a change of resource in the level structure. public void updateResource(float x, float y, float z, int amount) { int rx = ((int)x) % blockSize; int ry = ((int)y) % blockSize; int rz = ((int)z); RegionBlock rb = getRegion(x, y); if (rb != null) { rb.updateBlockHealth(rx, ry, rz, amount); int blockHealth = rb.getBlockHealth(rx, ry, rz); //Debug.LogError ("Health of block: " + blockHealth.ToString ()); if (blockHealth < 1) { rb.deleteBlock(rx, ry, rz); refreshMesh(); } } refreshMesh(); }