コード例 #1
0
        protected override void Build()
        {
            // Load Material
            ModelMat = CreateModelMat();

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            GameObject child = Prefab.FindChild("waxLump_ld");

            child.transform.localScale = ModelScale;

            // Load Components
            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            MeshFilter   filter = child.GetComponent <MeshFilter>();
            MeshRenderer render = child.GetComponent <MeshRenderer>();

            // Setup Components
            body.mass = Mass;
            vac.size  = Size;
            iden.id   = ID;

            filter.sharedMesh     = Mesh;
            render.sharedMaterial = ModelMat;
        }
コード例 #2
0
        // Methods
        protected override void Build()
        {
            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            // Load Components
            Fashion      fash = Prefab.GetComponent <Fashion>();
            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            Image front = Prefab.transform.Find("Icon Pivot/ShopIconUI/Image").GetComponent <Image>();
            Image back  = Prefab.transform.Find("Icon Pivot/ShopIconUI/Image Back").GetComponent <Image>();

            // Setup Components
            fash.slot         = Slot;
            fash.attachPrefab = AttachPrefab ? AttachPrefab : fash.attachPrefab;

            body.mass = Mass;
            vac.size  = Size;
            iden.id   = ID;

            front.sprite = Icon;
            back.sprite  = Icon;
        }
コード例 #3
0
        protected override void Build()
        {
            // Load Material
            ModelMat = CreateModelMat();

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            // Load Components
            MeshFilter   filter = Prefab.GetComponent <MeshFilter>();
            MeshRenderer render = Prefab.GetComponent <MeshRenderer>();
            Rigidbody    body   = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac    = Prefab.GetComponent <Vacuumable>();
            Identifiable iden   = Prefab.GetComponent <Identifiable>();

            BreakOnImpact imp = Prefab.GetComponent <BreakOnImpact>();

            // Setup Components
            filter.sharedMesh     = Mesh;
            render.sharedMaterial = ModelMat;
            body.mass             = Mass;
            vac.size = Size;
            iden.id  = ID;

            imp.minSpawns    = MinSpawn;
            imp.maxSpawns    = MaxSpawn;
            imp.spawnOptions = SpawnOptions;
        }
コード例 #4
0
        protected override void Build()
        {
            // Load Material
            ModelMat = CreateModelMat();

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            // Load Components
            MeshFilter       filter = Prefab.GetComponent <MeshFilter>();
            MeshRenderer     render = Prefab.GetComponent <MeshRenderer>();
            Rigidbody        body   = Prefab.GetComponent <Rigidbody>();
            Vacuumable       vac    = Prefab.GetComponent <Vacuumable>();
            Identifiable     iden   = Prefab.GetComponent <Identifiable>();
            PlortInstability inst   = Prefab.GetComponent <PlortInstability>();

            // Setup Components
            filter.sharedMesh     = Mesh;
            render.sharedMaterial = ModelMat;
            body.mass             = Mass;
            vac.size           = Size;
            iden.id            = ID;
            inst.lifetimeHours = LifetimeHours;
        }
コード例 #5
0
        // Methods
        protected override void Build()
        {
            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            // Load Components
            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            Image front = Prefab.transform.Find("Icon Pivot/Animation Pivot/ShopIconUI/Image").GetComponent <Image>();
            Image back  = Prefab.transform.Find("Icon Pivot/Animation Pivot/ShopIconUI/Image Back").GetComponent <Image>();

            // Setup Components
            body.mass = Mass;
            vac.size  = Size;
            iden.id   = ID;

            front.sprite = Icon;
            back.sprite  = Icon;

            if (DigitalEffect)
            {
                return;
            }

            front.material = null;
            Object.Destroy(back.gameObject);
        }
コード例 #6
0
        private static bool TryConsume_Prefix(Vacuumable @this, ref bool @return)
        {
            @return = false;

            FieldInfo consume = typeof(Vacuumable).GetField("consume", BindingFlags.Instance | BindingFlags.NonPublic);

            if (consume != null)
            {
                Vacuumable.Consume evtConsume = consume.GetValue(@this) as Vacuumable.Consume;
                if (evtConsume != null)
                {
                    evtConsume.Invoke();
                    @return = true;

                    return(false);
                }
            }

            PlayerState  state = SceneContext.Instance.PlayerState;
            Identifiable ident = @this.GetComponent <Identifiable>();

            if (AmmoRegistry.CheckInventoryLocks(ident.id, state.GetAmmoMode()) && state.Ammo.MaybeAddToSlot(ident.id, ident))
            {
                Destroyer.DestroyActor(@this.transform.gameObject, "Vacuumable.consume");

                @return = true;
                return(false);
            }

            return(false);
        }
コード例 #7
0
        protected override void Build()
        {
            // Load Material
            ModelMat = CreateModelMat();

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            GameObject child = Prefab.FindChild("model_pogofruit");

            child.transform.localScale = ModelScale;

            Object.Destroy(Prefab.GetComponent <BoxCollider>());

            // Load Components
            SphereCollider col    = Prefab.AddComponent <SphereCollider>();
            MeshFilter     filter = Prefab.GetComponent <MeshFilter>();
            Rigidbody      body   = Prefab.GetComponent <Rigidbody>();
            Vacuumable     vac    = Prefab.GetComponent <Vacuumable>();
            Identifiable   iden   = Prefab.GetComponent <Identifiable>();

            ResourceCycle cycle = IsPlantable ? Prefab.GetComponent <ResourceCycle>() : null;

            MeshFilter   model  = child.GetComponent <MeshFilter>();
            MeshRenderer render = child.GetComponent <MeshRenderer>();

            // Setup Components
            col.radius        = ModelScale.x;
            filter.sharedMesh = Mesh;
            body.mass         = Mass;
            vac.size          = Size;
            iden.id           = ID;

            if (IsPlantable)
            {
                if (cycle != null)
                {
                    cycle.unripeGameHours    = UnripeGameHours;
                    cycle.ripeGameHours      = RipeGameHours;
                    cycle.edibleGameHours    = EdibleGameHours;
                    cycle.rottenGameHours    = RottenGameHours;
                    cycle.rottenMat          = RottenMat ? RottenMat : cycle.rottenMat;
                    cycle.vacuumableWhenRipe = VacuumableWhenRipe;
                }
            }
            else
            {
                Object.Destroy(Prefab.GetComponent <ResourceCycle>());
            }

            model.sharedMesh      = Mesh;
            render.sharedMaterial = ModelMat;
        }
コード例 #8
0
        protected override void Build()
        {
            // Load Material
            ModelMat = CreateModelMat();

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            GameObject child = Prefab.FindChild("Sphere");

            child.transform.localScale = ModelScale;

            GameObject cPart = child.FindChild("FX Water Glops");

            // Load Components
            Rigidbody         body = Prefab.GetComponent <Rigidbody>();
            Vacuumable        vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable      iden = Prefab.GetComponent <Identifiable>();
            DestroyOnTouching dest = Prefab.GetComponent <DestroyOnTouching>();

            MeshFilter   filter = child.GetComponent <MeshFilter>();
            MeshRenderer render = child.GetComponent <MeshRenderer>();

            ParticleSystemRenderer part = cPart.GetComponent <ParticleSystemRenderer>();

            // Setup Components
            body.mass = Mass;
            vac.size  = Size;
            iden.id   = ID;

            dest.liquidType = ID;
            dest.destroyFX  = PrefabUtils.CopyPrefab(dest.destroyFX);

            filter.sharedMesh     = Mesh;
            render.sharedMaterial = ModelMat;

            part.mesh           = Mesh;
            part.sharedMaterial = ModelMat;

            // Setup After effect
            GameObject cPart2 = dest.destroyFX.FindChild("Water Glops");

            ParticleSystemRenderer part2 = cPart2.GetComponent <ParticleSystemRenderer>();

            part2.mesh           = Mesh;
            part2.sharedMaterial = ModelMat;
        }
コード例 #9
0
        protected override void Build()
        {
            // Load Material
            ModelMat = CreateModelMat();

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            GameObject child = Prefab.FindChild("Body");

            child.transform.localScale = ModelScale;

            GameObject child2 = Prefab.transform.Find("Chickadoo/mesh_body1").gameObject;

            // Load Components
            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            EggActivator       egg   = Prefab.GetComponent <EggActivator>();
            TransformAfterTime trans = Prefab.GetComponent <TransformAfterTime>();

            MeshFilter          model   = child.GetComponent <MeshFilter>();
            SkinnedMeshRenderer mRender = child2.GetComponent <SkinnedMeshRenderer>();

            // Setup Components
            body.mass = Mass;
            vac.size  = Size;
            iden.id   = ID;

            trans.delayGameHours = DelayGameHours;
            trans.options        = Options;

            egg.eggPeriod = EggPeriod;

            model.sharedMesh       = Mesh;
            mRender.sharedMaterial = ModelMat;

            foreach (MeshRenderer render in Prefab.transform.Find("Chickadoo/root").GetComponentsInChildren <MeshRenderer>())
            {
                if (render.sharedMaterial.name.Equals("Chickadoo"))
                {
                    render.sharedMaterial = ModelMat;
                }
            }
        }
コード例 #10
0
        //+ METHODS
        /// <inheritdoc />
        public override void Build(GameObject prefab)
        {
            //? In case of questions, tofu keeps the model object as 'model_pogofruit'
            GameObject model = prefab.FindChild("model_pogofruit");

            model.name = MODEL_BASE_NAME;
            model.transform.localScale = Vector3.one * ModelScale;

            // Manages Collisions
            if (ApplyCollider != null)
            {
                ApplyCollider.Invoke(prefab, this);
            }
            else
            {
                Object.Destroy(prefab.GetComponent <BoxCollider>());
                SphereCollider col = prefab.AddComponent <SphereCollider>();
                col.radius = ModelScale;
            }

            // Loading components
            MeshFilter   filter = prefab.GetComponent <MeshFilter>();
            Rigidbody    body   = prefab.GetComponent <Rigidbody>();
            Vacuumable   vac    = prefab.GetComponent <Vacuumable>();
            Identifiable iden   = prefab.GetComponent <Identifiable>();

            ResourceCycle cycle = prefab.GetComponent <ResourceCycle>();

            MeshFilter   mFilter = model.GetComponent <MeshFilter>();
            MeshRenderer render  = model.GetComponent <MeshRenderer>();

            // Setting up components
            filter.sharedMesh = Mesh;
            body.mass         = Mass;
            vac.size          = VacSize;
            iden.id           = ID;

            cycle.unripeGameHours    = UnripeGameHours;
            cycle.ripeGameHours      = RipeGameHours;
            cycle.edibleGameHours    = EdibleGameHours;
            cycle.rottenGameHours    = RottenGameHours;
            cycle.rottenMat          = RottenMat ?? cycle.rottenMat;
            cycle.vacuumableWhenRipe = VacWhenRipe;

            mFilter.sharedMesh    = Mesh;
            render.sharedMaterial = ModelMat;
        }
コード例 #11
0
        /// <summary>Builds this Item</summary>
        protected override void Build()
        {
            // Load Material
            ModelMat = SRObjects.GetInst <Material>("EchoBlue");
            ModelMat.SetColor(TINT_COLOR, ColorUtils.FromHex("22222222"));
            ModelMat.SetFloat(BRIGHTNESS, 0.1f);
            ModelMat.SetFloat(ANIMATION_SPEED, 0f);

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            GameObject child = Prefab.FindChild("model");

            child.transform.localScale = ModelScale;

            // Load Components
            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            MeshFilter   filter = child.GetComponent <MeshFilter>();
            MeshRenderer render = child.GetComponent <MeshRenderer>();

            // Setup Components
            body.mass = Mass;
            vac.size  = Size;
            iden.id   = ID;

            filter.sharedMesh     = Mesh;
            render.sharedMaterial = ModelMat;

            // Setup Proximity
            Prefab.AddComponent <EffyProximity>();

            // Add Particles
            GameObject part = Object.Instantiate(EffyParticles, Prefab.transform, true);

            part.name = "EffyPart";
            part.transform.localScale = Vector3.one;
        }
コード例 #12
0
        protected override void Build()
        {
            // Load Material
            ModelMat = CreateModelMat();

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            GameObject child = Prefab.FindChild("model");

            child.transform.localScale = ModelScale;

            // Load Components
            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            MeshFilter   filter = child.GetComponent <MeshFilter>();
            MeshRenderer render = child.GetComponent <MeshRenderer>();

            // Setup Components
            body.mass = Mass;
            vac.size  = Size;
            iden.id   = ID;

            filter.sharedMesh     = Mesh;
            render.sharedMaterial = ModelMat;

            // Echo Note
            if (IsNote)
            {
                EchoNote note = Prefab.FindChild("echo_note").GetComponent <EchoNote>();
                note.clip = Clip;
            }
            else
            {
                Object.Destroy(Prefab.FindChild("echo_note"));
            }
        }
コード例 #13
0
        protected override void Build()
        {
            // Get GameObjects
            Prefab = CustomBase != null?PrefabUtils.CopyPrefab(CustomBase) : PrefabUtils.CopyPrefab(BaseItem);

            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale * Definition.PrefabScale;

            // Load Components
            SlimeAppearanceApplicator app = Prefab.GetComponent <SlimeAppearanceApplicator>();
            SlimeVarietyModules       mod = Prefab.GetComponent <SlimeVarietyModules>();
            SlimeEat    eat = Prefab.GetComponent <SlimeEat>();
            SlimeHealth hp  = Prefab.GetComponent <SlimeHealth>();

            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            // Setup Components
            app.SlimeDefinition = Definition;
            app.Appearance      = Definition.AppearancesDefault[0];
            mod.baseModule      = Definition.BaseModule;
            mod.slimeModules    = Definition.SlimeModules;

            eat.slimeDefinition    = Definition;
            eat.minDriveToEat      = MinDriveToEat;
            eat.drivePerEat        = DrivePerEat;
            eat.agitationPerEat    = AgitationPerEat;
            eat.agitationPerFavEat = AgitationPerFavEat;

            hp.maxHealth = Health;

            body.mass = Mass;
            vac.size  = Size;
            iden.id   = ID;

            // Get rid of unneeded components
            Object.Destroy(Prefab.GetComponent <PinkSlimeFoodTypeTracker>());
        }
コード例 #14
0
        protected override void Build()
        {
            // Load Material
            ModelMat = CreateModelMat();

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Name;
            Prefab.transform.localScale = Scale;

            GameObject child = Prefab.FindChild("Body");

            child.transform.localScale = ModelScale;

            GameObject child2 = Prefab.transform.Find("Hen Hen/mesh_body1").gameObject;

            // Load Components
            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            Reproduce rep = Prefab.GetComponent <Reproduce>();
            TransformChanceOnReproduce trans = Prefab.GetComponent <TransformChanceOnReproduce>();

            MeshFilter          model   = child.GetComponent <MeshFilter>();
            SkinnedMeshRenderer mRender = child2.GetComponent <SkinnedMeshRenderer>();

            // Setup Components
            body.mass = Mass;
            vac.size  = Size;
            iden.id   = ID;

            if (IsFemale)
            {
                rep.nearMateId = GameContext.Instance.LookupDirector.GetPrefab(MateID).GetComponent <Identifiable>();

                List <Identifiable> ids = new List <Identifiable>()
                {
                    GameContext.Instance.LookupDirector.GetPrefab(Identifiable.Id.HEN).GetComponent <Identifiable>(),
                    GameContext.Instance.LookupDirector.GetPrefab(Identifiable.Id.PAINTED_HEN).GetComponent <Identifiable>(),
                    GameContext.Instance.LookupDirector.GetPrefab(Identifiable.Id.BRIAR_HEN).GetComponent <Identifiable>(),
                    GameContext.Instance.LookupDirector.GetPrefab(Identifiable.Id.STONY_HEN).GetComponent <Identifiable>(),
                    GameContext.Instance.LookupDirector.GetPrefab(Identifiable.Id.ELDER_HEN).GetComponent <Identifiable>()
                };

                if (DensityIDs != null)
                {
                    foreach (Identifiable.Id id in DensityIDs)
                    {
                        Identifiable toAdd = GameContext.Instance.LookupDirector.GetPrefab(id).GetComponent <Identifiable>();
                        if (!ids.Contains(toAdd))
                        {
                            ids.Add(toAdd);
                        }
                    }
                }

                rep.densityIds            = ids.ToArray();
                rep.childPrefab           = GameContext.Instance.LookupDirector.GetPrefab(ChildID);
                rep.minReproduceGameHours = MinReproduceGameHours;
                rep.maxReproduceGameHours = MaxReproduceGameHours;
            }
            else
            {
                Object.Destroy(rep);
            }

            if (!IsElder)
            {
                trans.transformChance = ElderChance;
                trans.targetPrefab    = GameContext.Instance.LookupDirector.GetPrefab(ElderID);
            }
            else
            {
                Object.Destroy(trans);
            }

            model.sharedMesh       = Mesh;
            mRender.sharedMaterial = ModelMat;

            foreach (MeshRenderer render in Prefab.transform.Find("Hen Hen/root").GetComponentsInChildren <MeshRenderer>())
            {
                if (render.sharedMaterial.name.Equals("HenHen"))
                {
                    render.sharedMaterial = ModelMat;
                }
            }
        }
コード例 #15
0
        /// <summary>Builds this Item</summary>
        protected override void Build()
        {
            //foreach (Identifiable.Id slime in Identifiable.SLIME_CLASS)
            //{
            // Make new Definition
            SlimeDefinition other  = SlimeUtils.GetDefinitionByID(Identifiable.Id.PINK_SLIME);
            SlimeDefinition newDef = Definition.CombineForLargo(other);

            // Translation
            DefTranslation.Add(newDef.IdentifiableId, Regex.Replace(Definition.Name, "(\\B[A-Z])", " $1") + " " + Regex.Replace(other.Name, "(\\B[A-Z])", " $1") + " Largo");

            //if (newDef == null)
            //	continue;

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Definition.Name + other.Name;
            Prefab.transform.localScale = Scale * newDef.PrefabScale;

            // PRIMARY SETUP
            // Load Components
            SlimeAppearanceApplicator app = Prefab.GetComponent <SlimeAppearanceApplicator>();
            SlimeVarietyModules       mod = Prefab.GetComponent <SlimeVarietyModules>();

            // Setup Components
            app.SlimeDefinition = newDef;
            mod.baseModule      = newDef.BaseModule;
            mod.slimeModules    = newDef.SlimeModules;

            mod.Assemble();

            // SECONDARY SETUP
            // Load Components
            SlimeEat    eat = Prefab.GetComponent <SlimeEat>();
            SlimeHealth hp  = Prefab.GetComponent <SlimeHealth>();

            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            // Setup Components
            eat.slimeDefinition    = newDef;
            eat.minDriveToEat      = MinDriveToEat;
            eat.drivePerEat        = DrivePerEat;
            eat.agitationPerEat    = AgitationPerEat;
            eat.agitationPerFavEat = AgitationPerFavEat;

            hp.maxHealth = Health;

            body.mass = Mass;
            vac.size  = Size;
            iden.id   = newDef.IdentifiableId;

            // TERTIARY SETUP
            // Load Components
            SlimeEmotions emot  = Prefab.GetComponent <SlimeEmotions>();
            SlimeEmotions emot2 = BaseItem.GetComponent <SlimeEmotions>();

            emot.initAgitation = emot2.initAgitation;
            emot.initFear      = emot2.initFear;
            emot.initHunger    = emot2.initHunger;

            // Add to Largo List
            Prefabs.Add(newDef.IdentifiableId, Prefab);
            //}
        }