Example #1
0
        public void SyncGamePieceNetworkState(GamePieceNetworkState pieceNetworkState)
        {
            PlayerState player = GetPlayerStateById
                                     (pieceNetworkState.ControllerIdentity);

            if (player == null)
            {
                return;
            }

            player.SyncGamePieceNetworkState(pieceNetworkState);
        }
Example #2
0
        public void SyncGamePieceNetworkState(GamePieceNetworkState gpns)
        {
            if (!m_GamePieceNetworkStates.ContainsKey(gpns.NetworkIdentity))
            {
                m_GamePieceNetworkStates.Add(gpns.NetworkIdentity, gpns);
                m_ModifiedNetworkStates.Add
                    (m_GamePieceNetworkStates[gpns.NetworkIdentity]);
            }

            else
            {
                UpdateGamePieceNetState(gpns);
            }
        }
 public bool Equals(GamePieceNetworkState netState)
 {
     return
         (m_ControllerIdentity == netState.ControllerIdentity &&
          m_NetworkIdentity == netState.NetworkIdentity &&
          m_GamePieceName == netState.GamePieceName &&
          m_ControllerPosition == netState.ControllerPosition &&
          m_PositionX == netState.PositionX &&
          m_PositionY == netState.PositionY &&
          m_Hitpoints == netState.Hitpoints &&
          m_DefenseRating == netState.DefenseRating &&
          m_AttackRating == netState.AttackRating &&
          m_TurnDelay == netState.TurnDelay &&
          m_Rotation == netState.Rotation);
 }
Example #4
0
        public void UpdateGamePieceNetState(GamePieceNetworkState gpns, bool forceUpdate = false)
        {
            if (m_GamePieceNetworkStates.ContainsKey(gpns.NetworkIdentity))
            {
                GamePieceNetworkState currentNetState = m_GamePieceNetworkStates[gpns.NetworkIdentity];
                if (!currentNetState.Equals(gpns))
                {
                    m_GamePieceNetworkStates[gpns.NetworkIdentity] = gpns;
                    m_ModifiedNetworkStates.Add
                        (m_GamePieceNetworkStates[gpns.NetworkIdentity]);
                }

                else if (forceUpdate)
                {
                    m_GamePieceNetworkStates[gpns.NetworkIdentity] = gpns;
                    m_ModifiedNetworkStates.Add
                        (m_GamePieceNetworkStates[gpns.NetworkIdentity]);
                }
            }
        }
Example #5
0
        public void SyncAttackTarget(string attackerId, string targetId)
        {
            if (PlayerOne.GamePieceNetworkStates.ContainsKey(attackerId))
            {
                GamePieceNetworkState attacker = PlayerOne.GamePieceNetworkStates[attackerId];
                if (PlayerTwo.GamePieceNetworkStates.ContainsKey(targetId))
                {
                    GamePieceNetworkState target = PlayerTwo.GamePieceNetworkStates[targetId];
                    target.ProcessDamage(attacker.AttackRating);
                    PlayerTwo.UpdateGamePieceNetState(target, true);
                }
            }

            else if (PlayerTwo.GamePieceNetworkStates.ContainsKey(attackerId))
            {
                GamePieceNetworkState attacker = PlayerTwo.GamePieceNetworkStates[attackerId];
                if (PlayerOne.GamePieceNetworkStates.ContainsKey(targetId))
                {
                    GamePieceNetworkState target = PlayerOne.GamePieceNetworkStates[targetId];
                    target.ProcessDamage(attacker.AttackRating);
                    PlayerOne.UpdateGamePieceNetState(target, true);
                }
            }
        }
Example #6
0
 public GamePieceSyncReceivedEventArgs(string matchId, string controllerId, GamePieceNetworkState pieceNetworkState)
 {
     m_MatchId = matchId;
     m_ControllerId = controllerId;
     m_GamePieceNetworkState = pieceNetworkState;
 }