public override ResultType Execute()
        {
            if (student == null)
            {
                student = ObjManager.GetObj(RoleId) as Student;
            }
            ResultType resultType = student.IsHungry() ? ResultType.Success : ResultType.Fail;

            return(resultType);
        }
示例#2
0
        public override ResultType Execute()
        {
            if (student == null)
            {
                student = ObjManager.GetObj(RoleId) as Student;
            }
            // 食物足够了
            if (student.FoodEnough())
            {
                return(ResultType.Success);
            }

            student.Cooking(0.5f);
            return(ResultType.Running);
        }
示例#3
0
        public override ResultType Execute()
        {
            if (student == null)
            {
                student = ObjManager.GetObj(RoleId) as Student;
            }
            // 吃饱了
            if (student.IsFull())
            {
                return(ResultType.Success);
            }

            // 吃饭增加能量,减少饭
            student.AddEnergy(0.5f);
            student.ChangeFood(-0.4f);
            return(ResultType.Running);
        }