public void SpawnBomb(BomberController controller, Vector3 pos) { if (!controller.IsOnGround || controller.BombSpawn >= controller.BombCount) { return; } int owner = controller.GetComponent <Guid>().GetGUID(); Maps maps = GameMgr.Instance.maps; IntVector2 tpos = maps.GetTilePosition(pos.x, pos.z); pos = maps.TilePosToWorldPos(tpos); pos.y = 0.5f; var hit = Physics.OverlapSphere(pos, 0.25f); foreach (var c in hit) { if (c.gameObject.tag == "Bomb") { return; } } controller.BombSpawn++; int guid = GameMgr.Instance.Spawn(GOType.GO_BOMB, pos); int radius = controller.BombRadius; GameObject go = ObjectMgr.Instance.Get(guid); go.GetComponent <BombScript>().StartScript(owner, () => { IntVector2 new_tpos = maps.GetTilePosition(go.transform.position.x, go.transform.position.z); maps.ExplodeAt(guid, new_tpos, radius); controller.BombSpawn--; if (new_tpos == null) { return; } SendPacketBroadCast(PacketBuilder.BuildBombExplode(guid, new_tpos, radius)); }, () => { GameMgr.Instance.Despawn(GOType.GO_BOMB, guid); }); }