Пример #1
0
 public Class(int classId)
 {
     // TODO Load from config file
     m_ClassInfo = new ClassInfo()
     {
         movePoint = 9f
     };
     m_MoveConsumption = new MoveConsumption(ClassType.Knight1);
 }
Пример #2
0
        /// <summary>
        /// 获取或创建移动消耗
        /// </summary>
        /// <param name="classType"></param>
        /// <returns></returns>
        public MoveConsumption GetOrCreateMoveConsumption(ClassType classType)
        {
            MoveConsumption consumption;

            if (!m_MoveConsumptions.TryGetValue(classType, out consumption))
            {
                MoveConsumptionInfoConfig config = MoveConsumptionInfoConfig.Get <MoveConsumptionInfoConfig>();
                MoveConsumptionInfo       info   = config[classType];
                if (info == null)
                {
                    Debug.LogErrorFormat(
                        "RoleModel -> MoveConsumption key `{0}` is not found.",
                        classType.ToString());
                    return(null);
                }
                else
                {
                    consumption = new MoveConsumption(info);
                    m_MoveConsumptions.Add(classType, consumption);
                }
            }

            return(consumption);
        }