public void SpawnServerProjectiles() { if (itemToCast.usableItemType == EnumData.UsableItemTypes.TidalWave) { SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, GridManager.instance.grid.WorldToCell(actorTransform.position)); ClientSend.SpawnItemCommand(spawnItemCommand); isFiringServerProjectiles = true; onCompletedMotionToPoint = () => { isFiringServerProjectiles = false; onCompletedMotionToPoint = null; }; } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.BubbleShield) { if (bubbleShieldAttackReady) { waitingActionForBubbleShieldItemMove.ReInitialiseTimerToBegin(GameConfig.bubbleShieldItemMoveAttackRateTickRate); SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, GridManager.instance.grid.WorldToCell(actorTransform.position)); ClientSend.SpawnItemCommand(spawnItemCommand); isFiringServerProjectiles = true; onCompletedMotionToPoint = () => { isFiringServerProjectiles = false; onCompletedMotionToPoint = null; }; } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.MightyWind) { if (IsHeroAbleToFireProjectiles()) { SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, GridManager.instance.grid.WorldToCell(actorTransform.position)); ClientSend.SpawnItemCommand(spawnItemCommand); isFiringServerProjectiles = true; onCompletedMotionToPoint = () => { isFiringServerProjectiles = false; onCompletedMotionToPoint = null; }; } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.FlamePillar) { if (IsHeroAbleToFireProjectiles()) { SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, GridManager.instance.grid.WorldToCell(actorTransform.position)); ClientSend.SpawnItemCommand(spawnItemCommand); isFiringServerProjectiles = true; onCompletedMotionToPoint = () => { isFiringServerProjectiles = false; onCompletedMotionToPoint = null; }; } } }
public void SpawnItem() { if (itemToCast.usableItemType == EnumData.UsableItemTypes.Minion) { Vector3Int cellToCheckFor = GridManager.instance.grid.WorldToCell(actorTransform.position + GridManager.instance.GetFacingDirectionOffsetVector3(Facing)); if (!GridManager.instance.IsCellBlockedForSpawnObjectPlacementAtPos(cellToCheckFor) && !GridManager.instance.HasTileAtCellPoint(cellToCheckFor, EnumData.GameObjectEnums.BoulderAppearing, EnumData.GameObjectEnums.BoulderDisappearing)) { //send command to server of placement SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, cellToCheckFor); ClientSend.SpawnItemCommand(spawnItemCommand); } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.PermamnentBlock) { Vector3Int cellToCheckFor = GridManager.instance.grid.WorldToCell(actorTransform.position + GridManager.instance.GetFacingDirectionOffsetVector3(Facing)); if (!GridManager.instance.IsCellBlockedForSpawnObjectPlacementAtPos(cellToCheckFor) && !GridManager.instance.HasTileAtCellPoint(cellToCheckFor, EnumData.GameObjectEnums.BoulderAppearing, EnumData.GameObjectEnums.BoulderDisappearing)) { //send command to server of placement SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, cellToCheckFor); ClientSend.SpawnItemCommand(spawnItemCommand); } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.CereberausHead) { Vector3Int cellToCheckFor = GridManager.instance.grid.WorldToCell(actorTransform.position + GridManager.instance.GetFacingDirectionOffsetVector3(Facing)); if (!GridManager.instance.IsCellBlockedForSpawnObjectPlacementAtPos(cellToCheckFor) && !GridManager.instance.HasTileAtCellPoint(cellToCheckFor, EnumData.GameObjectEnums.BoulderAppearing, EnumData.GameObjectEnums.BoulderDisappearing)) { //send command to server of placement SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, cellToCheckFor); ClientSend.SpawnItemCommand(spawnItemCommand); } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.Boulder) { Vector3Int cellToCheckFor = GridManager.instance.grid.WorldToCell(actorTransform.position + GridManager.instance.GetFacingDirectionOffsetVector3(Facing)); if (!GridManager.instance.IsCellBlockedForSpawnObjectPlacementAtPos(cellToCheckFor) && !GridManager.instance.HasTileAtCellPoint(cellToCheckFor, EnumData.TileType.NoBoulder) && !GridManager.instance.HasTileAtCellPoint(cellToCheckFor, EnumData.GameObjectEnums.BoulderAppearing)) { //send command to server of placement SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, cellToCheckFor); ClientSend.SpawnItemCommand(spawnItemCommand); } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.ArrowDirectional) { Vector3Int cellToCheckFor = GridManager.instance.grid.WorldToCell(actorTransform.position + GridManager.instance.GetFacingDirectionOffsetVector3(Facing)); if (!GridManager.instance.IsCellBlockedForSpawnObjectPlacementAtPos(cellToCheckFor) && !GridManager.instance.HasTileAtCellPoint(cellToCheckFor, EnumData.GameObjectEnums.BoulderAppearing)) { //send command to server of placement SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, cellToCheckFor); ClientSend.SpawnItemCommand(spawnItemCommand); } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.MirrorItem) { Vector3Int cellToCheckFor = GridManager.instance.grid.WorldToCell(actorTransform.position + GridManager.instance.GetFacingDirectionOffsetVector3(Facing)); if (!GridManager.instance.IsCellBlockedForSpawnObjectPlacementAtPos(cellToCheckFor) && !GridManager.instance.HasTileAtCellPoint(cellToCheckFor, EnumData.GameObjectEnums.BoulderAppearing)) { //send command to server of placement SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, cellToCheckFor); ClientSend.SpawnItemCommand(spawnItemCommand); } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.GorgonGlass) { Vector3Int cellToCheckFor = GridManager.instance.grid.WorldToCell(actorTransform.position + GridManager.instance.GetFacingDirectionOffsetVector3(Facing)); if (!GridManager.instance.IsCellBlockedForSpawnObjectPlacementAtPos(cellToCheckFor) && !GridManager.instance.HasTileAtCellPoint(cellToCheckFor, EnumData.GameObjectEnums.BoulderAppearing)) { //send command to server of placement SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, cellToCheckFor); ClientSend.SpawnItemCommand(spawnItemCommand); } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.Pitfall) { Vector3Int cellToCheck = GridManager.instance.grid.WorldToCell(actorTransform.position + 2 * GridManager.instance.GetFacingDirectionOffsetVector3(Facing)); if (GridManager.instance.HasTileAtCellPoint(cellToCheck, EnumData.TileType.Normal)) { SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, Vector3Int.zero); ClientSend.SpawnItemCommand(spawnItemCommand); } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.Earthquake) { SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, Vector3Int.zero); ClientSend.SpawnItemCommand(spawnItemCommand); } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.Tornado) { Vector3Int cellToCheck = GridManager.instance.grid.WorldToCell(actorTransform.position + GridManager.instance.GetFacingDirectionOffsetVector3(Facing)); if (!GridManager.instance.IsCellBlockedForSpawnObjectPlacementAtPos(cellToCheck)) { SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, Vector3Int.zero); ClientSend.SpawnItemCommand(spawnItemCommand); } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.Portal) { Vector3Int cellToCheck = GridManager.instance.grid.WorldToCell(actorTransform.position + GridManager.instance.GetFacingDirectionOffsetVector3(Facing)); if (!GridManager.instance.IsCellBlockedForSpawnObjectPlacementAtPos(cellToCheck)) { SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, Vector3Int.zero); ClientSend.SpawnItemCommand(spawnItemCommand); } } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.AeloianMight) { SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, Vector3Int.zero); ClientSend.SpawnItemCommand(spawnItemCommand); } else if (itemToCast.usableItemType == EnumData.UsableItemTypes.QuickSand) { SpawnItemCommand spawnItemCommand = new SpawnItemCommand(GetLocalSequenceNo(), (int)Facing, (int)itemToCast.usableItemType, Vector3Int.zero); ClientSend.SpawnItemCommand(spawnItemCommand); } }