private IEnumerator _EndPhase() { FinalScore.ShowWinningTeam(); yield return(new WaitForSeconds(1)); if (isServer) { GalaxyAudioPlayer.PlayEndAmbiance(); if (Team.humanTeam.score > Team.robotTeam.score) { Team.humanTeam.IncreaseVictoryCount(); } else if (Team.robotTeam.score > Team.humanTeam.score) { Team.robotTeam.IncreaseVictoryCount(); } Team.humanTeam.ResetScore(); Team.robotTeam.ResetScore(); } yield return(new WaitForSeconds(2)); FinalScore.ShowSummaryTable(); }
//NEEDS REFACTORING: Separate display and controls so they are easier to manage void Start() { //Creates the map object for basic game setup tileMap = Instantiate(MapPrefab, new Vector3(0, 0, 0), this.transform.rotation); tileMap.transform.parent = this.gameObject.transform; //Sets up displays for text UI GameObject textCanvas = this.transform.Find("Canvas").gameObject; Score = textCanvas.transform.Find("Score").gameObject; Level = textCanvas.transform.Find("Level").gameObject; LevelContainer = this.transform.Find("LevelContainer").gameObject; ScoreIcon = this.transform.Find("ScoreIcon").gameObject; Score.GetComponent <Text>().color = new Color(1f, 1f, 1f, 0f); Level.GetComponent <Text>().color = new Color(1f, 1f, 1f, 0f); LevelContainer.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 0f); ScoreIcon.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 0f); StartLine = this.transform.Find("StartLine").gameObject; StartLine.GetComponent <StartLine>().showStart = true; TitleCard = this.transform.Find("TitleCard").gameObject; TitleCard.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 1f); GameOver = this.transform.Find("GameOver").gameObject; GameOver.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 0f); GameObject endCanvas = this.transform.Find("EndCanvas").Find("FinalScore").gameObject; FinalScore = (FinalScore)endCanvas.GetComponent(typeof(FinalScore)); Ctrls = this.transform.Find("Ctrls").gameObject; Ctrls.GetComponent <SpriteRenderer>().color = new Color(.84f, .89f, .98f, .75f); Pause = this.transform.Find("Pause").gameObject; Pause.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 0f); }
private void Awake() { if (Instance == null) { Instance = this; } }
public static void ShowFinalScore(params bool[] rightAnswers) { if (!instance) { FinalScore[] s = Resources.FindObjectsOfTypeAll(typeof(FinalScore)) as FinalScore[]; if (s.Length > 0) { instance = s[0]; } if (!instance) { return; } } instance.gameObject.SetActive(true); int index = 1; foreach (var answer in rightAnswers) { ScoreItem item = Instantiate(instance.prefab.gameObject, instance.holder).GetComponent <ScoreItem>(); item.Activate(true); item.SetIndex(index); item.SetCorrect(answer); index++; } }
void Update() { FinalScore finalScore = FindObjectOfType <FinalScore>(); if (finalScore == null || finalScore.isGameOver) { return; } if (reloadTimer > 0) { reloadTimer -= Time.deltaTime; } if (Input.GetButtonDown("Fire1")) { TakePhotoImpl(); } if (reloadTimer + Time.deltaTime >= reloadDuration * 0.7f && reloadTimer < reloadDuration * 0.7f) { GetComponent <AudioSource>().PlayOneShot(reload); } for (int i = floatingScores.Count; i-- > 0;) { FloatingScore floatingScore = floatingScores[i]; floatingScore.pos.y += Time.deltaTime * 3.0f; floatingScores[i] = floatingScore; if (floatingScore.pos.y > 20.0f) { floatingScores.RemoveAt(i); } } }
private void Awake() { if (!instance) { instance = this; } }
/// <summary> /// Calculates z-scores for certain analytics compared to the rest of the data. /// </summary> /// <param name="all">Other team analyses to compare to</param> public void CalculateZScores(IEnumerable <TeamAnalysis> all) { IEnumerable <double> winrates = from ta in all select ta.WinRate; Distribution distWins = winrates.ToList().MakeDistribution(); WinRateZ = distWins.Model.ZScore(WinRate); IEnumerable <double> respRates = from ta in all select ta.ResponsivenessRate; Distribution distResp = winrates.ToList().MakeDistribution(); ResponsivenessRateZ = distResp.Model.ZScore(ResponsivenessRate); IEnumerable <Distribution> bigData = from ta in all select ta.ScoredPoints; ScoredPoints.CalculateZ(bigData); bigData = from ta in all select ta.FinalScore; FinalScore.CalculateZ(bigData); bigData = from ta in all select ta.Penalties; Penalties.CalculateZ(bigData); bigData = from ta in all select ta.Defense; Defense.CalculateZ(bigData); }
void Update() { FinalScore finalScore = FindObjectOfType <FinalScore>(); if (finalScore == null || finalScore.isGameOver) { return; } Vector2 touchDelta = Vector2.zero; if (Input.touchCount > 0) { Vector2 delta = (Input.touches[0].position - touchStart) / Camera.main.pixelHeight * 4.0f; if (Input.touches[0].phase == TouchPhase.Ended && delta.magnitude < 0.002f && Input.touches[0].fingerId == touchId) { Photo.TakePhoto(); } else if (Input.touches[0].phase == TouchPhase.Began) { touchStart = Input.touches[0].position; touchId = Input.touches[0].fingerId; } else if (Input.touches[0].fingerId == touchId) { touchDelta = delta; } } else if (touchId == -1) { Vector2 mouseDelta = (new Vector2(Input.mousePosition.x, Input.mousePosition.y) - touchStart) / Camera.main.pixelHeight * 4.0f; if (Input.GetMouseButtonUp(0) && mouseDelta.magnitude < 0.002f) { Photo.TakePhoto(); } else if (Input.GetMouseButtonDown(0)) { touchStart = Input.mousePosition; touchId = -1; } else if (Input.GetMouseButton(0)) { touchDelta = mouseDelta; } } touchDelta.x += Input.GetAxis("Horizontal"); touchDelta.y += Input.GetAxis("Vertical"); if (touchDelta.magnitude > 1.0f) { touchDelta = touchDelta / touchDelta.magnitude; } x += Time.deltaTime * speed.x * touchDelta.x; y += Time.deltaTime * speed.y * touchDelta.y; x = Mathf.Clamp(x, minX, maxX); y = Mathf.Clamp(y, minY, maxY); }
public void Awake() { if (Instance == null) { Instance = this; } }
private void Awake() { _time = GetComponent <TimeController>(); _score = transform.GetChild(0).GetComponent <FinalScore>(); _time._setTimeGame = false; StartCoroutine(WaitToStartGame()); StartCoroutine(WaitToEndGame()); }
void Start() { packetScore.SetActive(false); timeMultiplier.SetActive(false); calculation.SetActive(false); finalScoreDisplay.SetActive(false); finalScore.SetActive(false); buttons.SetActive(false); score = GameObject.FindGameObjectWithTag("Score").GetComponent <FinalScore>(); }
void OnMouseDown() { FinalScore callee = GameObject.Find("Main Camera").GetComponent("FinalScore") as FinalScore; TextMesh letter1 = GameObject.Find("Letter1").GetComponent("TextMesh") as TextMesh; TextMesh letter2 = GameObject.Find("Letter2").GetComponent("TextMesh") as TextMesh; TextMesh letter3 = GameObject.Find("Letter3").GetComponent("TextMesh") as TextMesh; callee.SignScore(letter1.text + letter2.text + letter3.text); this.enabled = false; }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } }
private void btnSave_Click(object sender, EventArgs e) { FinalScore final = new FinalScore(); final.CompetitorID = CompetitorID; final.Score = Convert.ToDecimal(int.Parse(tbScore.Text)); final.Add(); this.DialogResult = DialogResult.OK; this.Close(); }
private void OnGUI() { FinalScore finalScore = FindObjectOfType <FinalScore>(); if (finalScore == null || finalScore.isGameOver) { return; } foreach (FloatingScore floatingScore in floatingScores) { Vector3 screenPoint = Camera.main.WorldToScreenPoint(new Vector2(floatingScore.pos.x, -floatingScore.pos.y)); Color textColor = new Color(1.0f, 0.9f, 0.3f); int fontHeight = Mathf.RoundToInt(Mathf.Lerp(60.0f, 100.0f, Mathf.Clamp01((floatingScore.score - 10.0f) / 60.0f))); Bgm.shadedText(new Rect(screenPoint.x - 500.0f, screenPoint.y - 50.0f, 1000.0f, 100.0f), "" + floatingScore.score + "€", fontHeight, textColor); } { GUIStyle style = GUIStyle.none; style.normal.textColor = new Color(1.0f, 1.0f, 0.5f, 0.8f); style.fontStyle = FontStyle.Bold; style.fontSize = 45; style.fontSize = scaleFont(style.fontSize); style.alignment = TextAnchor.MiddleCenter; Rect pixelRect = Camera.main.pixelRect; Rect iconRect = pixelRect; iconRect.height *= 0.1f; iconRect.width = iconRect.height; iconRect.x = pixelRect.width * 0.5f - iconRect.width; iconRect.y += pixelRect.height * 0.02f; GUI.DrawTexture(iconRect, moneyTexture); Rect textRect = iconRect; textRect.y -= iconRect.height * 0.02f; Bgm.shadedText(textRect, "" + money, 45, style.normal.textColor); style.normal.textColor = new Color(0.0f, 0.0f, 0.0f, 0.5f); iconRect.x += iconRect.width; GUI.DrawTexture(iconRect, filmTexture); style.fontSize = 60; style.fontSize = scaleFont(style.fontSize); textRect = iconRect; textRect.y -= iconRect.height * 0.02f; textRect.x -= iconRect.height * 0.01f; GUI.Label(textRect, "" + filmLeft, style); } }
private void Awake() { if (m_snooperUI) { s_snooperSingleton = this; } else { s_singleton = this; } m_winningTeamFrame.gameObject.SetActive(false); m_summaryTableFrame.gameObject.SetActive(false); }
IEnumerator BombDeath() { MainScript.runCheck = true; float currentTime = 0.0f; spr.sprite = LossSprite; //bgCol.loseColor(); Player.GetComponent <SpriteRenderer>().material = Red; Vector3 originalScale = new Vector3(0.1f, 0.1f, 0.1f); Vector3 destinationScale = new Vector3(0.3f, 0.3f, 0.3f); Vector3 destinationScale1 = new Vector3(0.1f, 0.1f, 0.1f); for (int i = 0; i < 2; i++) { do { Player.transform.localScale = Vector3.Lerp(originalScale, destinationScale, currentTime / 2); currentTime += Time.deltaTime; yield return(null); } while (currentTime <= 1f); currentTime = 0.0f; originalScale = Player.transform.localScale; do { Player.transform.localScale = Vector3.Lerp(originalScale, destinationScale1, currentTime / 2); currentTime += Time.deltaTime; yield return(null); } while (currentTime <= 1f); currentTime = 0.0f; originalScale = Player.transform.localScale; } Player.SetActive(false); Destroy(Player); int HighScore = FinalScore.ScoreReset(); HighScoreText.text = HighScore.ToString(); enable.SetActive(true); disable.SetActive(false); }
IEnumerator ScaleAgainTime(float time) { spr.sprite = LossSprite; //bgCol.loseColor(); Vector3 originalScale = Player.transform.localScale; Vector3 destinationScale = new Vector3(finalSizeLoss, finalSizeLoss, finalSizeLoss); Vector3 destinationScale1 = new Vector3(0.1f, 0.1f, 0.1f); Player.GetComponent <SpriteRenderer>().material = Red; float currentTime = 0.0f; Debug.Log("HERE1111"); for (int i = 0; i < 2; i++) { do { Player.transform.localScale = Vector3.Lerp(originalScale, destinationScale, currentTime / time); currentTime += Time.deltaTime; yield return(null); } while (currentTime <= 1f); currentTime = 0.0f; originalScale = Player.transform.localScale; do { Player.transform.localScale = Vector3.Lerp(originalScale, destinationScale1, currentTime / time); currentTime += Time.deltaTime; yield return(null); } while (currentTime <= 1f); currentTime = 0.0f; originalScale = Player.transform.localScale; } Player.SetActive(false); Destroy(Player); int HighScore = FinalScore.ScoreReset(); HighScoreText.text = HighScore.ToString(); enable.SetActive(true); disable.SetActive(false); }
public void Load() { string result = PlayerPrefs.GetString("Save"); if (string.IsNullOrEmpty(result)) { return; } Dictionary <FinalScore, List <bool> > results = new Dictionary <FinalScore, List <bool> >(); foreach (var cha in result) { switch (cha) { case '_': FinalScore score = Instantiate(prefab.gameObject, holder).GetComponent <FinalScore>(); results.Add(score, new List <bool>()); break; case '0': if (results.Count > 0) { results.Last().Value.Add(false); } break; case '1': if (results.Count > 0) { results.Last().Value.Add(true); } break; } } foreach (var score in results) { score.Key.SetScore(score.Value.ToArray()); } }
public void GameOver() { Time.timeScale = 0; Score.SetActive(false); FinalScore finalScoreScript = FinalScore.GetComponent <FinalScore>(); finalScoreScript.score = finalScore; bestScore = PlayerPrefs.GetInt("Player Best Score"); if (finalScore > bestScore) { PlayerPrefs.SetInt("Player Best Score", finalScore); } buttonSound.Play(); gameOverPanel.SetActive(true); //Best score FinalScore bestScoreScript = BestScore.GetComponent <FinalScore>(); bestScoreScript.score = PlayerPrefs.GetInt("Player Best Score"); }
void Update() { FinalScore finalScore = FindObjectOfType <FinalScore>(); if (finalScore == null || !finalScore.isGameOver) { return; } if (!started) { started = true; originalPos = transform.localPosition; startTime = Time.time; } float t = Time.time - startTime; float x = Mathf.Cos(t * 2.0f); float y = t * 0.3f + Mathf.Sin(t * 4.0f) * Mathf.Lerp(0.8f, 0.0f, Mathf.Clamp01(t * 0.3f - 0.5f)); transform.localPosition = originalPos + new Vector3(x, y, 0) * t; }
public void checkPacketTargets() { for (int i = 0; i < packets.Count; i++) { if (packets[i].GetComponent <Packet>().getTarget() == this.gameObject) { GameObject.FindGameObjectWithTag("GameController").GetComponent <RemainingPackets>().updatePacketNumber(-1); GameObject.FindGameObjectWithTag("Score").GetComponent <Score>().increaseScore(packets[i].GetComponent <Packet>().getSize()); //score increased by size of packet packets.Remove(packets[i]); } } if (GameObject.FindGameObjectWithTag("GameController").GetComponent <RemainingPackets>().getPackets() == 0) { if (SceneManager.GetActiveScene().buildIndex == 1) { time.setGameComplete(true); } ShowFinalScore finalScore = GameObject.FindGameObjectWithTag("FinalScore").GetComponent <ShowFinalScore>(); FinalScore score = GameObject.FindGameObjectWithTag("Score").GetComponent <FinalScore>(); score.calculateFinalScore(); StartCoroutine(finalScore.showScore()); } }
// Start is called before the first frame update void Start() { finalMessage = GetComponent <Text> (); finalMessage.text = "Your score is: " + ScoreScript.scoreValue; if (highScore < ScoreScript.scoreValue) { finalMessage.text += "\n" + "You beat your old high score of " + highScore + "!"; highScore = ScoreScript.scoreValue; } int foreverMax = FinalScore.calculateMaxScore(); percentage = (ScoreScript.scoreValue * 100) / foreverMax; finalMessage.text += "\n" + "You earned " + percentage + "% of the maximum possible score: " + foreverMax + "!"; finalMessage.text += "\n" + "Keep working hard!"; ScoreScript.scoreValue = 0; }
private static void FillResults(ParticipantCoupleDetail participant, List <Official> adjudicators) { Random random = new Random(); // as we have loeded the participant from the API it may contain results from previous rounds. // always upload the entire mark/score set! participant.Rounds.Clear(); string[] danceNames = new string[] { "SAMBA", "CHA CHA CHA", "RUMBA", "PASO DOBLE", "JIVE" }; // results for round 1 // couple has got a star, this means a mark from every adjudicator for every dance with IsSet = true Round round1 = new Round() { Name = "1" }; participant.Rounds.Add(round1); foreach (string danceName in danceNames) { Dance dance = new Dance() { Name = danceName }; round1.Dances.Add(dance); foreach (Official adjudicator in adjudicators) { MarkScore score = new MarkScore() { IsSet = true, OfficialId = adjudicator.Id }; dance.Scores.Add(score); } } // results for round 2 Round round2 = new Round() { Name = "2" }; participant.Rounds.Add(round2); foreach (string danceName in danceNames) { Dance dance = new Dance() { Name = danceName }; round2.Dances.Add(dance); foreach (Official adjudicator in adjudicators) { // we use a random number to decide if the couple got a mark or not // in real life this would be taken from the adjudicator's decision if (random.Next(0, 10) > 5) { continue; } MarkScore score = new MarkScore() { OfficialId = adjudicator.Id }; dance.Scores.Add(score); } } // results for final round Round roundF = new Round() { Name = "F" }; participant.Rounds.Add(roundF); foreach (string danceName in danceNames) { Dance dance = new Dance() { Name = danceName }; roundF.Dances.Add(dance); foreach (Official adjudicator in adjudicators) { // we use a random number to determine the rank in a final round // in real life this would be taken from the adjudicator's decision int rank = random.Next(1, 6); FinalScore score = new FinalScore() { Rank = rank, OfficialId = adjudicator.Id }; dance.Scores.Add(score); } } }
// Start is called before the first frame update private void Start() { lastMatchFinalScore = FinalScore.Get(); finalScoreText.text = "Your score is : " + lastMatchFinalScore.getFinalScore(); }
void Start() { finalScore = GameObject.FindGameObjectWithTag("Score").GetComponent <FinalScore>(); }
private void Start() { EnemyMgr = EnemyManager.Get(); currentMatchFinalScore = FinalScore.Get(); }
public ScorePanel() { InitializeComponent(); _success = TreasureOptions.Instance.User.CurrentScore >= TreasureOptions.Instance.User.CurrentTarget; int score = TreasureOptions.Instance.User.CurrentScore; int gold = TreasureOptions.Instance.User.CurrentGold; int target = TreasureOptions.Instance.User.CurrentTarget; int maxT = TreasureOptions.Instance.User.MaxTarget; int charges = TreasureOptions.Instance.Game.Charges; String txtMsg = null; if (_success) { txtMsg = (string)Resources["Txt.Message.Success"]; _txtHint.Text = (string)Resources["Txt.Hint.Accuracy"]; } else { txtMsg = (string)Resources["Txt.Message.Failure"]; if (gold < (charges / 2.0)) { _txtHint.Text = (string)Resources["Txt.Hint.Failed.Gold"]; } else { _txtHint.Text = (string)Resources["Txt.Hint.Failed.Target"]; } } _txtMessage.Text = String.Format(txtMsg, TreasureOptions.Instance.User.CurrentLevel); if (score >= target) { _xTextTarget.Text = (string)Resources["Txt.Message.Target.Success"]; } else { _xTextTarget.Text = (string)Resources["Txt.Message.Target.Failed"]; } _xNuggets.Text = gold.ToString(); _xNuggetsGold.Text = charges.ToString(); _xScore.Text = score.ToString(); _xScoreMax.Text = maxT.ToString(); _xTarget.Text = target.ToString(); int baseScore = 100; double sAccuracy = 100.0 * (double)gold / (double)charges; double sGold = 100.0 * (double)score / (double)maxT; double sTarget = 100.0 * (double)target / (double)maxT; int tAcc = (int)(baseScore * sAccuracy / 100.00); _nAccScore.Text = tAcc.ToString(); //_xAccBar.Value = sAccuracy; int tGold = (int)(baseScore * sGold / 100.00); _ngoldScore.Text = tGold.ToString(); //_xGoldBar.Value = sGold; FinalScore = (int)(tAcc + tGold); if (score < target) { FinalScore = 0; _nTargetScore.Text = @"0 %"; _nTargetScore.Foreground = new SolidColorBrush(Colors.Red); //#FFFFA7A7 } _nTotalScore.Text = FinalScore.ToString(); }