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

            currentSelectedExplosiveItem  = item;
            currentSelectedProtoExplosive = currentSelectedExplosiveItem?.ProtoItem as IProtoItemExplosive;
            if (currentSelectedProtoExplosive is null)
            {
                // explosive is not selected anymore
                blueprintComponent?.SceneObject.Destroy();
                blueprintComponent = null;
                return;
            }

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

            blueprintComponent.Setup(
                protoStaticWorldObject: currentSelectedProtoExplosive.ObjectExplosiveProto,
                isCancelable: false,
                isRepeatCallbackIfHeld: false,
                isDrawConstructionGrid: true,
                isBlockingInput: false,
                validateCanPlaceCallback: OnValidate,
                placeSelectedCallback: OnPlaceSelected);
        }
コード例 #2
0
 public ProtoItemExplosiveViewModel([NotNull] IProtoItemExplosive explosive) : base(explosive)
 {
 }