Example #1
0
        private void TeleportAllCrates()
        {
            try
            {
                if (CratesCollectables == null || CratesCollectables.Count == 0)
                {
                    MelonModLogger.Log("No Crates Detected!");
                    return;
                }
                if (CratesCollectables != null)
                {
                    for (int i = 0; i < CratesCollectables._size; i++)
                    {
                        var obj = CratesCollectables.get_Item(i);

                        DebugLog(": Teleporting " + obj.name + " To Your location...");
                        MelonModLogger.Log(": Teleporting " + CratesCollectables.Count + " Crates To Your location...");
                        Vector3 position = player.transform.position + player.transform.forward;
                        DebugLog("Selected position is : " + position.ToString());

                        obj.transform.position = position;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Example #2
0
 private void AddCrateCollectable(Transform transform)
 {
     if (CratesCollectables == null)
     {
         CratesCollectables = new List <Transform>();
     }
     if (!CratesCollectables.Contains(transform))
     {
         CratesCollectables.Add(transform);
         DebugLog("CratesCollectables Registered " + transform.name);
     }
 }
Example #3
0
        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();
            }
        }