/// <summary>
        /// Creates the object of the template (To get the prefab version use .ToPrefab() after calling this)
        /// </summary>
        public override PlotFrameTemplate Create()
        {
            // Create a base post
            GameObjectTemplate post = new GameObjectTemplate("Post")
                                      .AddChild(new GameObjectTemplate("plotBase",
                                                                       new Create <MeshFilter>((filter) => filter.sharedMesh        = RanchObjects.plotBase),
                                                                       new Create <MeshRenderer>((render) => render.sharedMaterials = RanchObjects.plotBaseMaterials)
                                                                       ))
                                      .AddChild(new GameObjectTemplate("plotPost",
                                                                       new Create <MeshFilter>((filter) => filter.sharedMesh        = RanchObjects.plotPost),
                                                                       new Create <MeshRenderer>((render) => render.sharedMaterials = RanchObjects.plotBaseMaterials),
                                                                       new Create <CapsuleCollider>((col) =>
            {
                col.center    = Vector3.up * 2.3f;
                col.radius    = 0.4455906f;
                col.height    = 4.199063f;
                col.direction = 1;
            })
                                                                       ));

            // Create main object
            mainObject.AddChild(post.Clone("Post 1").SetTransform(new Vector3(4.8f, 0, -4.8f), Vector3.zero, Vector3.one));
            mainObject.AddChild(post.Clone("Post 2").SetTransform(new Vector3(-4.8f, 0, -4.8f), Vector3.up * 90, Vector3.one));
            mainObject.AddChild(post.Clone("Post 3").SetTransform(new Vector3(-4.8f, 0, 4.8f), Vector3.up * 180, Vector3.one));
            mainObject.AddChild(post.Clone("Post 4").SetTransform(new Vector3(4.8f, 0, 4.8f), Vector3.up * 270, Vector3.one));

            return(this);
        }
        /// <summary>
        /// Builds the module for this slime
        /// </summary>
        protected virtual void BuildModule()
        {
            GameObjectTemplate module = new GameObjectTemplate("module" + mainObject.Name);

            module.AddComponents(extras.ToArray());
            module.AddComponents(
                new Create <SlimeEat>((eat) =>
            {
                eat.slimeDefinition    = definition;
                eat.damagePerAttack    = 20;
                eat.EatFX              = EffectObjects.fxSlimeEat;
                eat.EatFavoriteFX      = EffectObjects.fxSlimeFavEat;
                eat.ProduceFX          = EffectObjects.fxSlimeProduce;
                eat.TransformFX        = EffectObjects.fxSlimeTrans;
                eat.minDriveToEat      = driveToEat;
                eat.drivePerEat        = drivePerEat;
                eat.agitationPerEat    = agitPerEat;
                eat.agitationPerFavEat = agitPerFavEat;
            }),
                new Create <ReactToToyNearby>((react) => react.slimeDefinition = definition)
                );

            slimeModule             = module.ToGameObject(null);
            definition.SlimeModules = slimeModule.Group();
        }
Example #3
0
        public GameObjectTemplate Clone(string name = null, bool cloneChildren = false)
        {
            GameObjectTemplate clone = new GameObjectTemplate(name ?? Name, components.ToArray());

            clone.SetTransform(Position, Rotation, Scale);
            clone.SetDebugMarker(DebugMarker);
            clone.Tag   = Tag;
            clone.Layer = Layer;

            foreach (GameObjectTemplate child in children)
            {
                clone.AddChild(cloneChildren ? child.Clone() : child);
            }

            return(clone);
        }
Example #4
0
        /// <summary>
        /// Creates the object of the template (To get the prefab version use .ToPrefab() after calling this)
        /// </summary>
        public override VeggiePlantableTemplate Create()
        {
            // Create main object
            mainObject.AddComponents(
                new Create <SpawnResource>((spawn) =>
            {
                spawn.BonusChance = bonusChance;
                spawn.forceDestroyLeftoversOnSpawn = false;
                spawn.id = resID;
                spawn.MaxActiveSpawns           = 0;
                spawn.MaxObjectsSpawned         = maxSpawn;
                spawn.MaxSpawnIntervalGameHours = maxHours;
                spawn.MaxTotalSpawns            = 0;
                spawn.minBonusSelections        = minBonusSelection;
                spawn.MinNutrientObjectsSpawned = minNutrient;
                spawn.MinObjectsSpawned         = minSpawn;
                spawn.MinSpawnIntervalGameHours = minHours;
                spawn.wateringDurationHours     = waterHours;
                spawn.ObjectsToSpawn            = toSpawn.ToArray();
                spawn.BonusObjectsToSpawn       = bonusToSpawn.ToArray();
            }),
                new Create <BoxCollider>((col) =>
            {
                col.size      = new Vector3(8, 0.1f, 8);
                col.center    = new Vector3(0, 0, 0.1f);
                col.isTrigger = true;
            }),
                new Create <ScaleYOnlyMarker>((scale) => scale.doNotScaleAsReplacement = false)
                ).AddAfterChildren(GrabJoints);

            // Add spawn joints
            for (int i = 0; i < 20; i++)
            {
                mainObject.AddChild(new GameObjectTemplate($"SpawnJoint{(i+1).ToString("00")}",
                                                           new Create <MeshFilter>((filter) => filter.sharedMesh        = GardenObjects.modelMeshs.ContainsKey(ID) ? GardenObjects.modelMeshs[ID] : modelMesh),
                                                           new Create <MeshRenderer>((render) => render.sharedMaterials = GardenObjects.modelMaterials.ContainsKey(ID) ? GardenObjects.modelMaterials[ID] : modelMaterials),
                                                           new Create <Rigidbody>((body) =>
                {
                    body.drag        = 0;
                    body.angularDrag = 0.05f;
                    body.mass        = 1;
                    body.useGravity  = false;
                    body.isKinematic = true;
                }),
                                                           new Create <FixedJoint>(null),
                                                           new Create <HideOnStart>(null)
                                                           ).SetTransform(customSpawnJoints == null ? GardenObjects.spawnJoints[i] : customSpawnJoints[i])
                                    .SetDebugMarker(MarkerType.SpawnPoint)
                                    );
            }

            // Add beds
            GameObjectTemplate sprout = new GameObjectTemplate("Sprout",
                                                               new Create <MeshFilter>((filter) => filter.sharedMesh        = this.sprout ?? (GardenObjects.modelSproutMeshs[sproutID] ?? GardenObjects.modelSproutMeshs[SpawnResource.Id.CARROT_PATCH])),
                                                               new Create <MeshRenderer>((render) => render.sharedMaterials = sproutMaterials == null ? (GardenObjects.modelSproutMaterials[sproutID] ?? GardenObjects.modelSproutMaterials[SpawnResource.Id.CARROT_PATCH]) : sproutMaterials)
                                                               );

            GameObjectTemplate dirt = new GameObjectTemplate("Dirt",
                                                             new Create <MeshFilter>((filter) => filter.sharedMesh        = GardenObjects.dirtMesh),
                                                             new Create <MeshRenderer>((render) => render.sharedMaterials = GardenObjects.dirtMaterials)
                                                             ).AddChild(new GameObjectTemplate("rocks_long",
                                                                                               new Create <MeshFilter>((filter) => filter.sharedMesh        = GardenObjects.rockMesh),
                                                                                               new Create <MeshRenderer>((render) => render.sharedMaterials = GardenObjects.rockMaterials)
                                                                                               )).SetTransform(Vector3.zero, Vector3.up * 90f, new Vector3(0.5f, 0.4f, 0.5f));

            GameObjectTemplate baseBeds = new GameObjectTemplate("BaseBeds");

            for (int i = 0; i < 4; i++)
            {
                (isDeluxe ? baseBeds : mainObject).AddChild(new GameObjectTemplate("Bed",
                                                                                   new Create <LODGroup>((group) =>
                {
                    group.localReferencePoint = Vector3.one * 0.1f;
                    group.size               = 8.657982f;
                    group.fadeMode           = LODFadeMode.None;
                    group.animateCrossFading = false;
                }),
                                                                                   new Create <CapsuleCollider>((col) =>
                {
                    col.center        = new Vector3(0, -0.6f, 0);
                    col.radius        = 0.8f;
                    col.height        = 8;
                    col.direction     = 2;
                    col.contactOffset = 0.01f;
                })
                                                                                   ).SetTransform(GardenObjects.beds[i])
                                                            .AddChild(dirt)
                                                            .AddChild(sprout.Clone().SetTransform(GardenObjects.bedSprouts[0]))
                                                            .AddChild(sprout.Clone().SetTransform(GardenObjects.bedSprouts[1]))
                                                            .AddChild(sprout.Clone().SetTransform(GardenObjects.bedSprouts[2]))
                                                            .AddChild(sprout.Clone().SetTransform(GardenObjects.bedSprouts[3]))
                                                            );
            }

            // Add Deluxe Stuff
            if (isDeluxe)
            {
                mainObject.AddChild(baseBeds);

                // Add spawn joints
                for (int i = 20; i < 34; i++)
                {
                    mainObject.AddChild(new GameObjectTemplate($"SpawnJoint{(i + 1).ToString("00")}",
                                                               new Create <MeshFilter>((filter) => filter.sharedMesh        = GardenObjects.modelMeshs.ContainsKey(ID) ? GardenObjects.modelMeshs[ID] : modelMesh),
                                                               new Create <MeshRenderer>((render) => render.sharedMaterials = GardenObjects.modelMaterials.ContainsKey(ID) ? GardenObjects.modelMaterials[ID] : modelMaterials),
                                                               new Create <Rigidbody>((body) =>
                    {
                        body.drag        = 0;
                        body.angularDrag = 0.05f;
                        body.mass        = 1;
                        body.useGravity  = false;
                        body.isKinematic = true;
                    }),
                                                               new Create <FixedJoint>(null),
                                                               new Create <HideOnStart>(null)
                                                               ).SetTransform(customSpawnJoints == null ? GardenObjects.spawnJoints[i] : customSpawnJoints[i])
                                        .SetDebugMarker(MarkerType.SpawnPoint)
                                        );
                }

                // Add beds
                GameObjectTemplate dirtDeluxe = new GameObjectTemplate("Dirt",
                                                                       new Create <MeshFilter>((filter) => filter.sharedMesh        = GardenObjects.deluxeDirtMesh),
                                                                       new Create <MeshRenderer>((render) => render.sharedMaterials = GardenObjects.deluxeDirtMaterials)
                                                                       ).AddChild(new GameObjectTemplate("rocks_long",
                                                                                                         new Create <MeshFilter>((filter) => filter.sharedMesh        = GardenObjects.deluxeRockMesh),
                                                                                                         new Create <MeshRenderer>((render) => render.sharedMaterials = GardenObjects.deluxeRockMaterials)
                                                                                                         )).SetTransform(Vector3.zero, Vector3.up * 90f, new Vector3(0.5f, 0.3f, 0.5f));

                for (int i = 4; i < 6; i++)
                {
                    mainObject.AddChild(new GameObjectTemplate("Bed",
                                                               new Create <LODGroup>((group) =>
                    {
                        group.localReferencePoint = Vector3.one * 0.1f;
                        group.size               = 8.657982f;
                        group.fadeMode           = LODFadeMode.None;
                        group.animateCrossFading = false;
                    }),
                                                               new Create <ScaleYOnlyMarker>((scale) => scale.doNotScaleAsReplacement = false)
                                                               ).SetTransform(GardenObjects.beds[i])
                                        .AddChild(dirtDeluxe)
                                        .AddChild(sprout.Clone().SetTransform(GardenObjects.bedSprouts[4]))
                                        .AddChild(sprout.Clone().SetTransform(GardenObjects.bedSprouts[5]))
                                        .AddChild(sprout.Clone().SetTransform(GardenObjects.bedSprouts[6]))
                                        );
                }
            }

            return(this);
        }
Example #5
0
 public ModPrefab(string name)
 {
     mainObject = new GameObjectTemplate(name);
 }
        /// <summary>
        /// Creates the object of the template (To get the prefab version use .ToPrefab() after calling this)
        /// </summary>
        public override FashionTemplate Create()
        {
            // Create main object
            mainObject.AddComponents(
                new Create <Identifiable>((ident) => ident.id = ID),
                new Create <Vacuumable>((vac) => vac.size     = vacSize),
                new Create <Rigidbody>((body) =>
            {
                body.drag        = 0;
                body.angularDrag = 0.05f;
                body.mass        = 0.1f;
                body.useGravity  = true;
            }),
                new Create <SphereCollider>((col) =>
            {
                col.center = Vector3.zero;
                col.radius = 0.5f;
            }),
                new Create <CollisionAggregator>(null),
                new Create <RegionMember>((rg) => rg.canHibernate = true),
                new Create <Fashion>((fash) =>
            {
                fash.slot         = slot;
                fash.attachPrefab = attachPrefab;
                fash.attachFX     = EffectObjects.fxFashionApply;
            }),
                new Create <DestroyOnTouching>((dest) =>
            {
                dest.hoursOfContactAllowed = 0;
                dest.wateringRadius        = 0;
                dest.wateringUnits         = 0;
                dest.destroyFX             = EffectObjects.fxFashionBurst;
                dest.touchingWaterOkay     = false;
                dest.touchingAshOkay       = false;
                dest.reactToActors         = false;
                dest.liquidType            = Identifiable.Id.WATER_LIQUID;
            })
                ).SetTransform(Vector3.zero, Vector3.zero, Vector3.one * 0.7f);

            // Create Icon UI content
            GameObjectTemplate imageBack = new GameObjectTemplate("Image Back",
                                                                  new Create <RectTransform>((trans) =>
            {
                trans.anchorMin        = Vector2.zero;
                trans.anchorMax        = Vector2.one;
                trans.anchoredPosition = Vector2.zero;
                trans.sizeDelta        = Vector2.zero;
                trans.pivot            = Vector2.one * 0.5f;
                trans.localEulerAngles = new Vector3(0, 180, 0);
            }),
                                                                  new Create <CanvasRenderer>(null),
                                                                  new Create <Image>((img) =>
            {
                img.sprite         = icon;
                img.overrideSprite = icon;
                img.type           = Image.Type.Simple;
                img.preserveAspect = true;
                img.fillCenter     = true;
                img.fillMethod     = Image.FillMethod.Radial360;
                img.fillAmount     = 1;
                img.fillClockwise  = true;
                img.fillOrigin     = 0;

                img.material = BaseObjects.originMaterial["Digital Icon Medium"];
                img.SetPrivateProperty("preferredWidth", 1024);
                img.SetPrivateProperty("preferredHeight", 1024);
            })
                                                                  );

            GameObjectTemplate image = new GameObjectTemplate("Image",
                                                              new Create <RectTransform>((trans) =>
            {
                trans.anchorMin        = Vector2.zero;
                trans.anchorMax        = Vector2.one;
                trans.anchoredPosition = Vector2.zero;
                trans.sizeDelta        = Vector2.zero;
                trans.pivot            = Vector2.one * 0.5f;
                trans.localEulerAngles = Vector3.zero;
            }),
                                                              new Create <CanvasRenderer>(null),
                                                              new Create <Image>((img) =>
            {
                img.sprite         = icon;
                img.overrideSprite = icon;
                img.type           = Image.Type.Simple;
                img.preserveAspect = true;
                img.fillCenter     = true;
                img.fillMethod     = Image.FillMethod.Radial360;
                img.fillAmount     = 1;
                img.fillClockwise  = true;
                img.fillOrigin     = 0;

                img.material = BaseObjects.originMaterial["Digital Icon Medium"];
                img.SetPrivateProperty("preferredWidth", 1024);
                img.SetPrivateProperty("preferredHeight", 1024);
            })
                                                              );

            GameObjectTemplate iconUI = new GameObjectTemplate("IconUI",
                                                               new Create <RectTransform>((trans) =>
            {
                trans.anchorMin        = Vector2.zero;
                trans.anchorMax        = Vector2.zero;
                trans.anchoredPosition = Vector2.zero;
                trans.sizeDelta        = Vector2.one * 80;
                trans.pivot            = Vector2.one * 0.5f;
                trans.localEulerAngles = new Vector3(0, 180, 0);
                trans.offsetMin        = Vector2.one * -40f;
                trans.offsetMax        = Vector2.one * 40f;
                trans.localScale       = new Vector3(0, 0, 1.3f);
            }),
                                                               new Create <Canvas>((canvas) => canvas.renderMode = RenderMode.WorldSpace),
                                                               new Create <CanvasScaler>((scale) =>
            {
                scale.uiScaleMode         = CanvasScaler.ScaleMode.ConstantPixelSize;
                scale.referenceResolution = new Vector2(800, 600);
                scale.screenMatchMode     = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight;
            })
                                                               ).AddChild(image).AddChild(imageBack);

            // Create Icon Pivot
            mainObject.AddChild(new GameObjectTemplate("Icon Pivot",
                                                       new Create <CameraFacingBillboard>(null)
                                                       ).AddChild(iconUI));

            // Create Surround Sphere
            mainObject.AddChild(new GameObjectTemplate("SurroundSphere",
                                                       new Create <MeshFilter>((filter) => filter.sharedMesh        = BaseObjects.originMesh["plort_shell"]),
                                                       new Create <MeshRenderer>((render) => render.sharedMaterials = BaseObjects.originMaterial["EyeShine"].Group())
                                                       ).SetTransform(Vector3.zero, new Vector3(45, 90, 0), Vector3.one * 0.5f));

            // Create delaunch
            mainObject.AddChild(new GameObjectTemplate("DelaunchTrigger",
                                                       new Create <SphereCollider>((col) =>
            {
                col.center    = Vector3.zero;
                col.radius    = 0.1f;
                col.isTrigger = true;
            }),
                                                       new Create <VacDelaunchTrigger>(null)
                                                       ));

            mainObject.Layer = BaseObjects.layers["Actor"];

            return(this);
        }
Example #7
0
        /// <summary>
        /// Creates the object of the template (To get the prefab version use .ToPrefab() after calling this)
        /// </summary>
        public override FruitPlantableTemplate Create()
        {
            // Create main object
            mainObject.AddComponents(
                new Create <SpawnResource>((spawn) =>
            {
                spawn.BonusChance = bonusChance;
                spawn.forceDestroyLeftoversOnSpawn = false;
                spawn.id = resID;
                spawn.MaxActiveSpawns           = 0;
                spawn.MaxObjectsSpawned         = maxSpawn;
                spawn.MaxSpawnIntervalGameHours = maxHours;
                spawn.MaxTotalSpawns            = 0;
                spawn.minBonusSelections        = minBonusSelection;
                spawn.MinNutrientObjectsSpawned = minNutrient;
                spawn.MinObjectsSpawned         = minSpawn;
                spawn.MinSpawnIntervalGameHours = minHours;
                spawn.wateringDurationHours     = waterHours;
                spawn.ObjectsToSpawn            = toSpawn.ToArray();
                spawn.BonusObjectsToSpawn       = bonusToSpawn.ToArray();
            }),
                new Create <BoxCollider>((col) =>
            {
                col.size      = new Vector3(8, 0.1f, 8);
                col.center    = new Vector3(0, 0, 0.1f);
                col.isTrigger = true;
            })
                ).AddAfterChildren(GrabJoints).AddAfterChildren(SetNetworkNodes);

            if (!isDeluxe)
            {
                mainObject.AddComponents(
                    new Create <ScaleMarker>((scale) => scale.doNotScaleAsReplacement = false)
                    );
            }

            // Add network nodes
            GameObjectTemplate[] droneNetworkNodes = new GameObjectTemplate[4];

            for (int i = 0; i < 4; i++)
            {
                droneNetworkNodes[i] = new GameObjectTemplate($"DroneNetworkNode{(i+1).ToString("00")}",
                                                              new Create <PathingNetworkNode>(null)
                                                              ).AddChild(new GameObjectTemplate("NodeLoc").SetTransform(new Vector3(0, 2, 0), Vector3.zero, Vector3.one).SetDebugMarker(MarkerType.DroneNode))
                                       .AddAfterChildren((obj) => obj.GetComponent <PathingNetworkNode>().nodeLoc = obj.transform.GetChild(0))
                                       .SetTransform(GardenObjects.droneNodes[i]);
            }

            mainObject.AddChild(new GameObjectTemplate("DroneSubnetwork", new Create <GardenDroneSubnetwork>(null))
                                .AddChild(droneNetworkNodes[0])
                                .AddChild(droneNetworkNodes[1])
                                .AddChild(droneNetworkNodes[2])
                                .AddChild(droneNetworkNodes[3])
                                );

            // Add tree
            GameObjectTemplate treeObj = new GameObjectTemplate("tree_bark",
                                                                new Create <MeshFilter>((filter) => filter.sharedMesh        = tree ?? (GardenObjects.modelTreeMeshs[treeID] ?? GardenObjects.modelTreeMeshs[SpawnResource.Id.POGO_TREE])),
                                                                new Create <MeshRenderer>((render) => render.sharedMaterials = treeMaterials ?? GardenObjects.modelTreeMaterials[treeID] ?? GardenObjects.modelTreeMaterials[SpawnResource.Id.POGO_TREE]),
                                                                new Create <MeshCollider>((col) =>
            {
                col.sharedMesh = treeCol ?? (GardenObjects.modelTreeCols[treeID] ?? GardenObjects.modelTreeCols[SpawnResource.Id.POGO_TREE]);
                col.convex     = treeCol == tree;
            })
                                                                ).SetTransform(Vector3.zero, Vector3.zero, customTreeScale ? treeScale : Vector3.one * 0.7f);

            GameObjectTemplate leavesObj = new GameObjectTemplate("leaves_tree",
                                                                  new Create <MeshFilter>((filter) => filter.sharedMesh        = leaves ?? (GardenObjects.modelLeavesMeshs[leavesID] ?? GardenObjects.modelLeavesMeshs[SpawnResource.Id.POGO_TREE])),
                                                                  new Create <MeshRenderer>((render) => render.sharedMaterials = leavesMaterials ?? GardenObjects.modelLeavesMaterials[leavesID] ?? GardenObjects.modelLeavesMaterials[SpawnResource.Id.POGO_TREE]),
                                                                  new Create <MeshCollider>((col) =>
            {
                col.sharedMesh = leavesCol ?? (GardenObjects.modelLeavesCols[leavesID] ?? GardenObjects.modelLeavesCols[SpawnResource.Id.POGO_TREE]);
                col.convex     = leavesCol == leaves;
            })
                                                                  ).SetTransform(leavesPosition, Vector3.zero, customLeavesScale ? leavesScale : Vector3.one);

            if (!isDeluxe)
            {
                mainObject.AddChild(treeObj.AddChild(leavesObj));
            }
            else
            {
                mainObject.AddChild(treeObj.AddComponents(
                                        new Create <ScaleMarker>((scale) => scale.doNotScaleAsReplacement = false)
                                        ).AddChild(leavesObj));
            }

            // Add spawn joints
            for (int i = 0; i < 20; i++)
            {
                mainObject.AddChild(new GameObjectTemplate($"SpawnJoint{(i+1).ToString("00")}",
                                                           new Create <MeshFilter>((filter) => filter.sharedMesh        = GardenObjects.modelMeshs.ContainsKey(ID) ? GardenObjects.modelMeshs[ID] : modelMesh),
                                                           new Create <MeshRenderer>((render) => render.sharedMaterials = GardenObjects.modelMaterials.ContainsKey(ID) ? GardenObjects.modelMaterials[ID] : modelMaterials),
                                                           new Create <Rigidbody>((body) =>
                {
                    body.drag        = 0;
                    body.angularDrag = 0.05f;
                    body.mass        = 1;
                    body.useGravity  = false;
                    body.isKinematic = true;
                }),
                                                           new Create <FixedJoint>(null),
                                                           new Create <HideOnStart>(null)
                                                           ).SetTransform(customSpawnJoints == null ? GardenObjects.treeSpawnJoints[leavesID][i] : customSpawnJoints[i])
                                    .SetDebugMarker(MarkerType.SpawnPoint)
                                    );
            }

            // Add Deluxe Stuff
            if (isDeluxe)
            {
                // Add spawn joints
                for (int i = 20; i < 34; i++)
                {
                    mainObject.AddChild(new GameObjectTemplate($"SpawnJoint{(i + 1).ToString("00")}",
                                                               new Create <MeshFilter>((filter) => filter.sharedMesh        = GardenObjects.modelMeshs.ContainsKey(ID) ? GardenObjects.modelMeshs[ID] : modelMesh),
                                                               new Create <MeshRenderer>((render) => render.sharedMaterials = GardenObjects.modelMaterials.ContainsKey(ID) ? GardenObjects.modelMaterials[ID] : modelMaterials),
                                                               new Create <Rigidbody>((body) =>
                    {
                        body.drag        = 0;
                        body.angularDrag = 0.05f;
                        body.mass        = 1;
                        body.useGravity  = false;
                        body.isKinematic = true;
                    }),
                                                               new Create <FixedJoint>(null),
                                                               new Create <HideOnStart>(null)
                                                               ).SetTransform(customSpawnJoints == null ? GardenObjects.treeSpawnJoints[leavesID][i] : customSpawnJoints[i])
                                        .SetDebugMarker(MarkerType.SpawnPoint)
                                        );
                }

                // Add trees
                mainObject.AddChild(treeObj.Clone().AddComponents(
                                        new Create <ScaleMarker>((scale) => scale.doNotScaleAsReplacement = false)
                                        ).SetTransform(new Vector3(3.8f, 0.8f, -3.8f), new Vector3(0, 225, 0), customTreeScale ? treeDeluxeScale : new Vector3(0.4f, 0.5f, 0.4f))
                                    .AddChild(leavesObj.Clone().SetTransform(leavesDeluxePosition, Vector3.zero, customLeavesScale ? leavesDeluxeScale : new Vector3(1.3f, 0.9f, 1.3f))));

                mainObject.AddChild(treeObj.Clone().AddComponents(
                                        new Create <ScaleMarker>((scale) => scale.doNotScaleAsReplacement = false)
                                        ).SetTransform(new Vector3(-3.8f, 0.8f, 3.8f), new Vector3(0, 45, 0), customTreeScale ? treeDeluxeScale : new Vector3(0.4f, 0.5f, 0.4f))
                                    .AddChild(leavesObj.Clone().SetTransform(leavesDeluxePosition, Vector3.zero, customLeavesScale ? leavesDeluxeScale : new Vector3(1.3f, 0.9f, 1.3f))));
            }

            return(this);
        }
Example #8
0
 public GameObjectTemplate AddChild(GameObjectTemplate template)
 {
     children.Add(template);
     return(this);
 }