public void ShowScorePopup(Vector3 worldPosition, int score) { GameObject scorePopupObject = Utils.Spawn(ScorePopupPrefab, ScorePopupRoot); ScorePopup scorePopup = scorePopupObject.GetComponent <ScorePopup>(); scorePopup.Init(worldPosition, score); }
void RpcDisassemble() { vehicle.toogleHandbrake(true); rigidbody.isKinematic = true; if (isLocalPlayer) { GameObject popup = Instantiate(scorePopupPrefab.gameObject, transform); ScorePopup scorePopup = popup.GetComponent <ScorePopup>(); scorePopup.SetScore(-10000f); } Vector3 velocity = rigidbody.velocity; rigidbody.velocity = Vector3.zero; rigidbody.angularVelocity = Vector3.zero; Transform body = transform.Find("Body"); foreach (Transform child in body) { Rigidbody r = child.gameObject.AddComponent <Rigidbody>(); r.mass = rigidbody.mass / body.childCount; r.velocity = velocity; } foreach (WheelCollider wc in wheels) { foreach (Transform child in wc.transform) { child.gameObject.SetActive(false); } } }
private void SpawnPopup(Chain chain, int index) { Transform spawnPoint = chain.Tiles[index].transform; ScorePopup popup = Instantiate(popupPrefab); popup.transform.position = spawnPoint.position; popup.Initialize(GameRules.CurrentAnswer.ToString(), spawnPoint.position, popupTarget); }
public static void CreateText(string text, Transform location, Color fontColor, Color outlineColor) { ScorePopup instance = Instantiate(popupText); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPos; instance.SetColor(fontColor, outlineColor); instance.SetScore(text); }
void TargetPopup(NetworkConnection target, float s) { if (isLocalPlayer) { GameObject popup = Instantiate(scorePopupPrefab.gameObject, transform); ScorePopup scorePopup = popup.GetComponent <ScorePopup>(); scorePopup.SetScore(s); } }
// Creates a static score popup public static ScorePopup Create(Vector3 position, int scoreAmount) { // Instantiates score popup prefab directly from the prefab folder GameObject scorePopupObject = Instantiate(GameAssets.i.scorePopupPrefab, position, Quaternion.identity) as GameObject; ScorePopup scorePopup = scorePopupObject.GetComponent <ScorePopup>(); scorePopup.Setup(scoreAmount); return(scorePopup); }
public void OnDeath(int points) { AudioManager.Instance.OnBombHit(); currentTween.Kill(); ScorePopup sp = scorePopup.gameObject.GetComponentInChildren <ScorePopup>(); scorePopup.transform.position = this.transform.position; sp.Init(transform.position, points); //Destroy(scorePopup, scoreLifetime); }
public virtual void Death(int playerNumber) { if (GameManager.instance.SelectedGamemode != null) { GameManager.instance.SelectedGamemode.AwardAiKill(playerNumber); ScorePopup scorePopup = Instantiate(LevelManager.instance.scorePopupPrefab, transform.position, Quaternion.identity); scorePopup.Init(GameManager.instance.SelectedGamemode.aiKillsPointReward); } SpawnWeapon(); Destroy(gameObject); }
private void SpawnPopup(HealthHaver dead) { Enemy enemy = dead.GetComponent <Enemy>(); if (enemy == null || !enemy.enabled) { return; } ScorePopup myPopupPrefab = Instantiate(popupPrefab, dead.transform.position, quaternion.identity); myPopupPrefab.DisplayScore(enemy.Value * GlobalStats.DifficultyMultiplier(GlobalStats.instance.SelectedDifficulty)); myPopupPrefab.DisplayCombo(comboerToRead.NumberAbsorbed); }
// To avoid double count on the score void OnDestroy() { if (gameManager.levelOver == false && gameManager.IsGameActive() && !isQuitting) { DropAbility(); Score.AddToScore(pointValue); audioManager.Play("TriangleExplosion"); GameObject explosionEffect = Instantiate(enemyExplosion, transform.position, Quaternion.identity); ScorePopup.Create(transform.position, pointValue); Destroy(explosionEffect, 0.5f); } }
public void FinishRace(WheelVehicle player) { bool finished = true; foreach (CheckPoint cp in _checkPoints) { if (!cp.IsChecked(player)) { finished = false; } } if (finished) { if (player != null) { PlayerHolder ph = player.GetComponentInParent <PlayerHolder>(); _endTime = Time.realtimeSinceStartup - _startTime; Debug.Log("Finish time: " + _endTime); ph.Ui.AddScore(Mathf.FloorToInt(expectedTime - _endTime) * 1000); Transform spawnPos = player.gameObject.transform; ScorePopup sp = GameObject.Instantiate(scorePopupPrefab.gameObject, spawnPos.position, spawnPos.rotation).GetComponent <ScorePopup>(); sp.SetScore(Mathf.FloorToInt(expectedTime - _endTime) * 1000); int score = ph.Ui.GetScore(); _recorders[player].Stop(); if (!_ghost.exist || score > _ghost.score) { _ghost.score = score; _recorders[player].Save(_scene + "-BestTime"); ph.Ui.Finish(_endTime, score, true); } else { ph.Ui.Finish(_endTime, score, false); } } } else { Debug.Log("You missed a checkpoint!"); } }
private void ShowScorePopup() { ScorePopup popup = scorePopup.GetComponent <ScorePopup> (); //set the score float score = (float)itemCounter.count / 6f; //(float)itemCountTotal;; int stars = (int)(score * 5f); string title = FeedbackCopies.GetTitle(stars); string message = FeedbackCopies.GetFeedback("SHOWER", stars); popup.SetStars(stars); popup.SetTitle(title); popup.SetMessage(message); popup.Show(); }
public void CreateText(int score, Vector3 location) { ScorePopup instance = Instantiate(floatingScorePrefab).GetComponent <ScorePopup>(); Vector2 screenPosition = Camera.main.WorldToScreenPoint(location); instance.transform.SetParent(canvas.transform, false); instance.transform.position = screenPosition; instance.SetText(score.ToString()); score = Mathf.Clamp(score, lowestScore, heighestScore); float percent = (heighestScore / 100.0f) * (score / 100.0f); float size = (maxSizeFont - minSizeFont) * (percent / 100); size += minSizeFont; instance.SetSize((int)size); }
public void AddScore(Collision c) { if (gameManager.gameState != GameManager.GameStates.Game || !isLocalPlayer) { return; } CmdAddScore(c.relativeVelocity.sqrMagnitude); if (c.relativeVelocity.sqrMagnitude < 100f) { return; } GameObject popup = Instantiate(scorePopupPrefab.gameObject, transform); ScorePopup scorePopup = popup.GetComponent <ScorePopup>(); scorePopup.SetScore(c.relativeVelocity.sqrMagnitude); }
public void AddScore(float s) { if (gameManager.gameState != GameManager.GameStates.Game || !isLocalPlayer) { return; } CmdAddScore(s); if (s < 100f) { return; } GameObject popup = Instantiate(scorePopupPrefab.gameObject, transform); ScorePopup scorePopup = popup.GetComponent <ScorePopup>(); scorePopup.SetScore(s); }
void OnCollisionEnter(Collision col) { if (source != null) { source.Play(); source.pitch = Random.Range(0.1f, 1.9f); } if (col.gameObject.CompareTag("Player")) { Transform spawnPos = transform; ScorePopup sp = GameObject.Instantiate(scorePopupPrefab.gameObject, spawnPos.position, spawnPos.rotation).GetComponent <ScorePopup>(); sp.SetScore(col.relativeVelocity.sqrMagnitude); PlayerHolder ph = col.gameObject.GetComponentInParent <PlayerHolder>(); ph.Ui.AddScore(Mathf.FloorToInt(col.relativeVelocity.sqrMagnitude)); this.enabled = false; } }
private void ShowScorePopup() { ScorePopup popup = scorePopup.GetComponent <ScorePopup> (); //set the score float timeWeight = 0.2f; float collectionWeight = 0.8f; float timePerformance = Mathf.Min(1f, (float)countDown.GetCount() / 20f); //(float)countDown.startCount; float collectionPerformance = (float)itemCounter.count / (float)itemCountGoal; float score = timePerformance * timeWeight + collectionPerformance * collectionWeight; int stars = (int)(score * 5f); string title = FeedbackCopies.GetTitle(stars); string message = FeedbackCopies.GetFeedback("LIGHT", stars); popup.SetStars(stars); popup.SetTitle(title); popup.SetMessage(message); popup.Show(); }
public WindowStudentController(WindowLoginController wlc) { this.windowLeerling = new WindowStudent(this); windowLeerling.Show(); this.parent = wlc; songPlayer = new SongPlayer(this, null); songProgress = new SongProgress(songPlayer); scorePopup = new ScorePopup(); buttons = new Dictionary <int, PianoButton>(); // Voeg alle knoppen voor het 4e octaaf toe buttons[81] = new PianoButton(Piano.BASE_OCTAAF, "C"); buttons[50] = new PianoButton(Piano.BASE_OCTAAF, "C#"); buttons[87] = new PianoButton(Piano.BASE_OCTAAF, "D"); buttons[51] = new PianoButton(Piano.BASE_OCTAAF, "D#"); buttons[69] = new PianoButton(Piano.BASE_OCTAAF, "E"); buttons[82] = new PianoButton(Piano.BASE_OCTAAF, "F"); buttons[53] = new PianoButton(Piano.BASE_OCTAAF, "F#"); buttons[84] = new PianoButton(Piano.BASE_OCTAAF, "G"); buttons[54] = new PianoButton(Piano.BASE_OCTAAF, "G#"); buttons[89] = new PianoButton(Piano.BASE_OCTAAF, "A"); buttons[55] = new PianoButton(Piano.BASE_OCTAAF, "A#"); buttons[85] = new PianoButton(Piano.BASE_OCTAAF, "B"); // Voeg alle knoppen voor het 5e octaaf toe buttons[90] = new PianoButton(Piano.BASE_OCTAAF + 1, "C"); buttons[83] = new PianoButton(Piano.BASE_OCTAAF + 1, "C#"); buttons[88] = new PianoButton(Piano.BASE_OCTAAF + 1, "D"); buttons[68] = new PianoButton(Piano.BASE_OCTAAF + 1, "D#"); buttons[67] = new PianoButton(Piano.BASE_OCTAAF + 1, "E"); buttons[86] = new PianoButton(Piano.BASE_OCTAAF + 1, "F"); buttons[71] = new PianoButton(Piano.BASE_OCTAAF + 1, "F#"); buttons[66] = new PianoButton(Piano.BASE_OCTAAF + 1, "G"); buttons[72] = new PianoButton(Piano.BASE_OCTAAF + 1, "G#"); buttons[78] = new PianoButton(Piano.BASE_OCTAAF + 1, "A"); buttons[74] = new PianoButton(Piano.BASE_OCTAAF + 1, "A#"); buttons[77] = new PianoButton(Piano.BASE_OCTAAF + 1, "B"); }
public override void PlayerDied() { base.PlayerDied(); if (playersStillAliveThisRound == 1) { int winningPlayerNumber = 0; for (int i = 0; i < players.Length; i++) { if (players[i].isStillAlive) { winningPlayerNumber = players[i].playerNumber; ScorePopup scorePopup = Instantiate(LevelManager.instance.scorePopupPrefab, players[i].playerMovement.transform.position, Quaternion.identity); scorePopup.Init(lastPlayerAlivePoints); } } AwardRoundWin(winningPlayerNumber); EndRound(winningPlayerNumber); } else if (playersStillAliveThisRound < 1) { EndRound(0); } }
void OnChargeComplete() { if (chargedParticle != null) { GameObject go = Instantiate(chargedParticle, transform.position, Quaternion.identity); ParticleSystem[] particles = go.GetComponentsInChildren <ParticleSystem>(); foreach (var particle in particles) { particle.startColor = GameManager.instance.playerColours[playerNumber - 1]; particle.Play(); } } if (GameManager.instance.SelectedGamemode != null) { GameManager.instance.SelectedGamemode.AwardExtraction(playerNumber); ScorePopup scorePopup = Instantiate(LevelManager.instance.scorePopupPrefab, playerShoot.gunOriginTransform.transform.position, Quaternion.identity); scorePopup.Init(GameManager.instance.SelectedGamemode.extractionPointReward); } if (SoundManager.instance != null) { SoundManager.instance.PlaySFX("SFX_Extraction"); } }
public void HitByPlayer(int projectilePlayerNumber, bool canHurtSelf = false) { if (GameManager.instance.SelectedGamemode != null) { if (GameManager.instance.SelectedGamemode.noFriendlyFire) { return; } } if (hasShield) { UseShield(); return; } if (canHurtSelf == false) { if (projectilePlayerNumber == playerNumber) { return; } } if (isAlive == false) // Already dead so cant be killed again { return; } isAlive = false; health = 0; if (projectilePlayerNumber == playerNumber) { if (GameManager.instance.SelectedGamemode != null) { GameManager.instance.SelectedGamemode.AddToStats(playerNumber, StatTypes.Suicides, 1); } } if (isGamepad) { StartCoroutine("Haptic"); } StartCoroutine("FlashHurt"); JuiceManager.TimeSleep(playerParams.playerHitSlowMoDuration, playerParams.playerHitTimeScale, false); ParticleSystem p = Instantiate(bloodSplatterParticle, transform.position, Quaternion.identity); p.Play(); Destroy(p.gameObject, 3); if (projectilePlayerNumber != playerNumber) { if (GameManager.instance.SelectedGamemode != null) { GameManager.instance.AwardKill(projectilePlayerNumber); ScorePopup scorePopup = Instantiate(LevelManager.instance.scorePopupPrefab, transform.position, Quaternion.identity); scorePopup.Init(GameManager.instance.SelectedGamemode.playerKillsPointReward); } } Death(); }
private void Awake() { allRigidBodies = GetComponentsInChildren <Rigidbody>(); scorePopup = GetComponent <ScorePopup>(); }
public void CheckScore(Transform t) { for (int i = 0; i < scoreRange.Count; i++) { if (scoreRange[i].min < time && time < scoreRange[i].max) { bonus = 1 * scoreRange [i].multiplier; //bonus = time * scoreRange [i].multiplier; //print (time+" "+bonus); // // if (Timer.instance != null && time < 5) // Timer.instance.curTime += (5 - time); break; } } score += bonus; // scorePopup.gameObject.SetActive(true); // scorePopup.transform.position = t.GetChild(0).transform.position; // scorePopup.GetComponent<Text> ().text = score.ToString(); // scorePopup.GetComponent<ScorePopup> ().show = true; for (int i = 0; i < scorePopupGroup.childCount; i++) { if (!scorePopupGroup.GetChild(i).GetComponent <ScorePopup>().show) { ScorePopup s = scorePopupGroup.GetChild(i).GetComponent <ScorePopup>(); s.gameObject.SetActive(true); s.transform.position = t.GetChild(0).transform.position; s.GetComponent <Text> ().text = score.ToString(); s.show = true; s.addedScore = score; time = 0; score = 100; AddStreakBonus(); break; } } if (Timer.instance != null) { //Timer.instance.ShowAddedTime (); Timer.instance.AddTime(); } ///tambahan timer disini // if(timePopupGroup != null) { // for(int i = 0; i < timePopupGroup.childCount; i++){ // if(!timePopupGroup.GetChild(i).GetComponent<TimerPopup>().show){ // TimerPopup tp = timePopupGroup.GetChild(i).GetComponent<TimerPopup>(); // tp.gameObject.SetActive (true); // tp.transform.position = t.GetChild (0).transform.position; // tp.GetComponent<Text> ().text = tp.addedTime.ToString (); // tp.show = true; // //tp.addedTim = score; // //time = 0; // //score = 100; // break; // } // } // // } }
public static void Initialize() { print("init"); canvas = GameObject.Find("WorldCanvas"); popupText = Resources.Load <ScorePopup>("Prefabs/PopupParent"); }