public void SetToDestroy() { m_Decal.SetToDestroy(); GameScoreManager.Get().DecrementLiveCracks(); //SetEnableAllActorTriggerBase(false); m_DefenderCollider.enabled = false; }
public void UpdateAttackedState(State currState, float deltaTime) { if (m_Animation.IsPlaying("HitReaction") == false) { //Debug.Log("Animation finished.."); m_PlayerStateMachine.CanChangeState = true; if (GameScoreManager.Get().PlayerHealth == 0.0f) { m_BufferedInput.AddInput("Death", 0.1f); } } }
// Update is called once per frame void Update() { if (!m_GameOver) { m_Text.text = "" + (GameScoreManager.Get() != null ? GameScoreManager.Get().PatchedCount : 0); float healthBarWIdth = GameScoreManager.Get().PlayerHealth *m_HealthBarMaxWidth; m_HealthBar.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, healthBarWIdth); float damageBarWidthPercent = (float)GameScoreManager.Get().NumLiveCracks / GameScoreManager.Get().MaxNumLiveCracks; if (damageBarWidthPercent >= 1.0f) { damageBarWidthPercent = 1.0f; m_GameOver = true; m_MessageGenerator.gameObject.SetActive(false); } if (GameScoreManager.Get().PlayerHealth <= 0.0f) { m_GameOver = true; m_MessageGenerator.gameObject.SetActive(false); } m_DamagehBar.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, damageBarWidthPercent * m_DamageBarMaxWidth); } else { if (m_Player.DeathStateCompleted && !m_GameOverScreenShown) { m_GameOverScreenShown = true; m_HealthCanvas.gameObject.SetActive(false); m_ScoreCanvas.gameObject.SetActive(false); m_DamageCanvas.gameObject.SetActive(false); m_GameOverCanvas.gameObject.SetActive(true); m_GameOverTimer = 2.0f; } if (m_GameOverScreenShown) { m_GameOverTimer -= Time.deltaTime; if (m_GameOverTimer <= 0.0f) { if (Input.anyKey) { SceneManager.LoadScene(SceneManager.GetActiveScene().name); } } } } }
// Called when any types weapon collides with this, returns true if it is successful attack // returns false if attack is blocked public override bool Attacked(Actor attacker, GameObject bodyPartGotHit, float damage) { if (attacker.GetType().IsSubclassOf(typeof(Patch)) || attacker.GetType() == typeof(Patch)) { Patch patch = (Patch)attacker; if (patch != null) { if (GameScoreManager.Get() != null) { GameScoreManager.Get().IncrementPatchCount(); } //patch.SetToDestroy(); SetToDestroy(); } } return(true); }
// Called when any types weapon collides with this, returns true if it is successful attack // returns false if attack is blocked public override bool Attacked(Actor attacker, GameObject bodyPartGotHit, float damage) { if (attacker.GetType().IsSubclassOf(typeof(Projectile))) { Projectile proj = (Projectile)attacker; if (proj != null) { proj.DestroyWithoutDecals(); } if (m_PlayerStateMachine.CurrentState != (int)PlayerStates.ePS_Dead) { m_PlayerHealth -= damage; GameScoreManager.Get().PlayerHealth = Mathf.Clamp(m_PlayerHealth / m_PlayerMaxHealth, 0.0f, 1.0f); m_BufferedInput.AddInput("Attacked", 0.05f); m_PlayerStateMachine.CanChangeState = true; } } return(true); }
// Use this for initialization protected void Awake() { m_Decal = GetComponent <Decal>(); m_NoOfPointsAdded = 0; GameScoreManager.Get().IncrementLiveCracks(); }