示例#1
0
 private bool CheckOver(AIModel model)
 {
     return(model.Food.Value <= 28 ||
            model.Water.Value <= 28 ||
            model.Energy.Value <= 28 ||
            model.Mood.Value >= 80);
 }
示例#2
0
 private void Init()
 {
     mIsActive             = false;
     mMoveTargetPos        = Vector3.zero;
     mTurnTargetPos        = Vector3.zero;
     Model                 = new AIModel(100, 100, 100, 100, 100, "初来乍到");
     mCurrentMovementState = MovementState.Idle;
     mBornPos              = transform.position;
     mBornQuaternion       = transform.rotation;
     SubscribeUI();
     BuildBehaviorTree();
 }
示例#3
0
        protected override BTNodeStatus OnExcute(IAgent agent, Blackboard bb)
        {
            AIModel model = ((AIEntity)agent).Model;

            if (CheckOver(model))
            {
                HTLogger.Warning("死亡!");
                return(BTNodeStatus.Finished);
            }
            model.Food.Value   += BTExampleConsts.DAILY_FOOD_COST * Time.deltaTime;
            model.Water.Value  += BTExampleConsts.DAILY_WATER_COST * Time.deltaTime;
            model.Energy.Value += BTExampleConsts.DAILY_ENERGY_COST * Time.deltaTime;
            model.Mood.Value   += BTExampleConsts.DAILY_MOOD_COST * Time.deltaTime;
            return(BTNodeStatus.Running);
        }
示例#4
0
        protected override BTNodeStatus OnExcute(IAgent agent, Blackboard bb)
        {
            AIModel model = ((AIEntity)agent).Model;

            if (CheckOver(model))
            {
                HTLogger.Debug("退出吃东西");
                return(BTNodeStatus.Finished);
            }
            model.Food.Value   += BTExampleConsts.FOOD_TO_FOOD * Time.deltaTime;
            model.Water.Value  += BTExampleConsts.FOOD_TO_WATER * Time.deltaTime;
            model.Energy.Value += BTExampleConsts.FOOD_TO_ENERGY * Time.deltaTime;
            model.Mood.Value   += BTExampleConsts.FOOD_TO_MOOD * Time.deltaTime;
            model.Money.Value  += BTExampleConsts.FOOD_TO_MONEY * Time.deltaTime;
            return(BTNodeStatus.Running);
        }
示例#5
0
        protected override bool InternalCondition(IAgent agent, Blackboard bb)
        {
            AIModel model = ((AIEntity)agent).Model;
            bool    ret   = model.Food.Value <= 50 &&
                            model.Water.Value >= 15 &&
                            model.Money.Value >= 20;

            if (ret)
            {
                HTLogger.Debug("通过food检测");
            }
            else
            {
                HTLogger.Debug("未通过food检测");
            }
            return(ret);
        }
示例#6
0
 private bool CheckOver(AIModel model)
 {
     return(model.Food.Value >= 80 ||
            model.Water.Value <= 15 ||
            model.Money.Value <= 5);
 }