private void TeleportAllItemBalls() { try { if (ItemBallCollectables == null || ItemBallCollectables.Count == 0) { return; } if (ItemBallCollectables != null) { for (int i = 0; i < ItemBallCollectables._size; i++) { var obj = ItemBallCollectables.get_Item(i); var body = obj.GetComponent <Rigidbody>(); body.velocity = novelocity; DebugLog(": Teleporting " + obj.name + " To Your location..."); MelonModLogger.Log(": Teleporting " + ItemBallCollectables.Count + " ItemBalls To Your location..."); Vector3 position = player.transform.position + player.transform.forward; DebugLog("Selected position is : " + position.ToString()); obj.transform.position = position; } } } catch (Exception) { } }
private void AddItemBallCollectable(Transform transform) { if (ItemBallCollectables == null) { ItemBallCollectables = new List <Transform>(); } if (!ItemBallCollectables.Contains(transform)) { ItemBallCollectables.Add(transform); DebugLog("ItemBallCollectables Registered " + transform.name); } }
private void RefreshRemovedCollectables() { if (allCollectables != null) { for (int i = allCollectables.Count - 1; i >= 0; i--) { ObjectDestructable component = allCollectables.get_Item(i).GetComponent <ObjectDestructable>(); bool IsBroken = component != null && component._isDead; SaveItem component2 = allCollectables.get_Item(i).GetComponent <SaveItem>(); bool HasBeenCollected = component2 != null && component2.saveState.bodySlot > SaveState.BodySlot.NONE; if (allCollectables.get_Item(i) == null || IsBroken || HasBeenCollected) { var ItemToRemove = allCollectables.get_Item(i).gameObject.transform; if (allCollectables.Contains(ItemToRemove)) { DebugLog("RefreshRemovedCollectables Removing AllCollectables: " + ItemToRemove.name); allCollectables.Remove(ItemToRemove); } if (CratesCollectables.Contains(ItemToRemove)) { DebugLog("RefreshRemovedCollectables Removing Crate : " + ItemToRemove.name); CratesCollectables.Remove(ItemToRemove); } if (CapsuleCollectables.Contains(ItemToRemove)) { DebugLog("RefreshRemovedCollectables Removing Capsule :" + ItemToRemove.name); CapsuleCollectables.Remove(ItemToRemove); } if (ItemBallCollectables.Contains(ItemToRemove)) { DebugLog("RefreshRemovedCollectables Removing ItemBall : " + ItemToRemove.name); ItemBallCollectables.Remove(ItemToRemove); } } } DebugLog("RefreshRemovedCollectables Method Done, calling for RefreshExistingCollectables."); RefreshExistingCollectables(); } }
private void DecreaseItemBallSize() { try { if (ItemBallCollectables == null || ItemBallCollectables.Count == 0) { return; } if (ItemBallCollectables != null) { for (int i = 0; i < ItemBallCollectables._size; i++) { var obj = ItemBallCollectables.get_Item(i); obj.localScale = obj.localScale / 2; } } } catch (Exception) { } }