public void SetSlot(int slotIndex, bool playAudio) { var oldSlot = AttachedObject._occupiedSlot; var newSlot = slotIndex == -1 ? null : AttachedObject._slots[slotIndex]; if (newSlot == oldSlot) { return; } if (oldSlot) { oldSlot._occupyingOrb = null; oldSlot.RaiseEvent(nameof(oldSlot.OnSlotDeactivated), oldSlot); AttachedObject._occupiedSlot = null; } if (newSlot) { newSlot._occupyingOrb = AttachedObject; if (Time.timeSinceLevelLoad > 1f) { newSlot.RaiseEvent(nameof(newSlot.OnSlotActivated), newSlot); } AttachedObject._occupiedSlot = newSlot; AttachedObject._enterSlotTime = Time.time; if (newSlot.CancelsDragOnCollision()) { AttachedObject.CancelDrag(); } if (playAudio && AttachedObject._orbAudio != null && newSlot.GetPlayActivationAudio()) { AttachedObject._orbAudio.PlaySlotActivatedClip(); } } }