public bool IsDeath() { //对战不能死亡 if (CoreEntry.IsMobaGamePlay()) { return(false); } if (m_actor == null) { return(true); } return(m_actor.IsDeath()); }
public float moveToTargetBySpeed(Transform targetTransform, float speed = 10) { if (CoreEntry.IsMobaGamePlay()) { speed = 22; } float time; Vector3 dist = targetTransform.position - mLastCameraPosition; float distLen = dist.magnitude; if (speed < 0.001) { time = 0.001f; } else { time = distLen / speed; } moveToTarget(targetTransform, time); return(time); }
public behaviac.EBTStatus PlayerAutoMove() { if (!CoreEntry.GameStart || (CoreEntry.IsMobaGamePlay())) { return(behaviac.EBTStatus.BT_FAILURE); } //if (CoreEntry.gGameMgr.AutoFight) //{ // if (CoreEntry.gActorMgr.MainPlayer.m_bUseAI == false) // { // return behaviac.EBTStatus.BT_FAILURE; // } //} ActorObj playerObj = m_actor; float distance = 0.0f; m_AttackObj = m_actor.GetAttackObj(); if (m_AttackObj) { distance = Vector3.Distance(m_transform.position, m_AttackObj.transform.position); if (distance < fMonsterMinDist) { playerObj.StopMove(true); return(behaviac.EBTStatus.BT_SUCCESS); } } if (!ArenaMgr.Instance.IsArenaFight) { if (m_AttackObj) { playerObj.StopMove(true); nSkillIndex = 0; return(behaviac.EBTStatus.BT_FAILURE); } } else { if (m_AttackObj) { m_AutoNavPos = m_AttackObj.transform.position; } } //主角寻路超时设定,防止后面停止不动 if (IsRunningTimeOut()) { Debug.LogWarning("Main Player is running time out..."); return(behaviac.EBTStatus.BT_FAILURE); } //目标没改变,且run状态,不处理 if (m_movePos.Equals(m_AutoNavPos) && m_actor.curActorState == ACTOR_STATE.AS_RUN) { return(behaviac.EBTStatus.BT_RUNNING); } m_actor.FaceTo(m_AutoNavPos); if (m_actorObject.MoveToPos(m_AutoNavPos)) { m_movePos = m_AutoNavPos; } return(behaviac.EBTStatus.BT_RUNNING); }
//private GameObject m_cylinderObj = null; public override void OnEnter(ActorObj actorBase) { m_state = ACTOR_STATE.AS_ENTER; m_actor = actorBase; string enterAction = m_actor.enterAction; ////删除挂点 //Transform cylinderTransform = this.gameObject.transform.FindChild("Cylinder002"); //if (cylinderTransform != null) //{ // m_cylinderObj = cylinderTransform.gameObject; // m_cylinderObj.active = true; //} float endTime = m_actor.GetActionLength(enterAction); //if (endTime > 0.5f) //{ // endTime = endTime - 0.2f; //} if (enterAction == "stand") { endTime = 0.5f; } if (endTime == 0) { endTime = 0.5f; } m_actor.PlayAction(enterAction, false); //播放特效 string enterEfx = "";// m_actor.actorCreatureDisplayDesc.enterEfx; if (CoreEntry.IsMobaGamePlay() == false && enterEfx != "") { if (m_actor.mActorType == ActorType.AT_MONSTER || m_actor.mActorType == ActorType.AT_MECHANICS) { enterEfx = "Effect/skill/remain/fx_xiaobingchuxian01"; } if (m_actor.mActorType == ActorType.AT_BOSS) { enterEfx = "Effect/skill/remain/fx_bosschuxian"; } if (enterEfx.Length > 0) { GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(enterEfx); //GameObject efxObj = (GameObject)Instantiate(CoreEntry.gResLoader.LoadResource(enterEfx));//CoreEntry.gGameObjPoolMgr.InstantiateEffect(enterEfx); if (efxObj != null) { SceneEfxPool efx = null; if (efxObj) { efx = efxObj.GetComponent <SceneEfxPool>(); } if (efx == null) { efx = efxObj.AddComponent <SceneEfxPool>(); } efx.Init(m_actor.transform.position, endTime); } } } //无敌状态,受击没反映 float immuneTime = endTime; //if (m_actor.actorCreatureDisplayDesc.enterImmuneKeepTime > 0) //{ // immuneTime = m_actor.actorCreatureDisplayDesc.enterImmuneKeepTime; //} m_actor.RecoverHealth(immuneTime); //硬直状态,自己不能切换状态 m_isNonControl = true; Invoke("EndEnterState", endTime); //去掉碰撞 m_actor.CancelCollider(); }