public void UpdatePlayerStat(Player player, string skill, int level, decimal exp)
        {
            var playerConnection = connectionProvider.GetPlayerConnection(player);

            if (playerConnection != null)
            {
                playerConnection.Send(PlayerStatUpdate.Create(player, skill, level, exp), SendOption.Reliable);
            }
        }
示例#2
0
        // GAMEPLAY EVENTS

        public override void OnEvent(PlayerHit evnt)
        {
            if (BoltNetwork.IsServer)
            {
                if (evnt.VictimID != evnt.KillerID)
                {
                    AllPlayersStats[evnt.KillerID].KillCount += 1;
                    PlayerStatUpdate playerKillCountUpdate = PlayerStatUpdate.Create();
                    playerKillCountUpdate.StatName  = Constants.PlayerStats.KillCountName;
                    playerKillCountUpdate.PlayerID  = evnt.KillerID;
                    playerKillCountUpdate.StatValue = AllPlayersStats[evnt.KillerID].KillCount;
                    playerKillCountUpdate.Send();
                }

                AllPlayersStats[evnt.VictimID].DeathCount += 1;
                PlayerStatUpdate playerDeathCountUpdate = PlayerStatUpdate.Create();
                playerDeathCountUpdate.StatName  = Constants.PlayerStats.DeathCountName;
                playerDeathCountUpdate.PlayerID  = evnt.VictimID;
                playerDeathCountUpdate.StatValue = AllPlayersStats[evnt.VictimID].DeathCount;
                playerDeathCountUpdate.Send();
            }
        }