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 OnCollisionStay2D(Collision2D collision) { if (!enabled) { return; } if (collision.gameObject.layer != LayerMask.NameToLayer("Player") && currentBloodStreak != null) { for (int i = 0; i < collision.contacts.Length; i++) { if (Mathf.Approximately(Mathf.Abs(collision.contacts[i].normal.y), 1.0f)) { currentBloodStreak.AddLocation(collision.contacts[i].point); } } } }