예제 #1
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);
     }
 }
예제 #2
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();
            }
        }