private void AddSwipe() { SFX.Play("Polish_swipe", 1f, 1f, 0f, false, 0f); numberOfSwipes++; pointsManager.AddPoints(activeDifficultySettings.SwipeContribution); missDurationCounter = 0; }
void Update() { float scoreUpdateDelay = .5f / (startScoreUpdateDelay + speed - startScoopSpeed); if (spawning && !board.gameFrozen) { if (timeUntilNextSpawn <= 0) { timeUntilNextSpawn = spawnDelay; scoopsSpawned++; if (scoopsSpawned % 15 == 0) { speed += .33f; speed = Mathf.Clamp(speed, startScoopSpeed, startScoopSpeed * 2f); } if (scoopsSpawned % 20 == 0) { spawnDelay -= .33f; spawnDelay = Mathf.Clamp(spawnDelay, 1.5f, startSpawnDelay); } SpawnRandomScoop(InstantiateScoop()); } timeUntilNextSpawn -= Time.deltaTime; if (timeUntilScoreUpdate <= 0) { PointsManager.AddPoints(1); timeUntilScoreUpdate = scoreUpdateDelay; } timeUntilScoreUpdate -= Time.deltaTime; } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player") { PointsManager.AddPoints(amount: -250); } }
void Update() { MoveEnemies(); MoveBullets(); EnemiesAndBulletsPooling(); CheckHitByBullet(); PointsManager.AddPoints((int)Time.realtimeSinceStartup * 1 / 100); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("CherryTree")) { //Aquí el personaje está en la zona debajo de un cerezo isCollectingCherries = true; currentCherryCount += 1; PointsManager.AddPoints(5); } }
private void GetInput() { Ray ray = _mainCamera.ScreenPointToRay(Input.mousePosition); Vector3 mWorldPosition = ray.GetPoint(0.3f); FollowSphere.transform.position = mWorldPosition; if (Input.GetMouseButtonDown(0)) { SFX.Play("Tracing_taphold"); isMouseDown = true; mouseDownTime = Time.time; if (!startTimer) { startTime = Time.time; finishTime = currentTime + timeLimit; startTimer = true; } } if (Input.GetMouseButtonUp(0)) { isMouseDown = false; FollowSphere.SetActive(false); hitPoints = 0; CheckPositions(); score = CalculateColliderPenalties(CalculateAccuracy(CalculateWin())); //Reset Particle System if (startedParticle) { feedbackParticleSystem.GetComponent <ParticleSystem>().Stop(); startedParticle = false; } //Add Score if greater than 0 if (score > 0) { PointsManager.AddPoints(score * activeDifficultySettings.ScoreMultiplier); GiveFeedback(); NextRune(); missDurationCounter = 0; } } if (isMouseDown && (Time.time - mouseDownTime) > 0.02) { if (!playerPoints.Contains(mWorldPosition)) { FollowSphere.SetActive(true); playerPoints.Add(mWorldPosition); CheckForRune(mWorldPosition, ray); } } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player") { return; } else if (collision.gameObject.tag == "Finish") { collision.gameObject.GetComponent <Renderer>().enabled = false; PointsManager.AddPoints(amount: 500); } }
public void CreepOut(Creep creep) { if (creep.CreepState == CreepState.Out) { LiveManager.CreepOut(creep.Health); } if (creep.CreepState == CreepState.Killed) { double money = Math.Sqrt(creep.InitialHealth * creep.InitialSpeed); MoneyManager.AddMoney(money); PointsManager.AddPoints(creep.Points); } CreepDeleteList.Add(creep); ChangeInformation(); }
private void Update() { if (isCollectingCherries) { //Cada 60 frames if (tempCurrentCherryCount >= 60) { currentCherryCount += 1; PointsManager.AddPoints(5); tempCurrentCherryCount = 0; } else { //aún no hemos llegado al frame número 60 tempCurrentCherryCount += 1; } } if (HealthManager.currentHealth <= 0 && !hasDead) { hasDead = true; livesRemaining--; if (livesRemaining == 2) { Destroy(GameObject.Find("Life3")); GetComponent <Animator>().Play("CM_Die"); StartCoroutine(RespawnPlayer()); } if (livesRemaining == 1) { Destroy(GameObject.Find("Life2")); GetComponent <Animator>().Play("CM_Die"); StartCoroutine(RespawnPlayer()); } if (livesRemaining == 0) { Destroy(GameObject.Find("Life1")); } } }
private IEnumerator HandleMatch(List <StackNode> matches) { handlingMatch = true; board.Freeze(); int points = 0; audioManager.Play(audioSource, audioManager.matchRisingAudio); yield return(new WaitForSeconds(handleMatchDelay)); for (int i = 0; i < matches.Count; i++) { // handle match i //Destroy scoop game objects for (int j = matches[i].startIndex + matches[i].consecutiveScoops - 1; j >= matches[i].startIndex; j--) { scoopStack[j].MeltScoop(); yield return(new WaitForSeconds(.01f)); } points += PointsManager.AccruePoints(matches[i].consecutiveScoops, i + 1); yield return(audioManager.PlayAndWait(audioSource, audioManager.ScoopsMatchAudio)); // move everything above matches[i].startIndex + matches[i].consecutiveScoops down for (int j = matches[i].startIndex + matches[i].consecutiveScoops; j < scoopStack.Count; j++) { Vector2Int newIndex = new Vector2Int( scoopStack[j].currentIndex.x, Mathf.Clamp(scoopStack[j].currentIndex.y - matches[i].consecutiveScoops, 1, scoopStack[j].currentIndex.y)); scoopStack[j].DropAfterMatch(newIndex); yield return(new WaitForSeconds(.02f)); } scoopStack.RemoveRange(matches[i].startIndex, matches[i].consecutiveScoops); yield return(new WaitForSeconds(.3f)); } (audioManager.ScoopsMatchAudio as IncreasingPitchAudioEvent).Reset(); board.Unfreeze(); if (scoopStack.Count == 0) { // Apply emptyCone Bonus points += PointsManager.AddEmptyConeBonus(); } PointsManager.AddPoints(PointsManager.CalculatePoints(points, matches.Count)); handlingMatch = false; }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Cucumber")) { nextCucumberToDestroy = other.gameObject; BeetlePatrol.isEating = true; m_Animator.Play("Eat_OnGround"); StartCoroutine(DestroyCucumber()); } if (other.gameObject.CompareTag("Cherry")) { PointsManager.AddPoints(25); BeetlePatrol.isAttacking = true; cherryHit = true; m_Animator.Play("Stand"); } }
private void UpdateBar() { float closeness = Mathf.Min(Mathf.Abs(Dial.eulerAngles.z - successPoint) / successRange, 2); if (closeness < 1) { missDurationCounter = 0; feedbackMaterial.SetTexture("_MainTex", feedbackPositive.texture); // Using a curve seemed like a good idea at the time... pointsManager.AddPoints(activeDifficultySettings.ClosenessPointsCurve.Evaluate(closeness) * activeDifficultySettings.ClosenessContribution * Time.deltaTime); } else { feedbackMaterial.SetTexture("_MainTex", feedbackNegative.texture); //qualityBar.Subtract((1-closenessCurve.Evaluate(closeness - 1)) * closenessContribution * Time.deltaTime, allowMoveDown: true); } //Debug.Log("closeness: " + closeness); //Debug.Log("closeness evaluation: " + closenessCurve.Evaluate(closeness)); //qualityBar.TickSubtraction = closenessCurve.Evaluate(closeness); }
private void PerformCut(NewCutPoint cut, Vector3 cutVector) { float val = CalculateCloseness(cut.CutVector, cutVector); //Debug.Log("Calculated a closeness value of: " + val); if (val < activeDifficultySettings.AcceptanceThreshold) { // TODO: animation. SFX.Play("Cutting_good_cut"); missDurationCounter = 0; PushGem(cutVector, 1 - val); PointsManager.AddPoints((1 - val) * activeDifficultySettings.CutRewardMultiplier); //QualityBar.Add((1-val) * CutRewardMultiplier, true); activeCuts.Remove(cut); Destroy(cut.gameObject); activeCut = null; } else { // TODO: fail sound / animation. cut.UnsetSelected(); } }