public static void PlayerCastingEarthQuakeCommandReceived(int fromClient, Packet packet)
        {
            int sequenceNumber = packet.ReadInt();
            CastEarthQuakeCommand castEarthQuakeCommand = new CastEarthQuakeCommand(sequenceNumber);

            Server.clients[fromClient].serverMasterController.AccumulateCastingEarthQuakeRequestToBePlayedOnServerFromClient(castEarthQuakeCommand);
        }
Пример #2
0
        public static void CastEarthQuake(CastEarthQuakeCommand castEarthQuakeCommand)
        {
            using (Packet packet = new Packet((int)ClientPackets.castingEarthQuakeCommand))
            {
                packet.Write(castEarthQuakeCommand.sequenceNoForCastingEarthQuakeCommand);

                SendTCPData(packet);
            }
        }
Пример #3
0
        public override void ProcessEventsInputs(bool[] inputs, bool[] previousInputs)
        {
            if (!isInFlyingState)
            {
                if (itemToCast != null && itemToCast.castableItemType == EnumData.CastItemTypes.ClientProjectiles)
                {
                    if (itemToCast.itemCount > 0 && inputs[(int)EnumData.ErmolaiInputs.UseItem])
                    {
                        SpawnClientProjectiles();
                    }
                    else if (itemToCast.itemCount <= 0 || (!inputs[(int)EnumData.ErmolaiInputs.UseItem] && previousInputs[(int)EnumData.ErmolaiInputs.UseItem] != inputs[(int)EnumData.ErmolaiInputs.UseItem]))
                    {
                        ResetClientProjectilesVars();
                    }
                }
            }
            if (!MultiplayerManager.instance.isServer && hasAuthority())
            {
                if (completedMotionToMovePoint)
                {
                    if (isInFlyingState)
                    {
                        if (inputs[(int)EnumData.ErmolaiInputs.LandPlayer] && previousInputs[(int)EnumData.ErmolaiInputs.LandPlayer] != inputs[(int)EnumData.ErmolaiInputs.LandPlayer])
                        {
                            if (isInFlyingState)
                            {
                                //land here
                                flyingTickCountTemp = 0;

                                LandPlayerCommand landPlayerCommand = new LandPlayerCommand(GetLocalSequenceNo());
                                ClientSend.LandPlayer(landPlayerCommand);
                            }
                        }
                    }
                    else
                    {
                        if (inputs[(int)EnumData.ErmolaiInputs.RespawnPlayer] && previousInputs[(int)EnumData.ErmolaiInputs.RespawnPlayer] != inputs[(int)EnumData.ErmolaiInputs.RespawnPlayer])
                        {
                            Vector3Int cellToCheckFor = GridManager.instance.grid.WorldToCell(actorTransform.position);
                            if (IsPlayerSpawnable(cellToCheckFor))
                            {
                                //Respawn player command
                                RespawnPlayerCommand respawnPlayerCommand = new RespawnPlayerCommand(GetLocalSequenceNo());
                                ClientSend.RespawnPlayer(respawnPlayerCommand);
                            }
                            else
                            {
                                Debug.LogError("Invalid location to spawn player");
                            }
                        }
                        else if (inputs[(int)EnumData.ErmolaiInputs.CastPitfall] && previousInputs[(int)EnumData.ErmolaiInputs.CastPitfall] != inputs[(int)EnumData.ErmolaiInputs.CastPitfall])
                        {
                            Vector3Int cellToCheck = GridManager.instance.grid.WorldToCell(actorTransform.position + 2 * GridManager.instance.GetFacingDirectionOffsetVector3(Facing));
                            if (GridManager.instance.HasTileAtCellPoint(cellToCheck, EnumData.TileType.Normal))
                            {
                                CastPitfallCommand castPitfallCommand = new CastPitfallCommand(GetLocalSequenceNo(), (int)Facing);
                                ClientSend.CastPitfall(castPitfallCommand);
                            }
                        }
                        else if (inputs[(int)EnumData.ErmolaiInputs.CastEarthquake] && previousInputs[(int)EnumData.ErmolaiInputs.CastEarthquake] != inputs[(int)EnumData.ErmolaiInputs.CastEarthquake])
                        {
                            CastEarthQuakeCommand castEarthQuakeCommand = new CastEarthQuakeCommand(GetLocalSequenceNo());
                            ClientSend.CastEarthQuake(castEarthQuakeCommand);
                        }
                        else if (itemToCast != null && itemToCast.itemCount > 0 && itemToCast.castableItemType == EnumData.CastItemTypes.SpawnnableItems)
                        {
                            if (inputs[(int)EnumData.ErmolaiInputs.UseItem] && previousInputs[(int)EnumData.ErmolaiInputs.UseItem] != inputs[(int)EnumData.ErmolaiInputs.UseItem])
                            {
                                SpawnItem();
                            }
                        }
                    }
                }
                bubbleShieldAttackReady = !waitingActionForBubbleShieldItemMove.Perform();

                if (!isInFlyingState)
                {
                    if (itemToCast != null && itemToCast.itemCount > 0 && itemToCast.castableItemType == EnumData.CastItemTypes.ServerProjectiles)
                    {
                        if (inputs[(int)EnumData.ErmolaiInputs.UseItem] && previousInputs[(int)EnumData.ErmolaiInputs.UseItem] != inputs[(int)EnumData.ErmolaiInputs.UseItem])
                        {
                            SpawnServerProjectiles();
                        }
                    }
                }
            }
        }