Exemplo n.º 1
0
    public void SpawnPlayer()
    {
        int playerID       = PhotonNetwork.LocalPlayer.ActorNumber - 1;
        var playerStart    = PlayerStarts[playerID];
        var playerInstance = PhotonNetwork.Instantiate("Prefabs/VRCharacter", playerStart.transform.position, playerStart.transform.rotation, 0);

        LocalHunterPlayer          = playerInstance.GetComponent <HunterPlayer>();
        LocalHunterPlayer.PlayerID = playerID;
        LocalHunterPlayer.OnSpawn(playerID, ExperimentManager.Instance.GetAvatarID(), (int)ExperimentManager.Instance.settings.Gender);
    }
        public override void HandlePacket(BinaryReader reader, int whoAmI)
        {
            ModMessageType msgType = (ModMessageType)reader.ReadByte();

            switch (msgType)
            {
            //divide sync player for each subclass if poor performance
            case ModMessageType.SyncPlayer:
                // SyncPlayer will be called automatically, so there is no need to forward this data to other clients.
                byte playernumber = reader.ReadByte();

                AssassinPlayer ap = Main.player[playernumber].GetModPlayer <AssassinPlayer>();

                HunterPlayer hp = Main.player[playernumber].GetModPlayer <HunterPlayer>();

                SpellbladePlayer sp = Main.player[playernumber].GetModPlayer <SpellbladePlayer>();
                sp.arcaneCurse = reader.ReadBoolean();

                TechnomancerPlayer tp = Main.player[playernumber].GetModPlayer <TechnomancerPlayer>();
                tp.spawnStacks = reader.ReadInt32();

                break;

            case ModMessageType.TechnomancerForceSync:
                playernumber   = reader.ReadByte();
                tp             = Main.player[playernumber].GetModPlayer <TechnomancerPlayer>();
                tp.spawnStacks = reader.ReadByte();
                if (Main.netMode == NetmodeID.Server)
                {
                    var packet = GetPacket();
                    packet.Write((byte)ModMessageType.TechnomancerForceSync);
                    packet.Write(playernumber);
                    packet.Write(tp.spawnStacks);
                    packet.Send(-1, playernumber);
                }
                break;

            default:
                Logger.WarnFormat("Spellblade Revised: Unknown Message type: {0}", msgType);
                break;
            }
        }
Exemplo n.º 3
0
 private void Awake()
 {
     player = GetComponent <HunterPlayer>();
 }
 void InitWidget(HunterPlayer player)
 {
 }