protected override void Init() { base.Init(); animFSM = base.animFSM as MobAnimFSM; rendererCtrl = this.gameObject.GetComponentInChildrenFast <MobRendererCtrl>(); rendererCtrl.SetLayer(LayerMask.NameToLayer("Preview")); rendererCtrl.Init(actorInfo, fxCtrl); inited_ = true; if (animFSM != null) { animFSM.StartStateMachine(); if (moveFSM != null) { if (moveFSM.isMoving) { animFSM.Move(); } else { animFSM.Idle(); } } animFSM.IdleImmediate(); if (idleAnimName != string.Empty) { InitAnimation(); } } else { GameSys.LogError("怪物" + gameObject.name + "没有动画组件!"); } if (rendererCtrl) { rendererCtrl.Show(true); } }
protected override void Init() { base.Init(); animFSM = base.animFSM as MobAnimFSM; rendererCtrl = this.gameObject.GetComponentInChildrenFast <MobRendererCtrl>(); rendererCtrl.ResetOriginalLayer(LayerMask.NameToLayer("Monster")); rendererCtrl.SetLayer(this.gameObject.layer); if (actorInfo.CurShowDictionary.Count > 0) { rendererCtrl.Init(actorInfo, fxCtrl); } rendererCtrl.OnCombineSuceess += OnCombineSucess; height = actorInfo.Hight; nameHeight = actorInfo.NameHight; MainPlayerFocus = true; beAttackRadius = actorInfo.ColliderRadius; if (headTextCtrl == null) { headTextCtrl = this.gameObject.GetComponent <HeadTextCtrl>(); } if (headTextCtrl == null) { headTextCtrl = this.gameObject.AddComponent <HeadTextCtrl>(); } if (!actorInfo.IsActor) //过场动画演员不展示名字 { UpdateName(); } inited_ = true; if (animFSM != null) { InitAnimation(); if (moveFSM != null) { if (moveFSM.isMoving) { animFSM.Move(); } else { animFSM.Idle(); } } } else { Debug.LogError("怪物" + gameObject.name + "没有动画组件!"); } if (rendererCtrl) { rendererCtrl.Show(false, true); } ActiveBoxCollider(true, actorInfo.ColliderRadius); if (fxCtrl != null) { if (actorInfo.IsBoss) { fxCtrl.DoBossEffect(actorInfo.RingSize, "m_f_006"); } if (actorInfo.IsElite) { fxCtrl.DoBossEffect(actorInfo.RingSize, "zb_qh_dj_005"); } if (actorInfo.IsSedan) { fxCtrl.DoSedanEffect(); } } stateMachine.Start(); }
/// <summary> /// 异步创建协程 by吴江 /// </summary> /// <param name="_isSpawn"></param> /// <returns></returns> IEnumerator CreateAsync(bool _isSpawn) { if (isDummy_ == false) { Debug.LogError("You can only start create Mob in dummy: " + actorInfo.ServerInstanceID); yield break; } Monster mob = null; MobRendererCtrl myRendererCtrl = null; bool failed = false; pendingDownload = Create(actorInfo, delegate(Monster _mob, EResult _result) { if (_result != EResult.Success) { failed = true; return; } mob = _mob; pendingDownload = null; myRendererCtrl = mob.gameObject.GetComponentInChildrenFast <MobRendererCtrl>(); if (myRendererCtrl != null) { myRendererCtrl.Show(false); } }); while (mob == null || mob.inited == false) { if (failed) { yield break; } yield return(null); } pendingDownload = null; if (GameCenter.curGameStage == null) { yield break; } if (!actorInfo.IsAlive) { mob.Dead(true); } if (_isSpawn) { if (moveFSM != null && !moveFSM.isMoving && (ulong)actorInfo.MaxHP == actorInfo.CurHP) { if (fxCtrl != null && actorInfo.BornEffect != string.Empty && actorInfo.BornEffect != null) { //构建中 fxCtrl.DoSpawnEffect(actorInfo.BornEffect); } if (animFSM != null && actorInfo.BornAnim != string.Empty && actorInfo.BornAnim != null) { animFSM.SetCreateAnimationName(actorInfo.BornAnim, null); // animFSM.Creating(); } } } //GetBufInfo(); // 如果是dummy的话,添加buff会无效,因此要在创建好后再请求 mob.isDownloading_ = false; }