Beispiel #1
0
        /// Start of the Init state
        ///
        private void EnterStateInit()
        {
            // Initialise locations
            MapNodeView focusNode = m_view.Nodes.GetFirst();

            foreach (var nodeView in m_view.Nodes)
            {
                // Create the node controller
                var nodeController = new MapNodeController(m_localDirector, nodeView);
                m_nodes.Add(nodeController);

                if (nodeController.LevelModel != null)
                {
                    if (nodeController.LevelModel.m_nodeState == NodeState.Unlocked)
                    {
                        m_nodeToUnlock = nodeController;
                    }
                    else if (nodeController.LevelModel?.m_nodeState == NodeState.Open)
                    {
                        focusNode = nodeView;
                    }
                }
            }

            // Focus on current level
            m_cameraController.FocusOnTargetWithinBounds(focusNode.transform.position);

            m_fsm.ExecuteAction(k_actionNext);
        }
Beispiel #2
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);
        }