Esempio n. 1
0
        private void Update()
        {
            if (DebugPlayer)
            {
                RigData debugRigData = DebugPlayer.GetRigData();

                RigData tempData = new RigData(debugRigData.Head);
                foreach (Player player in players)
                {
                    if (player.quality == 1)
                    {
                        tempData = new RigData(debugRigData.Head);
                    }
                    if (player.quality == 2)
                    {
                        tempData = new RigData(debugRigData.Head,
                                               debugRigData.Left,
                                               debugRigData.Right);
                    }
                    else if (player.quality == 3)
                    {
                        tempData = new RigData(debugRigData.Head,
                                               debugRigData.Left,
                                               debugRigData.Right,
                                               debugRigData.LeftShoulder,
                                               debugRigData.RightShoulder,
                                               debugRigData.LeftElbow,
                                               debugRigData.RightElbow);
                    }
                    NetworkingManager.SetRigDataByID(player.id, tempData);
                }
            }
        }
Esempio n. 2
0
        public override void ChangePlayerQuality(int id, int newQuality)
        {
            if (newQuality < 1)
            {
                newQuality = 1;
            }
            else if (newQuality > 3)
            {
                newQuality = 3;
            }

            var playerCurrent = GetPlayerByID(id);

            GameObject newPrefab = GetSimulatedStudentAvatarByQuality(newQuality);
            NetworkedPlayerSimulator newPlayer = NetworkingManager.Instantiate(newPrefab,
                                                                               playerCurrent.transform.position,
                                                                               playerCurrent.transform.rotation,
                                                                               playerCurrent.transform.parent).GetComponent <NetworkedPlayerSimulator>();

            newPlayer.id         = playerCurrent.id;
            newPlayer.quality    = newQuality;
            newPlayer.isSpeaking = playerCurrent.isSpeaking;
            //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            players[players.IndexOf(playerCurrent)] = newPlayer;

            NetworkingManager.Destroy(playerCurrent.gameObject);
        }
Esempio n. 3
0
        public static GameObject GetPlayer(bool isTeacher, int quality = 1)
        {
            if (isTeacher)
            {
                return((GameObject)NetworkingManager.LoadNetworkedPrefab("TeacherPlayer"));
            }

            return(GetStudentAvatarByQuality(quality));
        }
Esempio n. 4
0
        public static GameObject GetStudentAvatarByQuality(int quality)
        {
            if (quality < 1)
            {
                quality = 1;
            }
            else if (quality > 3)
            {
                quality = 3;
            }

            return((GameObject)NetworkingManager.LoadNetworkedPrefab("StudentPlayer_" + quality));
        }
Esempio n. 5
0
        public virtual void PlayerDisconnect(int id)
        {
            Player player = GetPlayerByID(id);

            if (speakingPlayerIds.Contains(player.id))
            {
                VoiceChatManager.RemoveVoiceConnection(player.id);
            }

            players.Remove(player);
            NetworkingManager.rigsData.Remove(player.id);

            NetworkingManager.Destroy(player.gameObject);
            return;
        }
Esempio n. 6
0
        public virtual void PlayerConnect(int Player, bool isTeacher)
        {
            var    loadedPlayer       = GetPlayer(isTeacher);
            Player instantiatedPlayer = NetworkingManager.Instantiate(loadedPlayer).GetComponent <Player>();

            instantiatedPlayer.id = NetworkingManager.GetNewPlayerID();
            teacherId             = instantiatedPlayer.id;

            players.Add(instantiatedPlayer);
            NetworkingManager.rigsData.Add(instantiatedPlayer.id, instantiatedPlayer.GetRigData());

            //if seat system was implemented positon would be updated here
            //insead it is implemnted in the override in MultiplayerRoomSimulator.cs
            //
            //instantiatedPlayer.transform.position = GetSeatPositon();
            //instantiatedPlayer.transform.localRotation *= GetSeatRotation();
        }
Esempio n. 7
0
        public override void PlayerConnect(int id, bool isTeacher)
        {
            var    loadedPlayer       = GetSimulatedPlayer(isTeacher);
            Player instantiatedPlayer = NetworkingManager.Instantiate(loadedPlayer).GetComponent <Player>();

            instantiatedPlayer.id = NetworkingManager.GetNewPlayerID();
            teacherId             = instantiatedPlayer.id;

            players.Add(instantiatedPlayer);
            NetworkingManager.rigsData.Add(instantiatedPlayer.id, instantiatedPlayer.GetRigData());

            //to be replaced by a seat system where the enviornement puts forth a list of available seats in the enviorment
            //and moves the player at an available seat or one they choose before/while connected

            if (!isTeacher)
            {
                players[players.Count - 1].transform.position       = GetSeatPositon();
                players[players.Count - 1].transform.localRotation *= GetSeatRotation();
            }
        }
Esempio n. 8
0
        protected override void Start()
        {
            if (debugAsTeacher)
            {
                base.PlayerConnect(NetworkingManager.GetNewPlayerID(), true);
            }
            else
            {
                PlayerConnect(NetworkingManager.GetNewPlayerID(), true);
            }

            DebugPlayer = players[players.Count - 1];

            int playerIndex = Random.Range(0, numSimulatedStudents);

            if (debugAsTeacher)
            {
                playerIndex = -1;
            }

            base.Start();
            for (int i = 1; i < numSimulatedStudents + 1; i++)
            {
                if (playerIndex.Equals(i))
                {
                    base.PlayerConnect(NetworkingManager.GetNewPlayerID(), false);
                    players[players.Count - 1].transform.position  = GetSeatPositon();
                    players[players.Count - 1].transform.rotation *= GetSeatRotation();
                    DebugPlayer = players[players.Count - 1];
                }
                else
                {
                    PlayerConnect(NetworkingManager.GetNewPlayerID(), false);
                }
            }
        }
 public virtual void JoinRoom(string roomName)
 {
     NetworkingManager.JoinRoom(roomName);
 }
 public virtual void CreateRoom(string roomName = null)
 {
     NetworkingManager.CreateRoom(roomName);
 }
Esempio n. 11
0
 private void Update()
 {
     if (NetworkingManager.IsMe())
     {
     }
 }