private void InitializePlayer() { // get the created Charecter _player = CharacterSelection._player; //add to canvas if (!_game.Children.Contains(_player.Image)) { _game.Children.Add(_player.Image); } //initialize ScoreKeeper _scoreKeeper = new PlayerScoreKeeper(_player.Name, _player.GetScore()); //initialize the visual representations InitializePlayerVisualTools(); }
private void AddNewLineToView(PlayerScoreKeeper scoreKeeper) { SolidColorBrush color = new SolidColorBrush(Color.FromArgb(255, 255, 232, 31)); #region Text Blocks //create poition text block TextBlock position = new TextBlock { Foreground = color, FontSize = 50 }; _positionPanel.Children.Add(position); position.Text = $"{PlayerScoreKeepers.IndexOf(scoreKeeper) + 1}"; _positions.Add(position); //create name text block TextBlock name = new TextBlock { Foreground = color, FontSize = 50 }; _namePanel.Children.Add(name); name.Text = scoreKeeper.PlayerName; _names.Add(name); //create score text block TextBlock score = new TextBlock { Foreground = color, FontSize = 50 }; _scorePanel.Children.Add(score); score.Text = $"{scoreKeeper.PlayerScore}"; _scores.Add(score); #endregion }
// Start is called before the first frame update void Start() { state = GameState.START; MatchEndScreen.lossReason = LossReason.NA; pFieldTransforms = new Transform[10]; cFieldTransforms = new Transform[10]; playerDeckIndicator = GetComponent <ParticleSystem>(); computerDeckIndicator = GameObject.Find("ComputerDeckIndicator").GetComponent <ParticleSystem>(); playerScoreKeeper = FindObjectOfType <PlayerScoreKeeper>(); computerScoreKeeper = FindObjectOfType <ComputerScoreKeeper>(); prevSpriteRenderer = GetComponent <SpriteRenderer>(); computerInput = GetComponent <ComputerInput>(); cardFlipper = GetComponent <CardFlipper>(); audioManager = GetComponent <AudioManager>(); sFX = FindObjectOfType <SFX>(); uiButtons = GetComponent <UIButtons>(); matchEndScreen = GetComponent <MatchEndScreen>(); FindObjectOfType <AudioManager>().Play("Music"); Play(); }
//add to the score board public void AddToPlayerScoreKeepers(PlayerScoreKeeper scoreKeeper) { PlayerScoreKeepers.Add(scoreKeeper); }