示例#1
0
 /// <summary>
 /// Online: synchronizes the team number of the player for all players via properties.
 /// </summary>
 public static void SetTeam(this Photon.Realtime.Player player, int teamIndex)
 {
     player.SetCustomProperties(new Hashtable()
     {
         { team, (byte)teamIndex }
     });
 }
示例#2
0
 /// <summary>
 /// Online: Synchronizes the currently selected bullet of the player for all players via properties.
 /// </summary>
 public static void SetBullet(this Photon.Realtime.Player player, int value)
 {
     player.SetCustomProperties(new Hashtable()
     {
         { bullet, (byte)value }
     });
 }
示例#3
0
 /// <summary>
 /// Online: Clears all networked variables of the player via properties in one instruction.
 /// </summary>
 public static void Clear(this Photon.Realtime.Player player)
 {
     player.SetCustomProperties(new Hashtable()
     {
         { PlayerExtensions.bullet, (byte)0 },
         { PlayerExtensions.health, (byte)0 },
         { PlayerExtensions.shield, (byte)0 }
     });
 }
示例#4
0
        /// <summary>
        /// Online: synchronizes the ammo count of the player for all players via properties.
        /// Provides an optional index parameter for setting a new bullet and ammo together.
        /// </summary>
        public static void SetAmmo(this Photon.Realtime.Player player, int value, int index = -1)
        {
            Hashtable hash = new Hashtable();

            hash.Add(ammo, (byte)value);
            if (index >= 0)
            {
                hash.Add(bullet, (byte)index);
            }

            player.SetCustomProperties(hash);
        }
        /// <summary>
        /// Method that will be executed when the next player needs to get the turn
        /// </summary>
        public void NextTurn()
        {
            int index;

            if (GameInstance.instance.IsMultiplayer)
            {
                var currentPlayer = GetCurrentActivePlayer();
                index = Array.IndexOf(PhotonNetwork.PlayerList, currentPlayer);

                if (index == -1)
                {
                    return;
                }

                index += 1;
                if (index == PhotonNetwork.PlayerList.Length)
                {
                    index = 0;
                }

                Photon.Realtime.Player newPlayer = PhotonNetwork.PlayerList[index];
                Hashtable hash = new Hashtable {
                    { "CanMove", true }
                };
                newPlayer.SetCustomProperties(hash);

                Hashtable hashh = new Hashtable {
                    { "CanMove", false }
                };
                currentPlayer.SetCustomProperties(hashh);
            }
            else
            {
                index = Players.IndexOf(GetCurrentActivePlayerSinglePlayer());
                if (index == -1)
                {
                    return;
                }
                index += 1;
                if (index >= Players.Count)
                {
                    index = 0;
                }
                Player newPlayer = Players[index];
                GetCurrentActivePlayerSinglePlayer().CanMove = false;
                newPlayer.CanMove = true;
            }
        }