public void Decorate(GameObject go, CustomSceneryV1 customScenery)
 {
     if (go.GetComponent<Deco>() != null)
     {
         go.GetComponent<Deco>().defaultGridSubdivision = customScenery.GridSubdivision;
     }
 }
コード例 #2
0
        public void Decorate(GameObject go, CustomSceneryV1 customScenery)
        {
            string type = customScenery.Type;

            switch (type)
            {
                case "deco":
                    (new DecoDecorator()).Decorate(go, customScenery);
                    break;
                case "trashbin":
                    (new TrashBinDecorator()).Decorate(go, customScenery);
                    break;
                case "seating":
                    (new SeatingDecorator()).Decorate(go, customScenery);
                    break;
                case "fence":
                    (new FenceDecorator()).Decorate(go, customScenery);
                    break;
                case "lamp":
                    (new LampDecorator()).Decorate(go, customScenery);
                    break;
                default:
                    Debug.Log(type + "is no valid type");
                    break;
            }
        }
コード例 #3
0
 public void Decorate(GameObject go, CustomSceneryV1 customScenery)
 {
     if (go.GetComponent<Deco>() != null)
     {
         go.GetComponent<Deco>().defaultSnapToGridCenter = customScenery.SnapCenter;
     }
 }
コード例 #4
0
 public void Decorate(GameObject go, CustomSceneryV1 customScenery)
 {
     if (go.GetComponent<Deco>() != null)
     {
         go.GetComponent<Deco>().buildOnGrid = customScenery.BuildOnGrid;
     }
 }
コード例 #5
0
        public void Decorate(GameObject go, CustomSceneryV1 customScenery)
        {
            if (go.GetComponent<BuildableObject>() != null && customScenery.Recolorable)
            {
                CustomColors cc = go.AddComponent<CustomColors>();
                
                cc.setColors(customScenery.Colors);

                foreach (Material material in AssetManager.Instance.objectMaterials)
                {
                    if (material.name == "CustomColorsDiffuse")
                    {
                        SetMaterial(go, material);

                        // edge case for fences
                        Fence fence = go.GetComponent<Fence>();

                        if (fence != null)
                        {
                            if (fence.flatGO != null)
                            {
                                SetMaterial(fence.flatGO, material);
                            }

                            if (fence.postGO != null)
                            {
                                SetMaterial(fence.postGO, material);
                            }
                        }

                        break;
                    }
                }
            }
        }
コード例 #6
0
        public void Decorate(GameObject go, CustomSceneryV1 customScenery)
        {
            go.AddComponent<Deco>();

            if (Math.Abs(customScenery.HeightDelta) > 0.01f)
                (new HeightDecorator()).Decorate(go, customScenery);

            if (Math.Abs(customScenery.GridSubdivision) > 0.01f)
                (new GridDecorator()).Decorate(go, customScenery);

            if (Math.Abs(customScenery.GridSubdivision) > 0.01f)
                (new GridSubdivisionDecorator()).Decorate(go, customScenery);

            if (customScenery.SnapCenter)
                (new SnapToCenterDecorator()).Decorate(go, customScenery);
        }
コード例 #7
0
        public void Decorate(GameObject go, CustomSceneryV1 customScenery)
        {
            go.AddComponent<Fence>();
            
            if (customScenery.FenceFlat != null)
            {
                go.GetComponent<Fence>().flatGO = customScenery.FenceFlat;
            }
            
            if (customScenery.FencePost != null)
            {
                go.GetComponent<Fence>().postGO = customScenery.FencePost;
            }

            go.GetComponent<Fence>().hasMidPosts = false;
        }
コード例 #8
0
 public void Decorate(GameObject go, CustomSceneryV1 customScenery)
 {
     go.AddComponent<TrashBin>();
 }
コード例 #9
0
 public void Decorate(GameObject go, CustomSceneryV1 customScenery)
 {
     go.AddComponent<Seating>();
     go.GetComponent<Seating>().hasBackRest = customScenery.HasBackRest;
 }
コード例 #10
0
 public void Decorate(GameObject go, CustomSceneryV1 customScenery)
 {
     go.GetComponent<BuildableObject>().setDisplayName(customScenery.Name);
     go.name = customScenery.Name;
 }
コード例 #11
0
 public void Decorate(GameObject go, CustomSceneryV1 customScenery)
 {
     go.AddComponent<PathAttachment>();
 }
コード例 #12
0
 public void Decorate(GameObject go, CustomSceneryV1 customScenery)
 {
     go.GetComponent<BuildableObject>().price = customScenery.Price;
 }
コード例 #13
0
 public void Decorate(GameObject go, CustomSceneryV1 customScenery)
 {
     go.GetComponent<Deco>().heightChangeDelta = customScenery.HeightDelta;
 }