Пример #1
0
        public JingJiChangInstance(GameClient player, Robot robot, int fubenSeqId)
        {
            this.state      = JingJiFuBenState.INITIALIZED;
            this.fubenSeqId = fubenSeqId;

            this.player = player;
            this.robot  = robot;

            this.createTime  = TimeUtil.NOW();
            this.startCDTime = this.createTime + DelayStart;

            ResetJingJiTime();
        }
Пример #2
0
        /// <summary>
        /// 切换状态
        /// </summary>
        /// <param name="state"></param>
        public void switchState(JingJiFuBenState state)
        {
            if (this.state == state)
            {
                return;
            }

            this.state = state;

            switch ((int)state)
            {
            case (int)JingJiFuBenState.INITIALIZED:
                break;

            case (int)JingJiFuBenState.WAITING_CHANGEMAP_FINISH:
                break;

            case (int)JingJiFuBenState.START_CD:
                JingJiChangManager.getInstance().onJingJiFuBenStartCD(this);
                break;

            case (int)JingJiFuBenState.STARTED:
                JingJiChangManager.getInstance().onJingJiFuBenStarted(this);
                break;

            case (int)JingJiFuBenState.STOP_CD:
                this.stopedTime  = TimeUtil.NOW() + StopCDTime;
                this.destroyTime = this.stopedTime + DelayDestroyTime;
                break;

            case (int)JingJiFuBenState.STOP_TIMEOUT_CD:
                JingJiChangManager.getInstance().onJingJiFuBenStopForTimeOutCD(this);
                this.switchState(JingJiFuBenState.STOP_CD);
                break;

            case (int)JingJiFuBenState.STOPED:
                JingJiChangManager.getInstance().onJingJiFuBenStoped(this);
                this.destroyTime = TimeUtil.NOW() + DelayDestroyTime;
                break;

            case (int)JingJiFuBenState.DESTROYED:
                JingJiChangManager.getInstance().onJingJiFuBenDestroy(this);
                break;
            }
        }
Пример #3
0
        public void switchState(JingJiFuBenState state)
        {
            if (this.state != state)
            {
                this.state = state;
                switch (state)
                {
                case JingJiFuBenState.START_CD:
                    JingJiChangManager.getInstance().onJingJiFuBenStartCD(this);
                    break;

                case JingJiFuBenState.STARTED:
                    JingJiChangManager.getInstance().onJingJiFuBenStarted(this);
                    break;

                case JingJiFuBenState.STOP_CD:
                    this.stopedTime  = TimeUtil.NOW() + JingJiChangInstance.StopCDTime;
                    this.destroyTime = this.stopedTime + JingJiChangInstance.DelayDestroyTime;
                    break;

                case JingJiFuBenState.STOP_TIMEOUT_CD:
                    JingJiChangManager.getInstance().onJingJiFuBenStopForTimeOutCD(this);
                    this.switchState(JingJiFuBenState.STOP_CD);
                    break;

                case JingJiFuBenState.STOPED:
                    JingJiChangManager.getInstance().onJingJiFuBenStoped(this);
                    this.destroyTime = TimeUtil.NOW() + JingJiChangInstance.DelayDestroyTime;
                    break;

                case JingJiFuBenState.DESTROYED:
                    JingJiChangManager.getInstance().onJingJiFuBenDestroy(this);
                    break;
                }
            }
        }