Пример #1
0
 /// Constructor
 ///
 /// @param localDirector
 ///     The local director owner of the Controller
 ///
 protected Controller(LocalDirector localDirector)
 {
     m_localDirector = localDirector;
     if (m_localDirector != null)
     {
         m_localDirector.GetService <ControllerService>().SubscribeController(this);
     }
 }
Пример #2
0
        /// @param localDirector
        ///     The local director owner of the Controller
        /// @param sceneView
        ///     The view component of the fsm
        ///
        public FSMController(LocalDirector localDirector, FSMView fsmView)
            : base(localDirector)
        {
            m_fsmView = fsmView;
            m_fsmView.Initialise();

            m_fsm = new FSMAnimator();
            m_fsm.Initialise(m_fsmView.FSMAnimator);
        }
Пример #3
0
        /// @param localDirector
        ///     The local director owner of the Controller
        /// @param view
        ///     The view of the scene
        /// @param cameraController
        ///     The camera controller
        ///
        public MainController(LocalDirector localDirector, MainView view)
            : base(localDirector, view)
        {
            m_view = view;

            m_audioService.PlayMusicFadeCross(AudioIdentifiers.k_musicMain);

            m_fsm.RegisterStateCallback(k_stateInit, EnterStateInit, null, null);
            m_fsm.RegisterStateCallback(k_stateIdle, EnterStateIdle, null, ExitStateIdle);
            m_fsm.ExecuteAction(k_actionNext);
        }
Пример #4
0
        /// @param localDirector
        ///     The local director owner of the Controller
        /// @param view
        ///     The view of the scene
        /// @param cameraController
        ///     The camera controller
        ///
        public StartupController(LocalDirector localDirector, StartupView view)
            : base(localDirector, view)
        {
            m_view = view;

            m_saveService = GlobalDirector.Service <SaveService>();

            m_audioService.PlayMusic(AudioIdentifiers.k_musicMain);

            m_fsm.RegisterStateCallback(k_stateLoad, EnterStateLoad, null, null);
            m_fsm.RegisterStateCallback(k_stateOutro, EnterStateOutro, null, null);
            m_fsm.ExecuteAction(k_actionNext);
        }
Пример #5
0
        /// @param localDirector
        ///     The local director owner of the Controller
        /// @param view
        ///     The view of the scene
        /// @param cameraController
        ///     The camera controller
        ///
        public MapController(LocalDirector localDirector, MapView view, CameraController cameraContoller)
            : base(localDirector, view, SceneIdentifiers.k_main)
        {
            m_view             = view;
            m_cameraController = cameraContoller;

            m_popupService = GlobalDirector.Service <PopupService>();

            m_audioService.PlayMusicFadeCross(AudioIdentifiers.k_musicMain);

            m_fsm.RegisterStateCallback(k_stateInit, EnterStateInit, null, null);
            m_fsm.RegisterStateCallback(k_stateIdle, EnterStateIdle, null, ExitStateIdle);
            m_fsm.ExecuteAction(k_actionNext);
        }
Пример #6
0
        /// @param localDirector
        ///     The local director owner of the Controller
        /// @param view
        ///     The view of the scene
        /// @param cameraController
        ///     The camera controller
        ///
        public LevelEditorController(LocalDirector localDirector, LevelEditorView view)
            : base(localDirector, view)
        {
            m_view = view;

            m_popupService = GlobalDirector.Service <PopupService>();
            m_levelService = GlobalDirector.Service <LevelService>();
            m_levelLoader  = GlobalDirector.Service <MetadataService>().GetLoader <LevelData>() as LevelDataLoader;

            m_fsm.RegisterStateCallback(k_stateInit, EnterStateInit, null, null);
            m_fsm.RegisterStateCallback(k_stateLoad, EnterStateLoad, null, null);
            m_fsm.RegisterStateCallback(k_stateIdle, EnterStateIdle, null, ExitStateIdle);
            m_fsm.ExecuteAction(k_actionNext);
        }
Пример #7
0
        /// @param localDirector
        ///     The local director owner of the Controller
        /// @param view
        ///     The view
        ///
        public CameraController(LocalDirector localDirector, CameraView view, BoxCollider2D cameraBounds = null)
            : base(localDirector, view)
        {
            m_view   = view;
            m_origin = m_view.CameraHolder.localPosition;

            if (cameraBounds != null)
            {
                SetScreenBounds(cameraBounds.bounds.min, cameraBounds.bounds.max);
            }

            m_fsm.RegisterStateCallback(k_stateIdle, EnterStateIdle, null, ExitStateIdle);
            m_fsm.RegisterStateCallback(k_statePanning, EnterStatePanning, null, ExitStatePanning);
            m_fsm.RegisterStateCallback(k_stateDragging, EnterStateDragging, null, ExitStateDragging);
            m_fsm.RegisterStateCallback(k_stateDragInertia, EnterStateDragInertia, UpdateStateDragInertia, ExitStateDragInertia);
            m_fsm.ExecuteAction(k_actionIdle);
        }
Пример #8
0
        /// @param localDirector
        ///     The local director owner of the Controller
        /// @param view
        ///     The view of the scene
        /// @param cameraController
        ///     The camera controller
        ///
        public MapNodeController(LocalDirector localDirector, MapNodeView view)
            : base(localDirector, view)
        {
            m_audioService = GlobalDirector.Service <AudioService>();
            m_popupService = GlobalDirector.Service <PopupService>();
            m_levelService = GlobalDirector.Service <LevelService>();

            MapNodeView = view;
            LevelModel  = m_levelService.GetLevelModel(MapNodeView.LevelIndex);
            MapNodeView.SetName(MapNodeView.LevelIndex.ToString());

            m_fsm.RegisterStateCallback(k_stateInit, EnterStateInit, null, null);
            m_fsm.RegisterStateCallback(k_stateIdle, EnterStateIdle, null, ExitStateIdle);
            m_fsm.RegisterStateCallback(k_stateLocked, EnterStateLocked, null, ExitStateLocked);
            m_fsm.RegisterStateCallback(k_stateUnlock, null, null, ExitStateUnlock);
            m_fsm.RegisterStateCallback(k_stateDone, EnterStateDone, null, ExitStateDone);
            m_fsm.ExecuteAction(k_actionNext);
        }
Пример #9
0
        /// @param localDirector
        ///     The local director owner of the Controller
        /// @param view
        ///     The view of the scene
        /// @param cameraController
        ///     The camera controller
        ///
        public LevelController(LocalDirector localDirector, LevelView view)
            : base(localDirector, view, SceneIdentifiers.k_map)
        {
            m_view = view;

            m_tileFactory      = localDirector.GetFactory <TileFactory>();
            m_levelService     = GlobalDirector.Service <LevelService>();
            m_popupService     = GlobalDirector.Service <PopupService>();
            m_objectiveService = localDirector.GetService <ObjectiveService>();

            m_audioService.PlayMusicFadeCross(AudioIdentifiers.k_musicLevel);

            m_fsm.RegisterStateCallback(k_stateInit, EnterStateInit, null, null);
            m_fsm.RegisterStateCallback(k_stateLoad, EnterStateLoad, null, null);
            m_fsm.RegisterStateCallback(k_stateIdle, EnterStateIdle, null, ExitStateIdle);
            m_fsm.RegisterStateCallback(k_stateShuffle, EnterStateShuffle, null, null);
            m_fsm.RegisterStateCallback(k_stateResolve, EnterStateResolve, null, ExitStateResolve);
            m_fsm.RegisterStateCallback(k_stateWin, EnterStateWin, null, null);
            m_fsm.RegisterStateCallback(k_stateLose, EnterStateLose, null, null);
            m_fsm.ExecuteAction(k_actionNext);
        }