Example #1
0
    protected override void OnUse()
    {
        Debug.Log($"Tesla clone");

        Vector2 spawnPos = owner.WeaponController.GetProjectileStart().position;

        cloneInstance = InstanceFactory.Instantiate(playerPrefab.gameObject, spawnPos).GetComponent <Player>();
        PlayerInitInfo info = owner.InitInfo.Clone();

        info.PlayerType        = EPlayerType.AI;
        cloneInstance.ai.IsTmp = true;
        cloneInstance.SetInfo(info, false);
        cloneInstance.Stats.OnRespawn();

        //stop ai brain for 1 sec
        cloneInstance.ai.StopBrain(1);
        //send clone in player's direction so they dont get each other in the way that much
        cloneInstance.ai.Movement.SetTarget(spawnPos + Utils.GetVector2(playerDirection) * 2);

        cloneInstance.SetActive(true);
        cloneInstance.ai.Owner = owner;

        //store reference and pass to Destroy function.
        //reason: another clone might have been instanced before this one is destroyed
        Player cloneRef = cloneInstance;

        //todo: ignore owner
        //cloneInstance.ai.;
        DoInTime(() => DestroyClone(cloneRef), CLONE_DURATION);
    }
Example #2
0
    public void SetInfo(PlayerInitInfo pPlayerInfo, bool pIsLocalImage, Vector2?pSpawnPosition = null)
    {
        //Debug.Log($"{this} SetInfo");

        //if already set as local image, keep it
        IsLocalImage = pIsLocalImage || IsLocalImage;
        //if(IsLocalImage)
        //{
        //	rigidBody2D.bodyType = RigidbodyType2D.Static;
        //	rigidBody2D.simulated = false;
        //}
        string suffix_LI    = IsLocalImage ? "_LI" : "";
        string suffix_type  = "_" + pPlayerInfo.PlayerType;
        string suffix_clone = ai.IsTmp ? "_clone" : "";

        gameObject.name = "Player_" + pPlayerInfo.Name + suffix_type + suffix_LI + suffix_clone;


        InitInfo = pPlayerInfo;
        Visual.Init(pPlayerInfo);

        Init();

        //if spawn pos is null, player is already spawned, but Movement should be still initialized
        Vector2 spawnPosition = pSpawnPosition != null ? (Vector2)pSpawnPosition : Position;

        Movement.SpawnAt(spawnPosition);

        ((PlayerPhotonController)Photon).Init2(pPlayerInfo);
    }
Example #3
0
    protected override void HandleMsg(EPhotonMsg pReceivedMsg, object[] pParams, ByteBuffer bb)
    {
        switch (pReceivedMsg)
        {
        case EPhotonMsg.MainMenu_SyncGameInfo:

            GameInitInfoS infoS    = GameInitInfoS.GetRootAsGameInitInfoS(bb);
            GameInitInfo  gameInfo = GameInitInfo.Deserialize(infoS);
            Debug.Log(gameInfo);

            //reset current game info - DONT assign it
            //it will be set from UI elements
            brainiacs.GameInitInfo = new GameInitInfo();
            mainMenu.GameSetup.OpenMain(gameInfo);
            break;

        case EPhotonMsg.MainMenu_SyncPlayerInfo:
            PlayerInitInfoS playerInfoS = PlayerInitInfoS.GetRootAsPlayerInitInfoS(bb);
            PlayerInitInfo  playerInfo  = PlayerInitInfo.Deserialize(playerInfoS);
            mainMenu.GameSetup.SetupMain.UpdatePlayer(playerInfo);
            break;

        case EPhotonMsg.None:
        default:
            Debug.LogError("Message not handled");

            break;
        }
    }
Example #4
0
    /// <summary>
    /// Init only for client
    /// </summary>
    public void Init(PlayerInitInfo pPlayer)
    {
        isClientInitializing = true;
        //if(IsItMe)
        //{
        //	Debug.Log("This is me, no need to reinit");
        //	return;
        //}

        //this Init need to be called before any other changes
        Init(pPlayer.Number, pPlayer.PlayerType, pPlayer.PhotonPlayer);
        IsItMe = Info.PlayerType == EPlayerType.RemotePlayer &&
                 pPlayer.PhotonPlayer == PhotonNetwork.LocalPlayer;
        SetReady(pPlayer.IsReady);         //client has to confirm that he is ready

        //if LocalPlayer (master) then at first is active for all clients, but disabled if it is not me
        keySetSwapper.gameObject.SetActive(IsItMe);

        if (Info.Color != pPlayer.Color)
        {
            Debug.LogError("Assigned color doesnt match");
        }
        AssignColor(pPlayer.Color);
        SetName(pPlayer.Name);
        heroSwapper.SetValue((int)pPlayer.Hero);

        if (IsItMe)
        {
            //Debug.Log("this is me");
            OnRemoteConnected(Info.PhotonPlayer);
        }
        heroSwapper.SetInteractable(IsItMe);
        btnRemove.gameObject.SetActive(false);
        isClientInitializing = false;
    }
Example #5
0
    public void debug_ReceiveGameinfo()
    {
        GameInitInfo info = new GameInitInfo();

        info.Mode = EGameMode.Deathmatch;

        PlayerInitInfo player = new PlayerInitInfo(
            1, EHero.Currie, "ADA", EPlayerColor.Blue, EPlayerType.LocalPlayer);

        player.PhotonPlayer = PhotonNetwork.LocalPlayer;
        info.AddPlayer(player);

        player = new PlayerInitInfo(
            1, EHero.Einstein, "ADA_bot", EPlayerColor.Red, EPlayerType.AI);
        player.PhotonPlayer = PhotonNetwork.LocalPlayer;
        info.AddPlayer(player);

        player = new PlayerInitInfo(
            1, EHero.DaVinci, "ADA_remote", EPlayerColor.Yellow, EPlayerType.RemotePlayer);
        player.PhotonPlayer = PhotonNetwork.LocalPlayer;
        info.AddPlayer(player);

        player = new PlayerInitInfo(
            1, EHero.Nobel, "ADA_remote2", EPlayerColor.Pink, EPlayerType.RemotePlayer);
        //player.PhotonPlayer = PhotonNetwork.LocalPlayer;
        player.IsReady = true;
        info.AddPlayer(player);

        var gameInfoBytes = info.Serialize();

        MainMenu.Instance.Photon.debug_HandleMsg(EPhotonMsg.MainMenu_SyncGameInfo, gameInfoBytes);
    }
Example #6
0
 internal void Update(PlayerInitInfo pNewInfo)
 {
     Number       = pNewInfo.Number;
     Hero         = pNewInfo.Hero;
     Name         = pNewInfo.Name;
     Color        = pNewInfo.Color;
     PlayerType   = pNewInfo.PlayerType;
     PhotonPlayer = pNewInfo.PhotonPlayer;
     IsReady      = pNewInfo.IsReady;
 }
Example #7
0
    public static PlayerInitInfo GetPlayerInitInfo(int pPlayerNumber)
    {
        PlayerInitInfo player = null;

        switch (pPlayerNumber)
        {
        case 1:
            player = new PlayerInitInfo(pPlayerNumber,
                                        TestHero, GetPlayerName(pPlayerNumber),
                                        EPlayerColor.Green, EPlayerType.LocalPlayer,
                                        EKeyset.KeysetA);
            break;

        case 2:
            player = new PlayerInitInfo(pPlayerNumber,
                                        EHero.Nobel, GetPlayerName(pPlayerNumber),
                                        EPlayerColor.Pink, EPlayerType.LocalPlayer);

            break;

        case 3:
            player = new PlayerInitInfo(pPlayerNumber,
                                        EHero.Tesla, GetPlayerName(pPlayerNumber),
                                        EPlayerColor.Yellow, EPlayerType.LocalPlayer);
            break;

        default:
            player = new PlayerInitInfo(pPlayerNumber,
                                        EHero.Einstein, GetPlayerName(pPlayerNumber),
                                        EPlayerColor.Blue, EPlayerType.LocalPlayer);
            break;
        }
        player.PhotonPlayer = PhotonNetwork.LocalPlayer;

        //player.debug_StartupWeapon.Add(EWeaponId.Special_Einstein);
        //player.debug_StartupWeapon.Add(EWeaponId.Special_Tesla);
        //player.debug_StartupWeapon.Add(EWeaponId.Special_Curie);
        //player.debug_StartupWeapon.Add(EWeaponId.Basic_Curie);
        //player.debug_StartupWeapon.Add(EWeaponId.Flamethrower);
        //player.debug_StartupWeapon.Add(EWeaponId.Special_Nobel);
        //player.debug_StartupWeapon.Add(EWeaponId.Special_Tesla);
        //player.debug_StartupWeapon.Add(EWeaponId.MP40);
        //player.debug_StartupWeapon.Add(EWeaponId.Lasergun);
        //player.debug_StartupWeapon.Add(EWeaponId.Biogun);
        //player.debug_StartupWeapon.Add(EWeaponId.Mine);
        //player.debug_StartupWeapon.Add(EWeaponId.Special_DaVinci);

        if (player.PlayerType == EPlayerType.AI && TestAiWeapon != EWeaponId.None)
        {
            player.debug_StartupWeapon.Add(TestAiWeapon);
        }

        return(player);
    }
Example #8
0
    public void Init(PlayerInitInfo pPlayerInfo)
    {
        //AIs dont use input
        //assign keys to my players
        if (pPlayerInfo.PlayerType == EPlayerType.AI || !pPlayerInfo.IsItMe())
        {
            //todo: send message to remote player
            return;
        }
        if (PlatformManager.GetPlatform() == EPlatform.PC)       // && !DebugData.TestMobileInput)
        {
            if (pPlayerInfo.Keyset == EKeyset.None)
            {
                Debug.LogError($"{player} has no keyset");
                switch (pPlayerInfo.Number)
                {
                case 1:
                    pPlayerInfo.Keyset = EKeyset.KeysetA;
                    break;

                case 2:
                    pPlayerInfo.Keyset = EKeyset.KeysetB;
                    break;

                case 3:
                    pPlayerInfo.Keyset = EKeyset.KeysetC;
                    break;

                case 4:
                    pPlayerInfo.Keyset = EKeyset.KeysetD;
                    break;

                default:
                    pPlayerInfo.Keyset = EKeyset.KeysetA;
                    break;
                }
            }

            keys = brainiacs.PlayerKeysManager.GetPlayerKeys(pPlayerInfo.Keyset);
        }

        if (PlatformManager.IsMobile())
        {
            MobileInput mobileInput = game.MobileInput;
            mobileInput.btnShoot.OnPressedAction    = () => weapon.UseWeapon();
            mobileInput.btnShoot.OnPointerUpAction  = () => weapon.StopUseWeapon();
            mobileInput.btnSwap.OnPointerDownAction = () => weapon.SwapWeapon();

            mobileInput.moveJoystick.OnUpdateDirection += HandleMoveJoystick;
        }
        isInited = true;
    }
Example #9
0
    public void AddPlayer(PlayerInitInfo pInfo)
    {
        PlayerInitInfo existingPlayer = GetPlayer(pInfo.Number);

        if (existingPlayer != null)
        {
            existingPlayer.Update(pInfo);
        }
        else
        {
            Players.Add(pInfo);
        }
    }
Example #10
0
 /// <summary>
 /// Called only on clients and local image
 /// </summary>
 public void OnReceivedInitInfo(PlayerInitInfo pInfo, bool pIsLocalImage)
 {
     //Debug.Log($"{this} OnReceivedInitInfo");
     SetInfo(pInfo, pIsLocalImage);
     if (!pIsLocalImage)
     {
         game.PlayerManager.AddPlayer(this);
     }
     //Init();
     IsInited = true;
     OnPlayerInited.Invoke();
     //Debug.Log("X_Inited_OnReceivedInitInfo");
 }
Example #11
0
    public static void TestSetGameInitInfo()
    {
        for (int i = 1; i <= playerCount; i++)
        {
            PlayerInitInfo player = GetPlayerInitInfo(i);
            Brainiacs.Instance.GameInitInfo.AddPlayer(player);
        }

        //PlayerInitInfo player3 = DebugData.GetPlayerInitInfo(3);
        //GameInitInfo.AddPlayer(player3);

        Brainiacs.Instance.GameInitInfo.Mode          = EGameMode.Score;
        Brainiacs.Instance.GameInitInfo.Map           = TestMap == EMap.None ? EMap.Steampunk : TestMap;
        Brainiacs.Instance.GameInitInfo.GameModeValue = TestGameValue;
    }
Example #12
0
    internal static GameInitInfo Deserialize(GameInitInfoS pGameInfoS)
    {
        GameInitInfo gameInfo = new GameInitInfo();

        gameInfo.Mode          = (EGameMode)pGameInfoS.Mode;
        gameInfo.Map           = (EMap)pGameInfoS.Map;
        gameInfo.GameModeValue = pGameInfoS.GameModeValue;
        for (int i = 0; i < pGameInfoS.PlayersLength; i++)
        {
            PlayerInitInfoS?playerS = pGameInfoS.Players(i);
            if (playerS != null)
            {
                gameInfo.AddPlayer(PlayerInitInfo.Deserialize((PlayerInitInfoS)playerS));
            }
        }
        return(gameInfo);
    }
Example #13
0
    internal void SetGameInfo(GameInitInfo pGameInfo)
    {
        for (int i = 0; i < pGameInfo.Players.Count; i++)
        {
            PlayerInitInfo player = pGameInfo.Players[i];
            AddPlayer(player);
        }
        EGameMode mode = pGameInfo.Mode;

        gameModeToggleTime.isOn       = mode == EGameMode.Time;
        gameModeToggleScore.isOn      = mode == EGameMode.Score;
        gameModeToggleDeathmatch.isOn = mode == EGameMode.Deathmatch;

        mapSwapper.SetValue((int)pGameInfo.Map);

        gameModeValueSwapper.SetNumberValue(pGameInfo.GameModeValue);
    }
Example #14
0
    internal static PlayerInitInfo Deserialize(PlayerInitInfoS pPlayerS)
    {
        PlayerInitInfo playerInfo = new PlayerInitInfo();

        playerInfo.Number     = pPlayerS.Number;
        playerInfo.Hero       = (EHero)pPlayerS.Hero;
        playerInfo.Name       = pPlayerS.Name;
        playerInfo.Color      = (EPlayerColor)pPlayerS.Color;
        playerInfo.PlayerType = (EPlayerType)pPlayerS.PlayerType;
        playerInfo.IsReady    = pPlayerS.IsReady;

        if (PhotonNetwork.IsConnected && PhotonNetwork.CurrentRoom != null)
        {
            playerInfo.PhotonPlayer = PhotonNetwork.CurrentRoom.GetPlayer(pPlayerS.PhotonPlayerNumber);
        }

        return(playerInfo);
    }
Example #15
0
    /// <summary>
    /// Only master spawn players
    /// </summary>
    private Player SpawnPlayer(PlayerInitInfo pPlayerInfo, bool pIsLocalImage)
    {
        //Vector2 spawnPosition = game.MapController.ActiveMap.GetSpawnPoint().position;
        Vector2 spawnPosition = game.Map.ActiveMap.
                                GetSpawnPoint(pPlayerInfo.Number).position;

        if (pIsLocalImage)
        {
            spawnPosition += Vector2.down;
        }

        GameObject instance = InstanceFactory.Instantiate(playerPrefab.gameObject, spawnPosition);

        Player playerInstance = instance.GetComponent <Player>();

        bool debug_spwan = false;

        if (debug_spwan)
        {
            if (pPlayerInfo.Name == DebugData.GetPlayerName(1))
            {
                spawnPosition = new Vector2(-3.3f, 3);
            }
            //spawnPosition = Vector2.down;

            if (pPlayerInfo.Name == DebugData.GetPlayerName(2))
            {
                spawnPosition = new Vector2(-1.8f, 2.3f);
            }
            //spawnPosition = Vector2.zero;

            if (pPlayerInfo.Name == DebugData.GetPlayerName(3))
            {
                spawnPosition = Vector2.down;
            }
        }

        //OnAllPlayersAdded += () => playerInstance.SetInfo(pPlayerInfo, spawnPosition);
        playerInstance.SetInfo(pPlayerInfo, pIsLocalImage, spawnPosition);

        //AddPlayer(playerInstance);

        return(playerInstance);
    }
Example #16
0
    public void Init(PlayerInitInfo pPlayerInfo)
    {
        heroConfig = brainiacs.HeroManager.GetHeroConfig(pPlayerInfo.Hero);

        if (heroConfig.Animator)
        {
            animator.runtimeAnimatorController = heroConfig.Animator;
        }
        else
        {
            Debug.LogError($"{heroConfig.Hero} doesnt have animator configured");
        }

        playerColor = pPlayerInfo.Color;
        int paletteIndex = GetColorPaletteIndex(pPlayerInfo.Color);

        paletteSwap.SetPalette(paletteIndex);
        SetLightColor(playerColor);
    }
Example #17
0
    /// <summary>
    /// Called just once
    /// </summary>
    private void PreInit()
    {
        if (preInited)
        {
            return;
        }

        preInited = true;
        btnRemove.onClick.AddListener(OnBtnRemove);

        Info = new PlayerInitInfo();

        //List<string> playerTypes = Utils.GetStrings(typeof(EPlayerType));
        //playerTypeSwapper.Init(playerTypes, OnPlayerTypeChanged, 0);
        List <string> heroes = Utils.GetStrings(typeof(EHero));

        heroSwapper.Init(heroes, OnHeroChanged, 0);

        List <string> keySets = Utils.GetStrings(typeof(EKeyset));

        keySetSwapper.Init(keySets, OnKeySetChanged, 0);
    }
Example #18
0
    internal void Init2(PlayerInitInfo pInfo)
    {
        if (isInited)
        {
            return;
        }
        playerInfo   = pInfo;
        PhotonPlayer = playerInfo.PhotonPlayer;

        //Debug.Log($"{this} IsMine: {IsMine}, isItMe: {isItMe}");

        if (PhotonNetwork.IsMasterClient && !player.IsItMe && PhotonPlayer != null)
        {
            view.TransferOwnership(PhotonPlayer);
            Debug.Log("Transfer ownership to " + PhotonPlayer.NickName);
        }

        //Debug.Log(this + " send init Info");
        //DoInTime(() => Send(
        //	EPhotonMsg.Player_InitPlayer, pPlayerInfo.Number), 1);
        Send(EPhotonMsg.Player_InitPlayer, playerInfo.Number);

        isInited = true;
    }
Example #19
0
    //remote
    private void AddPlayer(PlayerInitInfo pPlayer)
    {
        UIGameSetupPlayerEl addedElement = AddPlayerElement();

        addedElement.Init(pPlayer);
    }
Example #20
0
 public OtherPlayer(PlayerInitInfo initInfo) : base(initInfo)
 {
 }
Example #21
0
 public void UpdateInfo(PlayerInitInfo pPlayerInfo)
 {
     Info = pPlayerInfo;
     Init(pPlayerInfo);
 }
Example #22
0
        public long AddPlayer(PlayerInitInfo playerInitInfo)
        {
            if (!Team.teamExists(playerInitInfo.teamID) ||
                !MapInfo.ValidBirthPointIdx(playerInitInfo.birthPointIdx) ||
                gameMap.BirthPointList[playerInitInfo.birthPointIdx].Parent != null)
            {
                return(GameObject.invalidID);
            }

            XYPosition pos       = gameMap.BirthPointList[playerInitInfo.birthPointIdx].Position;
            Character  newPlayer = new Character(pos, Map.Constant.playerRadius, playerInitInfo.jobType, Map.Constant.basicPlayerMoveSpeed);

            gameMap.BirthPointList[playerInitInfo.birthPointIdx].Parent = newPlayer;
            gameMap.PlayerListLock.EnterWriteLock(); try { gameMap.PlayerList.Add(newPlayer); } finally { gameMap.PlayerListLock.ExitWriteLock(); }
            ((Team)teamList[(int)playerInitInfo.teamID]).AddPlayer(newPlayer);
            newPlayer.TeamID = playerInitInfo.teamID;

            //设置出生点的颜色

            int cellX = Map.Constant.GridToCellX(pos), cellY = Map.Constant.GridToCellY(pos);

            gameMap.SetCellColor(cellX, cellY, Map.TeamToColor(playerInitInfo.teamID));

            //开启装弹线程

            new Thread
            (
                () =>
            {
                while (!gameMap.Timer.IsGaming)
                {
                    Thread.Sleep(newPlayer.CD);
                }
                while (gameMap.Timer.IsGaming)
                {
                    var beginTime = Environment.TickCount64;

                    var cellX = Map.Constant.GridToCellX(newPlayer.Position);
                    var cellY = Map.Constant.GridToCellY(newPlayer.Position);
                    if (gameMap.GetCellColor(cellX, cellY) == Map.TeamToColor(newPlayer.TeamID))
                    {
                        newPlayer.AddBulletNum();
                    }

                    var endTime   = Environment.TickCount64;
                    var deltaTime = endTime - beginTime;
                    if (deltaTime < newPlayer.CD)
                    {
                        Thread.Sleep(newPlayer.CD - (int)deltaTime);
                    }
                    else
                    {
                        Console.WriteLine("The computer runs so slow that the player cannot finish adding bullet during this time!!!!!!");
                    }
                }
            }
            )
            {
                IsBackground = true
            }.Start();
            return(newPlayer.ID);
        }
Example #23
0
 public PlayerBase(PlayerInitInfo initInfo)
 {
     this.Id             = initInfo.Id;
     this.Name           = initInfo.Name;
     this.AttrTemplateId = initInfo.AttrTemplateId;
 }
Example #24
0
 public HostPlayer(PlayerInitInfo initInfo) : base(initInfo)
 {
 }
Example #25
0
 internal void UpdatePlayer(PlayerInitInfo pPlayerInfo)
 {
     GetPlayerEl(pPlayerInfo.Number).UpdateInfo(pPlayerInfo);
 }
Example #26
0
    protected override void HandleMsg2(EPhotonMsg pReceivedMsg, object[] pParams, ByteBuffer bb)
    {
        if (!isInited && pReceivedMsg != EPhotonMsg.Player_InitPlayer)
        {
            Debug.Log(gameObject.name + " not inited yet. " + pReceivedMsg);
            player.OnPlayerInited.AddAction(() => HandleMsg2(pReceivedMsg, pParams, bb));
            return;
        }

        switch (pReceivedMsg)
        {
        case EPhotonMsg.Player_ChangeDirection:
            EDirection dir = (EDirection)pParams[0];
            player.Visual.OnDirectionChange(dir);
            return;

        case EPhotonMsg.Player_InitPlayer:
            int            playerNumber = (int)pParams[0];
            PlayerInitInfo info         = brainiacs.GameInitInfo.GetPlayer(playerNumber);
            player.OnReceivedInitInfo(info, false);
            return;

        case EPhotonMsg.Player_ShowWeapon:
            EWeaponId weapon = (EWeaponId)pParams[0];
            player.Visual.ShowWeapon(weapon);
            return;

        case EPhotonMsg.Player_ApplyDamage:
            int damage = (int)pParams[0];
            playerNumber = (int)pParams[1];
            Player originOfDamage = game.PlayerManager.GetPlayer(playerNumber);
            player.Health.ApplyDamage(damage, originOfDamage);
            return;

        case EPhotonMsg.Player_Push:
            Vector2 push = (Vector2)pParams[0];
            player.Push.Push(push);
            return;

        case EPhotonMsg.Player_AddKill:
            //EPlayerStats stat = (EPlayerStats)pParams[0];
            //int value = (int)pParams[1];
            //bool force = (bool)pParams[2];
            bool force = (bool)pParams[0];
            player.Stats.AddKill(force);
            return;

        case EPhotonMsg.Player_SetSyncPosition:
            Vector2 pos = (Vector2)pParams[0];
            dir = (EDirection)pParams[1];
            bool  isActuallyMoving = (bool)pParams[2];
            float speed            = (float)pParams[3];
            bool  instantly        = (bool)pParams[4];
            player.Movement.SetSyncPosition(pos, dir, isActuallyMoving, speed, instantly);
            return;

        case EPhotonMsg.Player_UI_PlayerInfo_SetHealth:
            int health = (int)pParams[0];
            player.Visual.PlayerInfo.SetHealth(health);
            return;

        case EPhotonMsg.Player_UI_PlayerInfo_SetReloading:
            bool  isReloading = (bool)pParams[0];
            float reloadTime  = (float)pParams[1];
            player.Visual.PlayerInfo.SetReloading(isReloading, reloadTime);
            return;

        case EPhotonMsg.Player_UI_PlayerInfo_SetAmmo:
            int  ammo       = (int)pParams[0];
            bool weaponUsed = (bool)pParams[1];
            player.Visual.PlayerInfo.SetAmmo(ammo, weaponUsed);
            return;

        case EPhotonMsg.Player_UI_PlayerInfo_SetActiveWeapon:
            weapon = (EWeaponId)pParams[0];
            float cadency = (float)pParams[1];
            player.Visual.PlayerInfo.SetActiveWeapon(weapon, cadency);
            return;


        case EPhotonMsg.Player_UI_Scoreboard_SetScore:
            int kills  = (int)pParams[0];
            int deaths = (int)pParams[1];
            player.Visual.Scoreboard.SetScore(kills, deaths);
            return;

        case EPhotonMsg.Player_UI_SetEffectActive:
            EPlayerEffect effect = (EPlayerEffect)pParams[0];
            bool          state  = (bool)pParams[1];
            player.Stats.StatsEffect.SetEffectActive(effect, state);
            return;

        case EPhotonMsg.Player_OnReceiveDamageEffect:
            player.Health.OnReceiveDamageEffect();
            break;

        case EPhotonMsg.Player_Visual_OnDie:
            player.Visual.OnDie();
            break;

        case EPhotonMsg.Player_DoEliminateEffect:
            player.Health.DoEliminateEffect();
            break;

        case EPhotonMsg.Player_PlayWeaponUseSound:
            EWeaponId id = (EWeaponId)pParams[0];
            player.WeaponController.PlayWeaponUseSound(id);
            return;

        case EPhotonMsg.Player_DoShieldHitEffect:
            player.Stats.DoShieldHitEffect();
            return;

        default:
            OnMsgUnhandled(pReceivedMsg);
            break;
        }
    }