public static void PlayerCastingFlamePillarCommandReceived(int fromClient, Packet packet)
        {
            int             direction       = packet.ReadInt();
            Vector3Int      cellPredicted   = packet.ReadVector3Int();
            int             sequenceNumber  = packet.ReadInt();
            CastFlamePillar castFlamePillar = new CastFlamePillar(sequenceNumber, direction, cellPredicted);

            Server.clients[fromClient].serverMasterController.AccumulateCastingFlamePillarRequestToBePlayedOnServerFromClient(castFlamePillar);
        }
Beispiel #2
0
        public static void CastFlamePillar(CastFlamePillar castFlamePillar)
        {
            using (Packet packet = new Packet((int)ClientPackets.castingFlamePillarCommand))
            {
                packet.Write(castFlamePillar.direction);
                packet.Write(castFlamePillar.predictedCell);
                packet.Write(castFlamePillar.sequenceNoCastingFlamePillarCommand);

                SendTCPData(packet);
            }
        }
Beispiel #3
0
        public override void ProcessEventsInputs(bool[] inputs, bool[] previousInputs)
        {
            if (!isInFlyingState)
            {
                if (inputs[(int)EnumData.AvernaInputs.ShootFireBall])
                {
                    if (IsHeroAbleToFireProjectiles())
                    {
                        if (!waitingActionForPrimaryMove.Perform())
                        {
                            isFiringPrimaryProjectile = true;
                            waitingActionForPrimaryMove.ReInitialiseTimerToBegin(primaryMoveAttackRateTickRate);
                        }
                        else
                        {
                            isFiringPrimaryProjectile = false;
                        }
                    }
                }
                else if (!inputs[(int)EnumData.AvernaInputs.ShootFireBall] && previousInputs[(int)EnumData.AvernaInputs.ShootFireBall] != inputs[(int)EnumData.AvernaInputs.ShootFireBall])
                {
                    isFiringPrimaryProjectile = false;
                    waitingActionForPrimaryMove.ReInitialiseTimerToEnd(primaryMoveAttackRateTickRate);
                }
                else if (itemToCast != null && itemToCast.castableItemType == EnumData.CastItemTypes.ClientProjectiles)
                {
                    if (itemToCast.itemCount > 0 && inputs[(int)EnumData.AvernaInputs.UseItem])
                    {
                        SpawnClientProjectiles();
                    }
                    else if (itemToCast.itemCount <= 0 || (!inputs[(int)EnumData.AvernaInputs.UseItem] && previousInputs[(int)EnumData.AvernaInputs.UseItem] != inputs[(int)EnumData.AvernaInputs.UseItem]))
                    {
                        ResetClientProjectilesVars();
                    }
                }
            }


            if (!MultiplayerManager.instance.isServer && hasAuthority())
            {
                if (completedMotionToMovePoint)
                {
                    if (isInFlyingState)
                    {
                        if (inputs[(int)EnumData.AvernaInputs.LandPlayer] && previousInputs[(int)EnumData.AvernaInputs.LandPlayer] != inputs[(int)EnumData.AvernaInputs.LandPlayer])
                        {
                            if (isInFlyingState)
                            {
                                //land here
                                flyingTickCountTemp = 0;

                                LandPlayerCommand landPlayerCommand = new LandPlayerCommand(GetLocalSequenceNo());
                                ClientSend.LandPlayer(landPlayerCommand);
                            }
                        }
                    }
                    else
                    {
                        if (inputs[(int)EnumData.AvernaInputs.RespawnPlayer] && previousInputs[(int)EnumData.AvernaInputs.RespawnPlayer] != inputs[(int)EnumData.AvernaInputs.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 (itemToCast != null && itemToCast.itemCount > 0 && itemToCast.castableItemType == EnumData.CastItemTypes.SpawnnableItems)
                        {
                            if (inputs[(int)EnumData.AvernaInputs.UseItem] && previousInputs[(int)EnumData.AvernaInputs.UseItem] != inputs[(int)EnumData.AvernaInputs.UseItem])
                            {
                                SpawnItem();
                            }
                        }
                    }
                }
                bubbleShieldAttackReady = !waitingActionForBubbleShieldItemMove.Perform();

                if (!isInFlyingState)
                {
                    if (inputs[(int)EnumData.AvernaInputs.CastFlamePillar] && previousInputs[(int)EnumData.AvernaInputs.CastFlamePillar] != inputs[(int)EnumData.AvernaInputs.CastFlamePillar])
                    {
                        if (IsHeroAbleToFireProjectiles())
                        {
                            CastFlamePillar castFlamePillar = new CastFlamePillar(GetLocalSequenceNo(), (int)Facing, GridManager.instance.grid.WorldToCell(actorTransform.position));
                            ClientSend.CastFlamePillar(castFlamePillar);
                            isFiringServerProjectiles = true;
                            onCompletedMotionToPoint  = () => { isFiringServerProjectiles = false; onCompletedMotionToPoint = null; };
                        }
                    }
                    else if (itemToCast != null && itemToCast.itemCount > 0 && itemToCast.castableItemType == EnumData.CastItemTypes.ServerProjectiles)
                    {
                        if (inputs[(int)EnumData.AvernaInputs.UseItem] && previousInputs[(int)EnumData.AvernaInputs.UseItem] != inputs[(int)EnumData.AvernaInputs.UseItem])
                        {
                            SpawnServerProjectiles();
                        }
                    }
                }
            }
        }