private void Awake() { // 注册事件 EventDispatcher.Instance.Regist(EventNameDef.EVENT_KEY_BINGO_INDEX, OnEventKeyBingoIndex); EventDispatcher.Instance.Regist(EventNameDef.EVENT_COMBO, OnEventCombo); EventDispatcher.Instance.Regist(EventNameDef.EVENT_PLAY_ANI, OnEventPlayAni); EventDispatcher.Instance.Regist(EventNameDef.EVENT_UPDATE_SCORE, OnEventUpdateScore); EventDispatcher.Instance.Regist(EventNameDef.EVENT_RESTART_GAME, OnEventRestartGame); EventDispatcher.Instance.Regist(EventNameDef.EVENT_GAMEOVER, OnEventGameOver); m_aniCtrler = new CharacterAniCtrler(); m_aniCtrler.Init(anitor); // 开始游戏 StartGame(); }
public PlayerUnit(int playerId, GameObject rootGo, GameObject modelGo, float moveSpeed) { m_playerId = playerId; m_rootGo = rootGo; m_rootTrans = rootGo.transform; m_modelGo = modelGo; m_modelTrans = modelGo.transform; m_moveSpeed = moveSpeed; //动画控制器 var animator = modelGo.GetComponent <Animator>(); m_aniCtrler = new CharacterAniCtrler(); m_aniCtrler.Init(animator); //寻路控制器 m_navAgent = rootGo.AddComponent <NavMeshAgent>(); }