public override void BindToParkitect(GameObject hider, AssetBundle bundle) { BaseDecorator baseDecorator = DecoratorByInstance <BaseDecorator>(); SeatDecorator seatDecorator = DecoratorByInstance <SeatDecorator>(); ColorDecorator colorDecorator = DecoratorByInstance <ColorDecorator>(); BoundingBoxDecorator boxDecorator = DecoratorByInstance <BoundingBoxDecorator>(); CategoryDecorator categoryDecorator = DecoratorByInstance <CategoryDecorator>(); GameObject gameObject = Instantiate(bundle.LoadAsset <GameObject>(Key));; gameObject.transform.parent = hider.transform; _seat = gameObject.AddComponent <Seating>(); _seat.name = Key; RemapUtility.RemapMaterials(gameObject); baseDecorator.Decorate(gameObject, hider, this, bundle); colorDecorator.Decorate(gameObject, hider, this, bundle); categoryDecorator.Decorate(gameObject, hider, this, bundle); foreach (var box in boxDecorator.BoundingBoxes) { var b = Prefab.AddComponent <BoundingBox>(); b.setBounds(box.Bounds); } AssetManager.Instance.registerObject(_seat); }
public override void BindToParkitect(GameObject hider, AssetBundle bundle) { BaseDecorator baseDecorator = DecoratorByInstance <BaseDecorator>(); GridDecorator gridDecorator = DecoratorByInstance <GridDecorator>(); CategoryDecorator categoryDecorator = DecoratorByInstance <CategoryDecorator>(); ColorDecorator colorDecorator = DecoratorByInstance <ColorDecorator>(); BoundingBoxDecorator boxDecorator = DecoratorByInstance <BoundingBoxDecorator>(); GameObject gameObject = Instantiate(bundle.LoadAsset <GameObject>(Key)); gameObject.transform.parent = hider.transform; _deco = gameObject.AddComponent <Deco>(); _deco.name = Key; _deco.buildOnLayerMask = 4096; _deco.heightChangeDelta = gridDecorator.HeightDelta; _deco.defaultGridSubdivision = gridDecorator.GridSubdivision; _deco.buildOnGrid = gridDecorator.Grid; _deco.defaultSnapToGridCenter = gridDecorator.Snap; _deco.isPreview = true; _deco.isStatic = true; _deco.dontSerialize = true; RemapUtility.RemapMaterials(gameObject); baseDecorator.Decorate(gameObject, hider, this, bundle); colorDecorator.Decorate(gameObject, hider, this, bundle); categoryDecorator.Decorate(gameObject, hider, this, bundle); foreach (var box in boxDecorator.BoundingBoxes) { var b = gameObject.AddComponent <BoundingBox>(); b.setBounds(box.Bounds); } AssetManager.Instance.registerObject(_deco); }