protected virtual void die() { if (myAnimator != null) { myAnimator.SetBool("Dieing", true); } dieing = true; if (stunVFX != null) { stunVFX.Die(); stunVFX = null; } if (fireVFX != null) { fireVFX.Die(); fireVFX = null; } stunned = false; onFire = false; float chance = Random.Range(0, 100); if (chance < lootDropChance) { //Debug.Log("Loot Dropped with " + chance.ToString() + "at position " + transform.position.ToString()); PlayerData.Player.AddGold(Random.Range(lootDropMin, lootDropMax + 1)); AudioControlScript.mAC.PlayGetCoin(); } checkIfRelatedQuest(); }
protected void checkStunChance(int valToRollUnder, float howLong) { if (canBeStunned) { if (Random.Range(0, 100) < valToRollUnder) { Debug.Log("Stunned!"); AudioControlScript.mAC.PlayStunned(); stunVFX = GameManagerScript.G.GetStunVFX(); stunVFX.OnSpawn(transform.position); stunned = true; stunnedTime = howLong; } } }
protected void reduceStun() { if (stunned) { if (stunVFX != null) { stunVFX.gameObject.transform.position = transform.position; } if (stunnedTime <= 0) { stunned = false; if (stunVFX != null) { stunVFX.Die(); stunVFX = null; } } stunnedTime -= Time.deltaTime; } }