Beispiel #1
0
        public static void Setup(IItem item, bool isSelected)
        {
            if (!isSelected)
            {
                item = null;
            }

            if (currentSelectedSeedItem == item)
            {
                return;
            }

            currentSelectedSeedItem  = item;
            currentSelectedProtoSeed = currentSelectedSeedItem?.ProtoItem as IProtoItemSeed;
            if (currentSelectedProtoSeed is null)
            {
                // seed is not selected anymore
                blueprintComponent?.SceneObject.Destroy();
                blueprintComponent = null;
                return;
            }

            // seed is selected - create blueprint component
            blueprintComponent ??= Api.Client.Scene.CreateSceneObject("Seed placer helper")
            .AddComponent <ClientComponentObjectPlacementHelper>();

            blueprintComponent.Setup(
                protoStaticWorldObject: currentSelectedProtoSeed.ObjectPlantProto,
                isCancelable: false,
                isRepeatCallbackIfHeld: true,
                isDrawConstructionGrid: true,
                isBlockingInput: false,
                validateCanPlaceCallback: OnValidate,
                placeSelectedCallback: OnPlaceSelected);
        }
Beispiel #2
0
 public ProtoItemSeedViewModel([NotNull] IProtoItemSeed seed) : base(seed)
 {
 }