public void SpawnTick(int score) { ScoreTick tick = Instantiate(tickPrefab); tick.transform.SetParent(this.transform); tick.SetTickerPosition(tickSpacing * tickList.Count, true); tick.SetScore(score); tick.StartAnim(); tickList.Add(tick); }
// Update is called once per frame void Update() { if (DanceStartedREF == true) { DanceToCopy.enabled = true; } else { DanceToCopy.enabled = false; } DanceStartedREF = PlayerREF.GetComponent <playercontrol>().DanceStarted; if (GameisOver == true) { if (Input.anyKeyDown) { SceneManager.LoadScene(0); } } FailText.text = FailTick.ToString(); ScoreText.text = ScoreTick.ToString(); if (FailTick >= 3) { GameOverPanel.SetActive(true); GameisOver = true; } if (DanceStartedREF == false) { if (Input.GetKeyDown(KeyCode.Space)) { SpacePressed = true; StartCoroutine(SpaceDelay()); if (CurrentDance == CPUDance) { CompareText.text = "Correct"; ScoreTick += 10; // Debug.Log("Correct"); } else { CompareText.text = "Fail"; FailTick++; //Debug.Log("Fail"); } } } Vignette.color = alphacolor; }
public void RemoveTick(ScoreTick t) { tickList.Remove(t); Recalculate(); }
void FixedUpdate() { if (!canPlay) { return; } // Checks if (players.Count == 0 || wolf == null) { return; } Entity ent = players [0].GetComponent <Entity> (); if (ent.IsWolf() || ent.IsInvincible()) { return; } // Store dist float dist = Vector2.Distance(wolf.transform.position, ent.transform.position); //Debug.Log (dist + " / " + bestDist); if (dist < bestDist) { bestDist = dist; //Debug.Log("better"); } // Score tick scoreTick--; if (scoreTick <= 0) { int score = 1; if (bestDist < 1.5f) { score = 3; } else if (bestDist < 5f) { score = 2; } GameObject go = Instantiate(scoreTickPrefab) as GameObject; go.transform.SetParent(players[0].transform, false); go.transform.localScale = players[0].transform.localScale; ScoreTick st = go.GetComponent <ScoreTick>(); st.Setup(score, players[0]); if (score == 1) { playerScore += 1; } else if (score == 2) { playerScore += 5; } else if (score == 3) { playerScore += 25; } if (scoreTF != null) { scoreTF.text = "Score: " + playerScore; } scoreTick = scoreTickDelay; bestDist = float.MaxValue; } }