public void OnDeath() { if (!GameRule.get.IsGameActive()) { return; } if (bDmagable) { GameObject Statue = Instantiate(StatuePrefab, gameObject.transform.position, Quaternion.identity); GameObject VFX = Instantiate(DeathVFX, gameObject.transform.position, Quaternion.identity); Destroy(VFX, 5.0f); GameRule.get.AddStatue(Statue.GetComponent <StatueBehaviour>()); Vector3 RespawnPosition = GameRule.get.GetPositionInBounds(0.0f, GameRule.get.GetDragonAvoidanceRadius()); GameObject SpawnVFXGO = Instantiate(SpawnVFX, RespawnPosition, Quaternion.identity); Destroy(SpawnVFXGO, 5.0f); StartInvulTimer(); playerMovementScript.TeleportTo(RespawnPosition); if (DeathSFX) { audioSource.PlayOneShot(DeathSFX); } } }