Example #1
0
        protected void State_Attack_Begin(Controller.State PrevState)
        {
            Hero attacker, defender;

            attacker = curHero;
            defender = selectedObj.GetComponent <Hero>();

            if (defender == null)
            {
                var tile = selectedObj.GetComponent <Tile>();

                if (tile != null && tile.actor != null)
                {
                    defender = tile.actor.GetComponent <Hero>();
                }
            }

            GameManager.instance.BeginBattle(attacker, defender);

            // set ui
            UIManager.instance.ShowHUD(UIHUD.InGame_Battle);
            UIManager.instance.CloseHUD(UIHUD.InGame_Normal);

            UIManager.instance.SetSelection(UIWindow.InGame_Status_Attacker, attacker.gameObject);
            UIManager.instance.SetSelection(UIWindow.InGame_Status_Defender, defender.gameObject);
        }
Example #2
0
        private void HandleStateChange(Controller.State obj)
        {
            switch (obj)
            {
            case Controller.State.Stopped:
                m_btnRunPause.Enabled = false;
                m_btnRunPause.Image   = m_imgRun;
                m_btnReset.Enabled    = true;
                m_btnStop.Enabled     = false;
                break;

            case Controller.State.Paused:
                m_btnRunPause.Enabled = true;
                m_btnRunPause.Image   = m_imgRun;
                m_btnReset.Enabled    = true;
                m_btnStop.Enabled     = true;
                break;

            case Controller.State.Ready:
                ((ProgressBar)m_statusStrip.Controls["Progress"]).Value = 0;
                m_btnRunPause.Enabled = true;
                m_btnRunPause.Image   = m_imgRun;
                m_btnReset.Enabled    = true;
                m_btnStop.Enabled     = false;
                break;

            case Controller.State.Running:
                m_btnRunPause.Enabled = true;
                m_btnRunPause.Image   = m_imgPause;
                m_btnReset.Enabled    = true;
                m_btnStop.Enabled     = true;
                break;
            }
        }
Example #3
0
        protected void State_Rotate_End(Controller.State NextState)
        {
            // enable all tile
            Map.instance.EnableAllTiles();
            Map.instance.HideDirGuide();

            SetSelectedObject(null);
        }
Example #4
0
        protected void State_WaitCmd_End(Controller.State NextState)
        {
            // update hero status ui
            UIManager.instance.SetSelection(UIWindow.InGame_Status_Hero, null);

            // enable all tile
            Map.instance.EnableAllTiles();

            UIManager.instance.CloseWindow(UIWindow.InGame_Command);
        }
Example #5
0
        protected void State_Rotate_Begin(Controller.State PrevState)
        {
            // release selected object
            SetSelectedObject(null);

            // enable only 1x1 tiles
            Map.instance.DisableAllTiles();
            Map.instance.EnableRangeTiles(curHero.position, 1);

            // show direction guide ui
            Map.instance.ShowDirGuide(curHero.position);
        }
Example #6
0
        protected void DoEndState(Controller.State NextState)
        {
            if (endStateList == null || endStateList.ContainsKey(_state) == false)
            {
                return;
            }

            MethodInfo method = endStateList[_state];

            if (method != null)
            {
                method.Invoke(this, new object[] { NextState });
            }
        }
Example #7
0
        public void SetState(Controller.State newState, bool bForce = false)
        {
            if (_state == newState && !bForce)
            {
                return;
            }

            var oldState = _state;

            DoEndState(newState);
            _state = newState;
            DoBeginState(oldState);
            coroutine_Update = GetStateFunc();
        }
Example #8
0
        protected void DoBeginState(Controller.State PrevState)
        {
#if UNITY_EDITOR
            Debug.Log("Begin state - " + name + " '" + PrevState.ToString() + "' -> '" + _state.ToString() + "'");
#endif
            if (beginStateList == null || beginStateList.ContainsKey(_state) == false)
            {
                return;
            }

            MethodInfo method = beginStateList[_state];

            if (method != null)
            {
                method.Invoke(this, new object[] { PrevState });
            }
        }
Example #9
0
        protected void State_WaitCmd_Begin(Controller.State PrevState)
        {
            // release selected object
            SetSelectedObject(null);

            curHero = teamHeros[curHeroIndex].GetComponent <Hero>();

            // move camera to current hero position
            GameManager.instance.cameraInput.SetPosition(curHero.transform.position);

            // draw hero point
            Map.instance.SetCurrentHeroGuide(true, curHero.transform.position);

            // update hero status ui
            UIManager.instance.SetSelection(UIWindow.InGame_Status_Hero, curHero.gameObject);

            // enable moveable tile
            Map.instance.DisableAllTiles();
            Map.instance.EnableCanMoveRangeTiles(curHero.position, curHero.moveRange, curHero);
        }
Example #10
0
 protected void State_EndTurn_End(Controller.State NextState)
 {
 }
Example #11
0
 protected void State_EndTurn_Begin(Controller.State PrevState)
 {
     _isTurnEnded = true;
 }
Example #12
0
 protected void State_Attack_End(Controller.State NextState)
 {
     GameManager.instance.EndBattle();
     UIManager.instance.CloseHUD(UIHUD.InGame_Battle);
     UIManager.instance.ShowHUD(UIHUD.InGame_Normal);
 }
Example #13
0
 protected void State_Move_End(Controller.State NextState)
 {
     SetSelectedObject(null);
 }
Example #14
0
 protected void State_Move_Begin(Controller.State PrevState)
 {
     curHero = teamHeros[curHeroIndex].GetComponent <Hero>();
 }
Example #15
0
 protected void State_BeginTurn_Begin(Controller.State PrevState)
 {
 }