Пример #1
0
    public override void Init(BIWContext context)
    {
        base.Init(context);

        lookAtT = new GameObject("BIWGodModeTransform").transform;
        maxDistanceToSelectEntitiesValue = context.godModeDynamicVariablesAsset.maxDistanceToSelectEntities;

        snapFactor = context.godModeDynamicVariablesAsset.snapFactor;
        snapRotationDegresFactor       = context.godModeDynamicVariablesAsset.snapRotationDegresFactor;
        snapScaleFactor                = context.godModeDynamicVariablesAsset.snapScaleFactor;
        snapDistanceToActivateMovement = context.godModeDynamicVariablesAsset.snapDistanceToActivateMovement;

        initialEagleCameraHeight       = context.godModeDynamicVariablesAsset.initialEagleCameraHeight;
        initialEagleCameraDistance     = context.godModeDynamicVariablesAsset.initialEagleCameraDistance;
        initialEagleCameraLookAtHeight = context.godModeDynamicVariablesAsset.initialEagleCameraLookAtHeight;

        snapDragFactor = context.godModeDynamicVariablesAsset.snapDragFactor;

        outlinerController = context.outlinerController;
        gizmoManager       = context.gizmosController;

        if (HUDController.i.builderInWorldMainHud != null)
        {
            HUDController.i.builderInWorldMainHud.OnTranslateSelectedAction      += TranslateMode;
            HUDController.i.builderInWorldMainHud.OnRotateSelectedAction         += RotateMode;
            HUDController.i.builderInWorldMainHud.OnScaleSelectedAction          += ScaleMode;
            HUDController.i.builderInWorldMainHud.OnSelectedObjectPositionChange += UpdateSelectionPosition;
            HUDController.i.builderInWorldMainHud.OnSelectedObjectRotationChange += UpdateSelectionRotation;
            HUDController.i.builderInWorldMainHud.OnSelectedObjectScaleChange    += UpdateSelectionScale;
            HUDController.i.builderInWorldMainHud.OnResetCameraAction            += ResetCamera;
            HUDController.i.builderInWorldMainHud.OnPublishAction += TakeSceneScreenshotForPublish;
        }

        if (context.sceneReferences.cameraController.TryGetCameraStateByType <FreeCameraMovement>(out CameraStateBase cameraState))
        {
            freeCameraController = (FreeCameraMovement)cameraState;
        }
        mouseCatcher     = context.sceneReferences.mouseCatcher;
        avatarRenderer   = context.sceneReferences.playerAvatarController;
        cameraController = context.sceneReferences.cameraController;

        BIWInputWrapper.OnMouseDown   += OnInputMouseDown;
        BIWInputWrapper.OnMouseUp     += OnInputMouseUp;
        BIWInputWrapper.OnMouseUpOnUI += OnInputMouseUpOnUi;
        BIWInputWrapper.OnMouseDrag   += OnInputMouseDrag;

        focusOnSelectedEntitiesInputAction = context.inputsReferencesAsset.focusOnSelectedEntitiesInputAction;
        multiSelectionInputAction          = context.inputsReferencesAsset.multiSelectionInputAction;

        focusOnSelectedEntitiesInputAction.OnTriggered += (o) => FocusOnSelectedEntitiesInput();

        multiSelectionInputAction.OnStarted  += (o) => ChangeSnapTemporaryActivated();
        multiSelectionInputAction.OnFinished += (o) => ChangeSnapTemporaryDeactivated();

        gizmoManager.OnChangeTransformValue      += EntitiesTransfromByGizmos;
        gizmoManager.OnGizmoTransformObjectEnd   += OnGizmosTransformEnd;
        gizmoManager.OnGizmoTransformObjectStart += OnGizmosTransformStart;
    }
    public override void Init(BIWContext context)
    {
        base.Init(context);
        maxDistanceToSelectEntitiesValue = context.firstPersonDynamicVariablesAsset.maxDistanceToSelectEntities;

        snapFactor = context.firstPersonDynamicVariablesAsset.snapFactor;
        snapRotationDegresFactor       = context.firstPersonDynamicVariablesAsset.snapRotationDegresFactor;
        snapScaleFactor                = context.firstPersonDynamicVariablesAsset.snapScaleFactor;
        snapDistanceToActivateMovement = context.firstPersonDynamicVariablesAsset.snapDistanceToActivateMovement;

        scaleSpeed    = context.firstPersonDynamicVariablesAsset.scaleSpeed;
        rotationSpeed = context.firstPersonDynamicVariablesAsset.rotationSpeed;
        distanceFromCameraForNewEntitties = context.firstPersonDynamicVariablesAsset.distanceFromCameraForNewEntitties;

        rotationHold = context.inputsReferencesAsset.firstPersonRotationHold;

        rotationHoldStartDelegate    = (action) => { shouldRotate = true; };
        rotationHoldFinishedDelegate = (action) => { shouldRotate = false; };

        rotationHold.OnStarted  += rotationHoldStartDelegate;
        rotationHold.OnFinished += rotationHoldFinishedDelegate;

        BIWInputWrapper.OnMouseClick += OnMouseClick;
    }
    public override void Init(BIWContext biwContext)
    {
        base.Init(biwContext);

        actionController   = biwContext.actionController;
        modeController     = biwContext.modeController;
        inputWrapper       = biwContext.inputWrapper;
        outlinerController = biwContext.outlinerController;
        entityHandler      = biwContext.entityHandler;

        toggleRedoActionInputAction = biwContext.inputsReferencesAsset.toggleRedoActionInputAction;
        toggleUndoActionInputAction = biwContext.inputsReferencesAsset.toggleUndoActionInputAction;
        multiSelectionInputAction   = biwContext.inputsReferencesAsset.multiSelectionInputAction;

        if (HUDController.i.builderInWorldMainHud != null)
        {
            HUDController.i.builderInWorldMainHud.OnStopInput   += StopInput;
            HUDController.i.builderInWorldMainHud.OnResumeInput += ResumeInput;
        }

        redoDelegate = (action) => RedoAction();
        undoDelegate = (action) => UndoAction();

        toggleRedoActionInputAction.OnTriggered += redoDelegate;
        toggleUndoActionInputAction.OnTriggered += undoDelegate;

        multiSelectionStartDelegate    = (action) => StartMultiSelection();
        multiSelectionFinishedDelegate = (action) => EndMultiSelection();

        BIWInputWrapper.OnMouseClick     += MouseClick;
        BIWInputWrapper.OnMouseClickOnUI += MouseClickOnUI;
        modeController.OnInputDone       += InputDone;

        multiSelectionInputAction.OnStarted  += multiSelectionStartDelegate;
        multiSelectionInputAction.OnFinished += multiSelectionFinishedDelegate;
    }
Пример #4
0
 public void SetUp()
 {
     action = ScriptableObject.CreateInstance <InputAction_Hold>();
 }