Пример #1
0
    public void TryCharge(WeaponType weaponType)
    {
        if (player.IsDead()) return;

            lock (weaponLock)
            {
                if (isCharging) return;

                isCharging = true;

                C2S.ChargeWeapon charge = new C2S.ChargeWeapon(player.GetOwner(), weaponType);

                if (Network.isServer)
                {
                    ServerCharge(charge.SerializeToBytes(), new NetworkMessageInfo());
                }
                else
                {
                    player.GetComponent<NetworkView>().RPC("ServerCharge", RPCMode.Server, charge.SerializeToBytes());
                }
            }
    }
Пример #2
0
    public void ServerCharge(byte[] pckData, NetworkMessageInfo info)
    {
        if (!Network.isServer) return;
            //if (!PlayerManager.Inst.IsValidPlayer(player.GetOwner(), info.sender)) return;

            C2S.ChargeWeapon charge = new C2S.ChargeWeapon();
            charge.DeserializeFromBytes(pckData);

            Charge(charge);
    }