Esempio n. 1
0
        /// <summary>
        /// Checks views after movement.
        /// </summary>
        private void Move()
        {
            List <Character> piv    = World.GetPlayersInArea(this);
            bool             exists = false;

            ///
            /// Checks current players in view to see if they are still in range.
            ///
            foreach (Character OtherPlayer in _players_iv)
            {
                if (World.GetDistance(this, OtherPlayer) > World.PLAYER_SIGHT_RANGE)
                {
                    OtherPlayer.DeleteView(this);
                    DeleteView(OtherPlayer);
                }
            }

            ///
            /// Add the new players into view
            ///
            foreach (Character PlayerIV in piv)
            {
                exists = false;
                foreach (Character OtherPlayer in _players_iv)
                {
                    if (OtherPlayer == PlayerIV)
                    {
                        exists = true;
                        break;
                    }
                }

                if (!exists)
                {
                    AddView(PlayerIV);
                }
            }
        }