示例#1
0
        public void UpdateGoOutStateInfo(GoOutState info, string id, GoOutStateUpdateMode mode)
        {
            if (GoOutStateUpdateMode.MODE_DELETE == mode)
            {
                if (null == id)
                {
                    return;
                }

                DeleteGoOutStateInfo(id);
            }
            else if (GoOutStateUpdateMode.MODE_INSERT == mode)
            {
                if (null == info)
                {
                    return;
                }

                InsertGoOutStateInfo(info);
            }
            else if (GoOutStateUpdateMode.MODE_UPDATE == mode)
            {
                if (null == info)
                {
                    return;
                }

                UpdateExistsGoOutStateInfo(info);
            }
        }
示例#2
0
    void InitFSM()
    {
        fsm = new FSMSystem();
        FSMState sleepState = new SleepState(fsm);

        sleepState.AddTransition(Transition.Open, StateID.Idle);


        FSMState IdleState = new IdleState(fsm);

        IdleState.AddTransition(Transition.Close, StateID.Sleep);
        IdleState.AddTransition(Transition.SeePlayer, StateID.Patrol);
        IdleState.AddTransition(Transition.Shopping, StateID.GoOut);
        IdleState.AddTransition(Transition.StartPlay, StateID.Play);

        FSMState patrolState = new PatrolState(fsm);

        patrolState.AddTransition(Transition.Open, StateID.Idle);
        patrolState.AddTransition(Transition.SeePlayer, StateID.Chase);


        FSMState chaseState = new ChaseState(fsm);

        chaseState.AddTransition(Transition.LostPlayer, StateID.Patrol);
        chaseState.AddTransition(Transition.FindEnemy, StateID.Bark);

        FSMState barkState = new BarkState(fsm);

        barkState.AddTransition(Transition.LostPlayer, StateID.Patrol);

        FSMState gooutState = new GoOutState(fsm);

        gooutState.AddTransition(Transition.Back, StateID.ComeBack);
        gooutState.AddTransition(Transition.SeePlayer, StateID.Patrol);

        FSMState comebackState = new ComeBackState(fsm);

        comebackState.AddTransition(Transition.Open, StateID.Idle);

        FSMState playState = new PlayState(fsm);

        playState.AddTransition(Transition.Open, StateID.Idle);
        playState.AddTransition(Transition.Close, StateID.Sleep);
        playState.AddTransition(Transition.SeePlayer, StateID.Patrol);
        playState.AddTransition(Transition.Shopping, StateID.GoOut);

        fsm.AddState(sleepState);
        fsm.AddState(IdleState);
        fsm.AddState(patrolState);
        fsm.AddState(chaseState);
        fsm.AddState(barkState);
        fsm.AddState(comebackState);
        fsm.AddState(gooutState);
        fsm.AddState(playState);
    }
示例#3
0
        private void InsertGoOutStateInfo(GoOutState info)
        {
            string sql = "insert into GoOutState(GoOutStateName, GoOutStateSeqNumber, GoOutStateDescribe)";

            sql += " VALUES('{0}', {1}, '{2}')";

            sql = string.Format
                  (
                sql,
                info.GoOutStateName,
                info.GoOutStateSeqNumber,
                info.GoOutStateDescribe
                  );
            SqlOperation.UpdateData(sql);
        }
示例#4
0
        private void UpdateExistsGoOutStateInfo(GoOutState info)
        {
            StringBuilder sqlBuilder = new StringBuilder();

            sqlBuilder.Append("update GoOutState set GoOutStateName = '{0}', GoOutStateSeqNumber = {1}, ");
            sqlBuilder.Append("GoOutStateDescribe = '{2}' where GoOutStateID = {3}");

            string sql = string.Format
                         (
                sqlBuilder.ToString(),
                info.GoOutStateName,
                info.GoOutStateSeqNumber,
                info.GoOutStateDescribe,
                info.GoOutStateID
                         );

            SqlOperation.UpdateData(sql);
        }
示例#5
0
        private void UpdateGoOutStateInfo(GoOutStateUpdateMode mode)
        {
            GoOutState info = new GoOutState()
            {
                GoOutStateName      = this.txtGoOutStateName.Text.ToString().Trim(),
                GoOutStateSeqNumber = Convert.ToInt32(this.txtSequenceNumber.Text),
                GoOutStateDescribe  = this.rtbGoOutStateDescribe.Text.ToString()
            };

            if (GoOutStateUpdateMode.MODE_INSERT == mode)
            {
                objGoOutStateService.UpdateGoOutStateInfo(info, null, mode);
            }

            if (GoOutStateUpdateMode.MODE_UPDATE == mode)
            {
                info.GoOutStateID = Convert.ToInt32(this.Tag);
                objGoOutStateService.UpdateGoOutStateInfo(info, null, mode);
            }
        }