private void OnDisable() { if (currentBloodStreak != null) { currentBloodStreak.Detach(); currentBloodStreak = null; } }
private void CreateBloodStreak(Vector2 position) { if (currentBloodStreak != null) { currentBloodStreak.Detach(); } GameObject streakGo = Instantiate(bloodStreakPrefab, position, Quaternion.identity); currentBloodStreak = streakGo.GetComponent <BloodStreak>(); currentBloodStreak.AddLocation(position); }
private void OnCollisionExit2D(Collision2D collision) { if (!enabled) { return; } if (currentBloodStreak != null && collision.gameObject.layer != LayerMask.NameToLayer("Player")) { currentBloodStreak.Detach(); currentBloodStreak = null; } }