Exemplo n.º 1
0
        public override IEnumerator GetGameObjectAsync(IOut <GameObject> gameObject)
        {
            IPrefabRequest request = PrefabDatabase.GetPrefabForFilenameAsync("WorldEntities/Alterra/DataBoxes/BeaconDataBox.prefab");

            yield return(request);

            request.TryGetPrefab(out GameObject prefab);

            GameObject obj = GameObject.Instantiate(prefab);

            obj.name = ClassID;
            obj.SetActive(false);

            obj.GetComponent <PrefabIdentifier>().classId = this.ClassID;

            BlueprintHandTarget blueprintHandTarget = obj.GetComponent <BlueprintHandTarget>();

            blueprintHandTarget.alreadyUnlockedTooltip = this.alreadyUnlockedTooltip;
            blueprintHandTarget.primaryTooltip         = this.primaryTooltip;
            blueprintHandTarget.secondaryTooltip       = this.secondaryTooltip;
            blueprintHandTarget.unlockTechType         = this.unlockTechType;

            obj.SetActive(true);

            gameObject.Set(obj);
        }
Exemplo n.º 2
0
        internal static void PostFix(ref ResourceTracker __instance)
        {
            bool isDataBox = __instance.overrideTechType == TechType.Databox || __instance.techType == TechType.Databox;

            if (!isDataBox)
            {
                return; // Not a data box, early exit
            }
            BlueprintHandTarget blueprint = __instance.GetComponentInParent <BlueprintHandTarget>();

            if (blueprint == null)
            {
                return; // safety check, but shouldn't happen
            }
            if (!blueprint.used)
            {
                return;                   // blueprint still unused
            }
            __instance.OnBreakResource(); // call this to invoke the "Unregister" method
        }
Exemplo n.º 3
0
        public override GameObject GetGameObject()
        {
            var path   = "WorldEntities/Environment/DataBoxes/CompassDataBox";
            var prefab = Resources.Load <GameObject>(path);
            var obj    = GameObject.Instantiate(prefab);

            obj.name = ClassID;
            obj.SetActive(false);
            prefab.SetActive(false);
            obj.GetComponent <PrefabIdentifier>().ClassId = this.ClassID;

            BlueprintHandTarget blueprintHandTarget = obj.GetComponent <BlueprintHandTarget>();

            blueprintHandTarget.alreadyUnlockedTooltip = this.alreadyUnlockedTooltip;
            blueprintHandTarget.primaryTooltip         = this.primaryTooltip;
            blueprintHandTarget.secondaryTooltip       = this.secondaryTooltip;
            blueprintHandTarget.unlockTechType         = this.unlockTechType;

            obj.SetActive(true);
            return(obj);
        }
        internal static bool PreFix(ref BlueprintHandTarget __instance)
        {
            __instance.SendMessage("OnBreakResource", null, SendMessageOptions.DontRequireReceiver);

            return(true);
        }