Esempio n. 1
0
        private static bool SpawnItemDetails(ItemSpawnerV2 __instance)
        {
            OtherLogger.Log("Trying to spawn: " + __instance.m_selectedID, OtherLogger.LogType.General);

            //If the selected item has a spawner entry, use that
            if (OtherLoader.SpawnerEntriesByID.ContainsKey(__instance.m_selectedID))
            {
                OtherLogger.Log("Using normal spawn", OtherLogger.LogType.General);

                __instance.Boop(1);
                AnvilManager.Run(SpawnItems(__instance, OtherLoader.SpawnerEntriesByID[__instance.m_selectedID]));
            }

            //Otherwise try to use legacy spawner ID
            else if (IM.HasSpawnedID(__instance.m_selectedID))
            {
                OtherLogger.Log("Using legacy spawn", OtherLogger.LogType.General);

                return(true);
            }

            else
            {
                __instance.Boop(2);
            }

            return(false);
        }
Esempio n. 2
0
        private GameObject UpdateCurrentGameObj(GameObject obj)
        {
            if (obj != null)
            {
                m_currentGameObj       = obj;
                m_currentFVRObj        = null;
                m_currentFVRPhysObj    = null;
                m_currentItemSpawnerID = null;

                if (m_currentGameObj.GetComponentInChildren <FVRPhysicalObject>() != null)
                {
                    m_currentFVRPhysObj    = m_currentGameObj.GetComponentInChildren <FVRPhysicalObject>();
                    m_currentFVRObj        = m_currentFVRPhysObj.ObjectWrapper;
                    m_currentItemSpawnerID = m_currentFVRPhysObj.IDSpawnedFrom;

#if !UNITY_EDITOR && !UNITY_STANDALONE
                    if (m_currentFVRObj != null && IM.HasSpawnedID(m_currentFVRObj.SpawnedFromId))
                    {
                        m_currentItemSpawnerID = IM.GetSpawnerID(m_currentFVRObj.SpawnedFromId);
                    }
#endif
                }
                SpawnerRefreshElements();
            }

            return(m_currentGameObj);
        }
Esempio n. 3
0
        private static bool SpawnItemRelated(ItemSpawnerV2 __instance, int i)
        {
            //If the selected item has a spawner entry, use that
            if (OtherLoader.SpawnerEntriesByID.ContainsKey(__instance.m_selectedID))
            {
                __instance.Boop(1);

                ItemSpawnerData data = __instance.GetComponent <ItemSpawnerData>();
                AnvilManager.Run(SpawnItems(__instance, data.VisibleSecondaryEntries[i]));
            }

            //Otherwise try to use legacy spawner ID
            else if (IM.HasSpawnedID(__instance.m_selectedID))
            {
                return(true);
            }

            else
            {
                __instance.Boop(2);
            }

            return(false);
        }