예제 #1
0
        /// <summary>
        /// Set the passed character as selected and deselect all others
        /// </summary>
        /// <param name="selected"></param>
        private void ReplaceSelected(PlayerFacade selected)
        {
            if (!selected.IsSelected)
            {
                selected.Select();
            }

            // Loop all selected and set the ones that aren't the passed to deselected
            foreach (var character in _playerRegistry.Selected)
            {
                if (character != selected)
                {
                    character.Deselect();
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Do stuff when a player character is clicked
        /// </summary>
        /// <param name="player"></param>
        /// <param name="selectionType"></param>
        private void Select(PlayerFacade player, SelectionType selectionType)
        {
            if (player == null)
            {
                return;
            }

            switch (selectionType)
            {
            case SelectionType.Select:
                ReplaceSelected(player);
                break;

            case SelectionType.ControlSelect:
                player.Select();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(selectionType), selectionType, null);
            }
        }