public override TResult Build(AssetManagerLoader loader)
        {
            GameObject go       = UnityEngine.Object.Instantiate(_go);
            TResult    trashBin = go.GetComponent <TResult>();

            if (trashBin == null)
            {
                trashBin = go.AddComponent <TResult>();
                if (!ContainsTag("GUID"))
                {
                    throw new Exception("Guid is never set");
                }
            }

            Apply(new BaseObjectContainer <TResult>(loader, trashBin, go));

            // ApplyGroup(BasePathAttachmentLiteral.SetupGroup, dc);
            // ApplyGroup(BasePathAttachmentLiteral.ConfigurationGroup, dc);
            foreach (Renderer componentsInChild in go.GetComponentsInChildren <Renderer>())
            {
                Parkitility.ReplaceWithParkitectMaterial(componentsInChild);
            }

            return(trashBin);
        }
        public TResult Build(AssetManagerLoader loader)
        {
            GameObject go      = Object.Instantiate(_go);
            TResult    balloon = go.GetComponent <TResult>();

            if (balloon == null)
            {
                Balloon cpy = (Balloon)AssetManager.Instance.getPrefab(Prefabs.BalloonRegular);
                balloon                = go.AddComponent <TResult>();
                balloon.pokeSound      = cpy.pokeSound;
                balloon.popSound       = cpy.popSound;
                balloon.popParticlesGO = cpy.popParticlesGO;
            }

            if (balloon.transform.childCount == 0)
            {
                GameObject stringAttachment = new GameObject("String");
                stringAttachment.transform.parent = balloon.transform;
                LineRenderer renderer = stringAttachment.AddComponent <LineRenderer>();
                renderer.positionCount = 2;
                renderer.material      = new Material(Shader.Find("Sprites/Default"));
            }
            Apply(new BaseObjectContainer <TResult>(loader, balloon, go));
            foreach (Renderer componentsInChild in go.GetComponentsInChildren <Renderer>())
            {
                Parkitility.ReplaceWithParkitectMaterial(componentsInChild);
            }

            loader.RegisterObject(balloon);
            return(balloon);
        }
        public TResult Build(AssetManagerLoader loader)
        {
            GameObject go = UnityEngine.Object.Instantiate(_go);

            TResult shop = go.GetComponent <TResult>();

            if (shop == null)
            {
                shop = go.AddComponent <TResult>();
                if (!ContainsTag("GUID"))
                {
                    throw new Exception("GUID is never set");
                }
            }

            Apply(new BaseObjectContainer <TResult>(loader, shop, go));
            foreach (Renderer componentsInChild in go.GetComponentsInChildren <Renderer>())
            {
                Parkitility.ReplaceWithParkitectMaterial(componentsInChild);
            }

            // register shop
            loader.RegisterObject(shop);
            return(shop);
        }
Exemplo n.º 4
0
        private void _loadDoor(Asset asset)
        {
            GameObject go = AssetPackUtilities.LoadAsset <GameObject>(_bundle, asset.Guid);

            if (go == null)
            {
                throw new Exception("Can't find Object:" + asset.Guid);
            }

            WallBuilder <Door> doorBuilder = Parkitility.CreateWall <Door>(go)
                                             .Id(asset.Guid)
                                             .BuildLayerMask(LayerMasks.TERRAIN)
                                             .Price(asset.Price, false)
                                             .DisplayName(asset.Name)
                                             .CustomColor(AssetPackUtilities.ConvertColors(asset.CustomColors, asset.ColorCount))
                                             .BlockRain(asset.BlocksRain)
                                             .HeightChangeDelta(asset.HeightDelta)
                                             .SnapGridToCenter(true)
                                             .OnGrid(true)
                                             .GridSubdivisions(1f)
                                             .Category(asset.Category, asset.SubCategory)
                                             .SeeThrough(asset.SeeThrough);

            if (asset.IsResizable)
            {
                doorBuilder.Resizable(asset.MinSize, asset.MaxSize);
            }

            doorBuilder.Build(_assetManagerLoader);
        }
Exemplo n.º 5
0
        public Trash Build(AssetManagerLoader loader)
        {
            GameObject go    = UnityEngine.Object.Instantiate(_go);
            TResult    trash = go.GetComponent <TResult>();

            if (trash == null)
            {
                trash = go.AddComponent <TResult>();
            }
            Apply(new BaseObjectContainer <TResult>(loader, trash, go));
            foreach (Renderer componentsInChild in go.GetComponentsInChildren <Renderer>())
            {
                Parkitility.ReplaceWithParkitectMaterial(componentsInChild);
            }

            loader.RegisterObject(trash);
            return(trash);
        }
Exemplo n.º 6
0
        public TResult Build(AssetManagerLoader loader)
        {
            GameObject go = Object.Instantiate(_go);

            TResult product = go.GetComponent <TResult>();

            if (product == null)
            {
                product = go.AddComponent <TResult>();
            }

            Apply(new BaseObjectContainer <TResult>(loader, product, go));
            foreach (Renderer componentsInChild in go.GetComponentsInChildren <Renderer>())
            {
                Parkitility.ReplaceWithParkitectMaterial(componentsInChild);
            }

            // register shop
            loader.RegisterObject(product);
            return(product);
        }
        public override TResult Build(AssetManagerLoader loader)
        {
            GameObject go             = UnityEngine.Object.Instantiate(_go);
            TResult    pathAttachment = go.GetComponent <TResult>();

            if (pathAttachment == null)
            {
                pathAttachment = go.AddComponent <TResult>();
                if (!ContainsTag("GUID"))
                {
                    throw new Exception("Guid is never set");
                }
            }

            Apply(new BaseObjectContainer <TResult>(loader, pathAttachment, go));
            foreach (Renderer componentsInChild in go.GetComponentsInChildren <Renderer>())
            {
                Parkitility.ReplaceWithParkitectMaterial(componentsInChild);
            }

            return(pathAttachment);
        }
Exemplo n.º 8
0
        public override void onEnabled()
        {
            if (GameController.Instance != null && GameController.Instance.isCampaignScenario)
            {
                return;
            }

            _assetBundle =
                AssetBundle.LoadFromFile(System.IO.Path.Combine(Parkitility.CurrentModDirectory(), "assetpack"));
            if (_assetBundle == null)
            {
                throw new Exception("Failed to load AssetBundle!");
            }

            var             entertainers       = AssetManager.Instance.getPrefab <Entertainer>(Prefabs.Entertainer);
            EmployeeCostume raptorCostume      = entertainers.costumes.First(k => k.name == "EntertainerCostumeRaptor");
            var             bodyPartsContainer = raptorCostume.bodyPartsMale;

            _entertainerMaterial = bodyPartsContainer.getTorso(0).GetComponentInChildren <Renderer>().sharedMaterial;

            SpriteRenderer pandaSprite = AssetPackUtilities
                                         .LoadAsset <GameObject>(_assetBundle, "c08cc832b55af5f638a6f8c64f6258fb")
                                         .GetComponent <SpriteRenderer>();

            Parkitility.CostumeBuilder()
            .Id("EntertainerPanda-cc65c162")
            .DisplayName("Panda")
            .GuestThoughtAboutCostume("What a cute Panda!")
            .CostumeSprite("panda", Object.Instantiate(pandaSprite.sprite), 50, 50)
            .BodyPartMale(
                Parkitility.CreateBodyPart()
                .AddTorso(_remap(bodyPartsContainer.getTorso(0),
                                 AssetPackUtilities.LoadAsset <GameObject>(_assetBundle, "38c9bccac03f19b6caa53a4c4f656334")))
                .AddHairstyle(_remapHead(AssetPackUtilities.LoadAsset <GameObject>(_assetBundle,
                                                                                   "595f9e3b779740751893aa986ff5ad87")))
                .Build(_assetManagerLoader))
            .MeshAnimations(raptorCostume.meshAnimations)
            .AnimatorController(raptorCostume.animatorController)
            .Register(_assetManagerLoader, entertainers);

            SpriteRenderer tigerSprite = AssetPackUtilities
                                         .LoadAsset <GameObject>(_assetBundle, "8d3a87427a6819f9e9c457c3feef4a56")
                                         .GetComponent <SpriteRenderer>();

            Parkitility.CostumeBuilder()
            .Id("EntertainerTiger-cc65c162")
            .DisplayName("Tiger")
            .GuestThoughtAboutCostume("What a fluffy Tiger!")
            .CostumeSprite("tiger", Object.Instantiate(tigerSprite.sprite), 50, 50)
            .BodyPartMale(
                Parkitility.CreateBodyPart()
                .AddTorso(_remap(bodyPartsContainer.getTorso(0),
                                 AssetPackUtilities.LoadAsset <GameObject>(_assetBundle, "21d83d7233511714f875e57875992cee")))
                .AddHairstyle(_remapHead(AssetPackUtilities.LoadAsset <GameObject>(_assetBundle,
                                                                                   "20bc030acb52b1cb09ada2ed8131cef0")))
                .Build(_assetManagerLoader))
            .MeshAnimations(raptorCostume.meshAnimations)
            .AnimatorController(raptorCostume.animatorController)
            .Register(_assetManagerLoader, entertainers);


            SpriteRenderer kiwiSprite = AssetPackUtilities
                                        .LoadAsset <GameObject>(_assetBundle, "75709b8ccf2c15f3d8ab256f59007800")
                                        .GetComponent <SpriteRenderer>();

            Parkitility.CostumeBuilder()
            .Id("EntertainerKiwi-cc65c162")
            .DisplayName("Kiwi")
            .GuestThoughtAboutCostume("What a strange Bird!")
            .CostumeSprite("kiwi", Object.Instantiate(kiwiSprite.sprite), 50, 50)
            .BodyPartMale(
                Parkitility.CreateBodyPart()
                .AddTorso(_remap(bodyPartsContainer.getTorso(0),
                                 AssetPackUtilities.LoadAsset <GameObject>(_assetBundle, "929ba34d2f0bbd52c99ae3d6097ef25c")))
                .AddHairstyle(_remapHead(AssetPackUtilities.LoadAsset <GameObject>(_assetBundle,
                                                                                   "d6c340003b853f1b29c1012dd6d2baae")))
                .Build(_assetManagerLoader))
            .MeshAnimations(raptorCostume.meshAnimations)
            .AnimatorController(raptorCostume.animatorController)
            .Register(_assetManagerLoader, entertainers);


            SpriteRenderer sodaCanSprite = AssetPackUtilities
                                           .LoadAsset <GameObject>(_assetBundle, "aa9f7adbf9716911691e4fef5506081f")
                                           .GetComponent <SpriteRenderer>();

            Parkitility.CostumeBuilder()
            .Id("EntertainerSoda-cc65c162")
            .DisplayName("Soda Can")
            .CustomColor(new Color(0.92156862f, 0.250980f, 0.1843f))
            .GuestThoughtAboutCostume("Hmmm, Soda!")
            .CostumeSprite("soda", Object.Instantiate(sodaCanSprite.sprite), 50, 50)
            .BodyPartMale(
                Parkitility.CreateBodyPart()
                .AddTorso(_remap(bodyPartsContainer.getTorso(0),
                                 AssetPackUtilities.LoadAsset <GameObject>(_assetBundle, "0bb60bc4c6af4b0ee9717f2e2ae012ae")))
                .Build(_assetManagerLoader))
            .MeshAnimations(raptorCostume.meshAnimations)
            .AnimatorController(raptorCostume.animatorController)
            .Register(_assetManagerLoader, entertainers);

            _assetBundle.Unload(false);
        }
Exemplo n.º 9
0
        private void _loadShop(Asset asset)
        {
            GameObject go = AssetPackUtilities.LoadAsset <GameObject>(_bundle, asset.Guid);

            if (go == null)
            {
                throw new Exception("Can't find Object:" + asset.Guid);
            }

            var builder = Parkitility.CreateProductShop <ProductShop>(go)
                          .DisplayName(asset.Name)
                          .Id(asset.Guid)
                          .Price(asset.Price)
                          .WalkableFlag(Asset.ConvertWalkable(asset.Walkable));

            foreach (var box in AssetPackUtilities.ConvertBoundingBox(asset.BoundingBoxes.ToArray()))
            {
                builder.AddBoundingBox(box);
            }

            foreach (var product in asset.Products)
            {
                GameObject productGo = AssetPackUtilities.LoadAsset <GameObject>(_bundle, product.Guid);
                if (productGo == null)
                {
                    Debug.Log("Can't find product game object for:" + product.Name);
                    continue;
                }

                switch (product.ProductType)
                {
                case ProductType.ON_GOING:
                    var ongoingProductBuilder = Parkitility
                                                .CreateOnGoingProduct <OngoingEffectProduct>(productGo)
                                                .Id(product.Guid)
                                                .DisplayName(product.Name)
                                                .Duration(product.Duration)
                                                .DestroyWhenDepleted(product.DestroyWhenDepleted)
                                                .RemoveFromInventoryWhenDepleted(product.RemoveWhenDepleted)
                                                .TwoHanded(product.IsTwoHanded)
                                                .InterestingToLookAt(product.IsInterestingToLookAt)
                                                .DefaultPrice(product.Price)
                                                .HandSide(ProductShopUtility.ConvertToSide(product.HandSide));

                    foreach (var shopIngredient in product.Ingredients)
                    {
                        _bindIngredients(ongoingProductBuilder.AddIngredient(_assetManagerLoader),
                                         product, shopIngredient);
                    }

                    builder.AddProduct(_assetManagerLoader, ongoingProductBuilder);
                    break;

                case ProductType.BALLOON:
                    Debug.Log(product.Name);
                    var balloonBuilder = Parkitility
                                         .CreateBalloonProduct <Balloon>(productGo)
                                         .Id(product.Guid)
                                         .DisplayName(product.Name)
                                         .DestroyWhenDepleted(false)
                                         .Duration(180)
                                         .DefaultPrice(product.Price)
                                         .DefaultMass(product.DefaultMass)
                                         .DefaultDrag(product.DefaultDrag)
                                         .DefaultAngularDrag(product.DefaultAngularDrag)
                                         .RemoveFromInventoryWhenDepleted(true);

                    if (product.HasCustomColors)
                    {
                        balloonBuilder.CustomColor(
                            AssetPackUtilities.ConvertColors(product.CustomColors, product.ColorCount));
                    }

                    foreach (var shopIngredient in product.Ingredients)
                    {
                        _bindIngredients(balloonBuilder.AddIngredient(_assetManagerLoader),
                                         product, shopIngredient);
                    }

                    builder.AddProduct(_assetManagerLoader, balloonBuilder);
                    break;

                case ProductType.WEARABLE:
                    var wearableProductBuilder = Parkitility
                                                 .CreateWearableProduct <WearableProduct>(productGo)
                                                 .Id(product.Guid)
                                                 .DisplayName(product.Name)
                                                 .TwoHanded(product.IsTwoHanded)
                                                 .InterestingToLookAt(product.IsInterestingToLookAt)
                                                 .DefaultPrice(product.Price)
                                                 .HandSide(ProductShopUtility.ConvertToSide(product.HandSide))
                                                 .TemperaturePreference(
                        ProductShopUtility.ConvertTemperaturePreference(
                            product.TemperaturePreference))
                                                 .SeasonalPreference(
                        ProductShopUtility.ConvertSeasonalPreference(
                            product.SeasonalPreference))
                                                 .BodyLocation(ProductShopUtility.ConvertBodyLocation(product.BodyLocation))
                                                 .HideHair(product.HideHair)
                                                 .HideOnRide(product.HideOnRide);

                    if (product.HasCustomColors)
                    {
                        wearableProductBuilder.CustomColor(
                            AssetPackUtilities.ConvertColors(product.CustomColors, product.ColorCount));
                    }


                    foreach (var shopIngredient in product.Ingredients)
                    {
                        _bindIngredients(wearableProductBuilder.AddIngredient(_assetManagerLoader),
                                         product, shopIngredient);
                    }

                    builder.AddProduct(_assetManagerLoader, wearableProductBuilder);
                    break;

                case ProductType.CONSUMABLE:
                    var consumableBuilder = Parkitility
                                            .CreateConsumableProduct <ConsumableProduct>(productGo)
                                            .Id(product.Guid)
                                            .DisplayName(product.Name)
                                            .TwoHanded(product.IsTwoHanded)
                                            .InterestingToLookAt(product.IsInterestingToLookAt)
                                            .TemperaturePreference(
                        ProductShopUtility.ConvertTemperaturePreference(
                            product.TemperaturePreference))
                                            .ConsumeAnimation(
                        ProductShopUtility.ConvertConsumeAnimation(product.ConsumeAnimation))
                                            .DefaultPrice(product.Price)
                                            .HandSide(ProductShopUtility.ConvertToSide(product.HandSide));

                    GameObject trashGo = AssetPackUtilities.LoadAsset <GameObject>(_bundle, product.TrashGuid);
                    if (trashGo != null)
                    {
                        consumableBuilder.Trash <Trash>(trashGo, _assetManagerLoader)
                        .Id(product.TrashGuid)
                        .Disgust(product.DisgustFactor)
                        .Volume(product.Volume)
                        .CanWiggle(product.CanWiggle);
                    }

                    foreach (var shopIngredient in product.Ingredients)
                    {
                        _bindIngredients(consumableBuilder.AddIngredient(_assetManagerLoader),
                                         product,
                                         shopIngredient);
                    }

                    builder.AddProduct(_assetManagerLoader, consumableBuilder);
                    break;
                }
            }

            builder.Build(_assetManagerLoader);
        }