public void ComputeFinalScore() { stageCompletePanel.SetActive(true); sounds.PlayYOO(); comboCounter.ComboReset(); scoreEarned.text = PlayerPrefs.GetInt("Score") + ""; }
public override void TakeDamage(float amount, Vector2 knockBackForce, bool flinch, HealthScript attacker = null, float freezeDelay = 0.0f, Collider2D gotHitCollider = null) { if (playerFever.feverMode == false && consuming.consuming == false) { currentHealth -= amount; GetComponent <PlayerController>().AddForce(knockBackForce.x, knockBackForce.y); if (flinch) { anim.Play("Player_Flinch"); GetComponent <PlayerSkill>().resetSkillTimer(); } if (gotHitCollider) { // Pass attacker (their health scripts) and 'this object's collider that was hit' as argument for hiteffect instantiation. Vector3 hitPos = gotHitCollider.bounds.ClosestPoint(new Vector3(attacker.transform.position.x, attacker.transform.position.y + 0.86f, 0)); // 0.86f is the shoulder height of yasushi. GameObject hitEffectInst = Instantiate(hitEffect, hitPos, attacker.transform.rotation); Vector3 hitEffectScale = hitEffectInst.transform.localScale; hitEffectScale.x *= Mathf.Sign(attacker.transform.position.x - gotHitCollider.transform.position.x); hitEffectInst.transform.localScale = hitEffectScale; } if (attacker != null && freezeDelay > 0) { attacker.FreezeFrames(freezeDelay); FreezeFrames(freezeDelay); } comboUI.ComboReset(); hitBoxes.DeactivateRightHitBox1(); hitBoxes.DeactivateRightHitBox2(); hitBoxes.DeactivateRightHitBox3(); hitBoxes.DeactivateRightChargebox(); takeDamage = true; GetComponent <PlayerAttack> ().attacking = false; GetComponent <PlayerAttack> ().chargeTimer = 0; anim.SetBool("chargingup", false); anim.SetBool("charged", false); camShake.Shake(0.1f, 0.1f); sfx.PlayFlinch(); } else { return; } }
// Update is called once per frame void Update() { isRight = gameObject.GetComponent <PlayerController>().facingRight; //Ensures input and checks if conditions for the next branch is set (MidChain or No) OnClick(); FeverMode(); if (Time.time - lastClickedTime > comboDelay) { attackno = 0; midChain = false; } if (canAttack == false) { if (midChain == false) { if (Time.time - lastClickedTime > attackDelay) { canAttack = true; attacking = false; } } else { if (Time.time - lastClickedTime > chainDelay) { canAttack = true; attacking = false; } } } if (attacking == false) { anim.SetBool("chargingup", false); anim.SetBool("charged", false); } //Resets Combo Counter if (Time.time - lastHitTime > maxComboTime) { comboUI.ComboReset(); } }