Esempio n. 1
0
        public CameraController(UnityEngine.Camera camera, ITinyMessengerHub messengerHub, ILogger logger, IStore store)
        {
            this.camera       = camera;
            this.messengerHub = messengerHub;
            this.logger       = PrefixedLogger.ForType <CameraController>(logger);

            var transform = camera.transform;

            cameraPivot = transform.parent;

            defaultPosition = transform.position;
            defaultRotation = transform.rotation.eulerAngles;

            context = new StateContext(this.logger, store);

            context.TransitionTo(
                new WaitingForDragState(context,
                                        messengerHub,
                                        this.logger,
                                        camera));

            context.Disable();

            spinSubscriptionToken = messengerHub.Subscribe <SpinCamera360Message>(OnSpinRequested);

            enableDisableSubscriptionToken = messengerHub.Subscribe <EnableCameraControlMessage>(EnableControl);

            resetPositionSubscriptionToken = messengerHub.Subscribe <ResetCameraMessage>(Reset);

            orbitSubscriptionToken = messengerHub.Subscribe <CameraOrbitRequestMessage>(Orbit);
        }
Esempio n. 2
0
        public GameStateController(ITinyMessengerHub messengerHub, ILogger logger, IStore store)
        {
            var prefixedLogger = PrefixedLogger.ForType <GameStateController>(logger);

            context = new StateContext(prefixedLogger, store);

            context.TransitionTo(new MainMenuState(context, messengerHub, logger, IoC.Resolve <IRubiksCubeFactory>()));
        }
Esempio n. 3
0
        public CommandHandler(ITinyMessengerHub messengerHub, ILogger logger, ICommandExecutor executor)
        {
            this.logger       = PrefixedLogger.ForType <CommandHandler>(logger);
            this.messengerHub = messengerHub;
            this.executor     = executor;

            commandHistory = new Stack <IUndoableCommand>();
            undoHistory    = new Stack <IUndoableCommand>();

            enqueueSubscriptionToken = messengerHub.Subscribe <EnqueueCommandMessage>(HandleEnqueueMessage);
            undoSubscriptionToken    = messengerHub.Subscribe <UndoCommandMessage>(m => UndoLast());
            redoSubscriptionToken    = messengerHub.Subscribe <RedoCommandMessage>(m => RedoLast());
        }
Esempio n. 4
0
 public RubiksCube()
 {
     logger = PrefixedLogger.ForType <RubiksCube>(new UnityConsoleLogger());
     proto  = GameObject.CreatePrimitive(PrimitiveType.Cube);
     proto.SetActive(false);
 }