// Setters /* * Function Name: Set Active Player * Params: int, bool * Return: * * Description: Sets the player index to true so the main gameplay * knows who is playing */ public void SetActivePlayer(int index, bool active) { // If it was already true, this function will return if (b_ArrayPlayerActives[index]) { return; } // Resets the timer f_Timer = 5; // Changes to active b_ArrayPlayerActives[index] = active; // This two will make the Text appear and the animation will start go_ArrayTextReady[index].GetComponent <Image>().enabled = true; go_ArrayImageReady[index].GetComponent <Animator>().enabled = true; // Once there are 4 players, the timer will be much shorter if (GetNumberActivePlayer() == b_ArrayPlayerActives.Length) { f_Timer = 4; } // Create new player and add to the ScoreManager List GHScoreInfo info = new GHScoreInfo(index + 1, 0); //GHScoreManager.Instance.CreatePlayer(info); DataTransfer.Instance.AddPlayer(info); }
/* * Function Name : Add Score * Author : Wayne * params : GHScoreInfo * Return : void * * Description: Adds to the player score */ public void AddScore(GHScoreInfo scoreInfo) { foreach (var s in list) { int currentScore = s.GetScore(); if (s.GetName() == scoreInfo.GetName()) { s.SetScore(currentScore += scoreInfo.GetScore()); } } Sort(); }
/* * Function Name : Add Score * Author : Wayne * params : GHScoreInfo * Return : void * * Description: Adds to the player score */ public void AddScore(GHScoreInfo info) { foreach (var s in playerScores) { int currentScore = s.GetScore(); if (s.GetName() == info.GetName()) { s.SetScore(currentScore += info.GetScore()); } } //Sort the score array Sort(); }
// Methods /* * Function Name : Add Player * Author : Wayne * params : GHScoreInfo * Return : null * * Description : Add Players to the playerScores array */ public void AddPlayer(GHScoreInfo info) { playerScores.Add(info); }
/* * Function Name : Create Player * Author : Wayne * params : GHScoreInfo * Return : null * * Description : Create and add players into the playerInfo array */ public void CreatePlayer(GHScoreInfo playerInfo) { list.Add(playerInfo); }