public void Init()
        {
            var configPath = SystemPreset.GetConfigPath <HeroCfg>();
            var heroCfgs   = ResourceSys.Instance.LoadAll <HeroCfg>(configPath);

            for (var i = 0; i < heroCfgs.Length; i++)
            {
                heroCfgs[i].BuildDerivedData();
            }

            mHeroCfgs.AddRange(heroCfgs);
            mHeroCfgs.Sort((a, b) =>
            {
                if (a.mId < b.mId)
                {
                    return(-1);
                }
                if (a.mId > b.mId)
                {
                    return(1);
                }
                return(0);
            });

            mIdToHeroCfg = ConfigToolkit.ListToDictionary(heroCfgs, (v) => v.mId);
        }
        protected override void Awake()
        {
            base.Awake();
            mIntToState = ConfigToolkit.ConvertEnumToDic <MoveState>();

            mHero = gameObject.GetComponent <HeroEntity>();

            mNavAgent = gameObject.GetComponent <NavMeshAgent>();

            mNavArrivePos = gameObject.GetOrAdd <NavArrivePosition>();
            mNavArrivePos.SetStop(true);

            mNavTraceTarget = gameObject.GetOrAdd <NavTraceTarget>();
            mNavTraceTarget.SetStop(true);

            mTfArrivePos = gameObject.GetOrAdd <TfArrivePosition>();
            mTfArrivePos.SetStop(true);

            mTfTraceTarget = gameObject.GetOrAdd <TfTraceTarget>();
            mTfTraceTarget.SetStop(true);

            var path    = string.Format("Configs/fsm/{0}", "HeroMoveFSMCfg");
            var jsonStr = ResourceSys.Instance.Load <TextAsset>(path).text;

            mFsm = DCAnimatorToFSM.Instance.Convert(jsonStr, CreateDCFSMState);
        }
Пример #3
0
 protected override void Awake()
 {
     base.Awake();
     mIntToState = ConfigToolkit.ConvertEnumToDic <EnumHeroState>();
 }