コード例 #1
0
    public void Init(IBIWOutlinerController outlinerController,
                     IBIWInputHandler inputHandler,
                     IBIWInputWrapper inputWrapper,
                     IBIWPublishController publishController,
                     IBIWCreatorController creatorController,
                     IBIWModeController modeController,
                     IBIWFloorHandler floorHandler,
                     IBIWEntityHandler entityHandler,
                     IBIWActionController actionController,
                     IBIWSaveController saveController,
                     IBIWRaycastController raycastController,
                     IBIWGizmosController gizmosController,
                     InitialSceneReferences sceneReferences)
    {
        projectReferencesAsset           = Resources.Load <BIWProjectReferences>(PROJECT_REFERENCES_PATH);
        godModeDynamicVariablesAsset     = Resources.Load <BIWGodModeDynamicVariables>(GOD_MODE_DYNAMIC_VARIABLE_PATH);
        firstPersonDynamicVariablesAsset = Resources.Load <BIWFirstPersonDynamicVariables>(FIRST_PERSON_DYNAMIC_VARIABLE_PATH);
        inputsReferencesAsset            = Resources.Load <BIWInputsReferences>(INPUTS_PATH);

        this.outlinerController = outlinerController;
        this.inputHandler       = inputHandler;
        this.inputWrapper       = inputWrapper;
        this.publishController  = publishController;
        this.creatorController  = creatorController;
        this.modeController     = modeController;
        this.floorHandler       = floorHandler;
        this.entityHandler      = entityHandler;
        this.actionController   = actionController;
        this.saveController     = saveController;
        this.raycastController  = raycastController;
        this.gizmosController   = gizmosController;
        this.sceneReferences    = sceneReferences;
    }
コード例 #2
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;
    }
コード例 #3
0
    public static BIWContext CreateReferencesControllerWithGenericMocks(params object[] mocks)
    {
        IBIWOutlinerController outliner          = Substitute.For <IBIWOutlinerController>();
        IBIWInputHandler       inputHandler      = Substitute.For <IBIWInputHandler>();
        IBIWInputWrapper       inputWrapper      = Substitute.For <IBIWInputWrapper>();
        IBIWPublishController  publishController = Substitute.For <IBIWPublishController>();
        IBIWCreatorController  creatorController = Substitute.For <IBIWCreatorController>();
        IBIWModeController     modeController    = Substitute.For <IBIWModeController>();
        IBIWFloorHandler       floorHandler      = Substitute.For <IBIWFloorHandler>();
        IBIWEntityHandler      entityHandler     = Substitute.For <IBIWEntityHandler>();
        IBIWActionController   actionController  = Substitute.For <IBIWActionController>();
        IBIWSaveController     saveController    = Substitute.For <IBIWSaveController>();
        IBIWRaycastController  raycastController = Substitute.For <IBIWRaycastController>();
        IBIWGizmosController   gizmosController  = Substitute.For <IBIWGizmosController>();
        InitialSceneReferences sceneReferences   = new InitialSceneReferences();

        foreach (var mock in mocks)
        {
            switch (mock)
            {
            case IBIWOutlinerController oc:
                outliner = oc;
                break;

            case IBIWInputHandler ih:
                inputHandler = ih;
                break;

            case IBIWInputWrapper iw:
                inputWrapper = iw;
                break;

            case IBIWPublishController pc:
                publishController = pc;
                break;

            case IBIWCreatorController cc:
                creatorController = cc;
                break;

            case IBIWModeController mc:
                modeController = mc;
                break;

            case IBIWFloorHandler fh:
                floorHandler = fh;
                break;

            case IBIWEntityHandler eh:
                entityHandler = eh;
                break;

            case IBIWActionController ac:
                actionController = ac;
                break;

            case IBIWSaveController sc:
                saveController = sc;
                break;

            case IBIWRaycastController rc:
                raycastController = rc;
                break;

            case IBIWGizmosController gc:
                gizmosController = gc;
                break;

            case InitialSceneReferences isr:
                sceneReferences = isr;
                break;
            }
        }

        BIWContext context = new BIWContext();

        context.Init(
            outliner,
            inputHandler,
            inputWrapper,
            publishController,
            creatorController,
            modeController,
            floorHandler,
            entityHandler,
            actionController,
            saveController,
            raycastController,
            gizmosController,
            sceneReferences
            );
        return(context);
    }