public override void Death() { MyRigi.velocity = Vector2.zero; MyAni.SetTrigger("Revive"); hp.CurrVal = hp.MaxVal; transform.position = startPos; }
private void HandleInput() { if (Vertical == 0) { if (Input.GetButtonDown("Punch") && mp.CurrVal > 0) { MyAni.SetTrigger("Attack"); mp.CurrVal -= 5; } if (Input.GetButtonDown("Dodge")) { MyAni.SetTrigger("Roll"); } if (Input.GetButtonDown("Jump") && !IsFalling) { MyAni.SetTrigger("Jump"); Jump = true; } if (Input.GetButtonDown("Throw") && mp.CurrVal > 0) { MyAni.SetTrigger("Throw"); mp.CurrVal -= 10; } } }
public override void Death() { dropItem = true; MyAni.ResetTrigger("Die"); MyAni.SetTrigger("Idle"); hp.CurrVal = hp.MaxVal; transform.position = startPos; }
public override IEnumerator TakeDamage() { hp.CurrVal -= 10; if (!IsDead) { MyAni.SetTrigger("Damage"); } else { if (dropItem) { GameObject coin = (GameObject)Instantiate(GameManager.Instance.CoinPrefab, new Vector3(transform.position.x, transform.position.y), Quaternion.identity); Physics2D.IgnoreCollision(coin.GetComponent <Collider2D> (), GetComponent <Collider2D> ()); dropItem = false; } MyAni.SetTrigger("Die"); yield return(null); } }
public override IEnumerator TakeDamage() { if (!immortal) { hp.CurrVal -= 10; if (!IsDead) { MyAni.SetTrigger("Damage"); immortal = true; StartCoroutine(IndicateImmortalDamage()); yield return(new WaitForSeconds(immortalTime)); immortal = false; } else { MyAni.SetLayerWeight(1, 0); MyAni.SetTrigger("Die"); } } }