示例#1
0
        public void Refresh()
        {
            if (!gameObject.activeInHierarchy)
            {
                needsToRefresh = true;
                return;
            }

            needsToRefresh = false;

            transform.SetParent(
                ServerController.GetObjectFromTeam <GameObject>(
                    player.GetTeam(), scoreboard.redTeamGroup, scoreboard.blueTeamGroup, scoreboard.noneTeamGroup
                    ).transform
                );

            transform.localScale = Vector3.one;

            back.color = PhotonNetwork.player == player ? ownerColor : defaultColor;

            usernameText.text = player.NickName;

            int wins   = ServerController.GetPoints(player);
            int kills  = ServerController.GetKills(player);
            int deaths = ServerController.GetDeaths(player);

            scoreText.text = string.Format("{0}/{1}/{2}", kills, deaths, wins);
        }
示例#2
0
文件: Player.cs 项目: Alan-Baylis/VOX
        public void RPCRespawn(int primaryWeaponID, int secondaryWeaponID, int meleeID, int item1ID, int item2ID)
        {
            if (photonView.isMine)
            {
                Destroy(cam.gameObject);
                Destroy(viewmodelRoot);

                PhotonNetwork.Destroy(gameObject);

                object[] data = new object[5];

                if (ServerController.gamemode == ServerController.Gamemode.GG)
                {
                    int     kills = ServerController.GetKills(PhotonNetwork.player);
                    GunInfo ggGun = ServerController.Instance.gunGameGuns[kills];

                    data[0] = ggGun.ID;
                    data[1] = -1;
                    data[2] = -1;
                    data[3] = -1;
                    data[4] = -1;
                }
                else
                {
                    data[0] = primaryWeaponID;
                    data[1] = secondaryWeaponID;
                    data[2] = meleeID;
                    data[3] = item1ID;
                    data[4] = item2ID;
                }

                Spawnpoint spawnpoint = MapController.FindSpawnpoint(PhotonNetwork.player.GetTeam());
                GameObject go         = PhotonNetwork.Instantiate("Player", spawnpoint.position, spawnpoint.rotation, 0, data);
            }
        }
示例#3
0
        public void OnInitializeGamemode()
        {
            PhotonPlayer player = PhotonNetwork.player;

            ServerController.Gamemode gamemode = ServerController.gamemode;

            if (gamemode == ServerController.Gamemode.FFA)
            {
                player.SetTeam(PunTeams.Team.none);
                Open();
            }
            else if (gamemode == ServerController.Gamemode.TDM)
            {
                Open(false, true);
            }
            else if (gamemode == ServerController.Gamemode.OITC)
            {
                player.SetTeam(PunTeams.Team.none);
                SpawnPlayer(-1, 1, 8, -1, -1);
            }
            else if (gamemode == ServerController.Gamemode.GG)
            {
                player.SetTeam(PunTeams.Team.none);

                int     kills = ServerController.GetKills(player);
                GunInfo ggGun = ServerController.Instance.gunGameGuns[kills];

                SpawnPlayer(ggGun.ID, -1, 8, -1, -1);
            }
            else if (gamemode == ServerController.Gamemode.CTF)
            {
                Open(false, true);
            }
        }
示例#4
0
文件: Player.cs 项目: Alan-Baylis/VOX
        public void OnKill(PhotonPlayer killer, GunInfo gun, PhotonPlayer dead, bool headshot)
        {
            bool isKiller = killer.ID == photonView.owner.ID;

            if (ServerController.gamemode == ServerController.Gamemode.OITC)
            {
                //OITC

                if (isKiller && photonView.isMine)
                {
                    ((Gun)items.secondary).ammo++;
                }
            }
            else if (ServerController.gamemode == ServerController.Gamemode.GG)
            {
                //GUNGAME

                GunInfo[] guns  = ServerController.Instance.gunGameGuns;
                int       kills = ServerController.GetKills(killer);

                if (kills < guns.Length)
                {
                    GunInfo newGun = guns[kills];

                    if (isKiller)
                    {
                        if (photonView.isMine)
                        {
                            if (items.primary != null)
                            {
                                Destroy(items.primary.gameObject);
                            }

                            items.primary = items.InstantiateGun(newGun.ID);
                        }

                        if (worldModel.primary != null)
                        {
                            Destroy(worldModel.primary.gameObject);
                        }

                        worldModel.primary = worldModel.InstantiateGun(newGun.ID);
                    }
                }
                else
                {
                    ServerController.Instance.EndRound();
                }
            }
        }