private void Start() { nma = GetComponent <NavMeshAgent>(); //playerTransform = GameManager.gameMng.controllingMngs[0].actorController.transform; nma.updatePosition = false; nma.updateRotation = false; armLenght = ac.GetActorParts().GetMuscleGroup(HumanoidParts.MucleGroupIndex.RHAND).muscleLength; nma.stoppingDistance = armLenght * 2.5f; minDist = 2 * armLenght; maxDist = 4 * armLenght; MessageManager.AddListener <Global.HandAction>("HandStateChange", OnHandStateChange, transform); fs = EnemyFS.READY; resetSkillC = StartCoroutine(resetSkill()); }
private void Attack() { if (am.state.HandAction == Global.HandAction.FREE && canAttack) // 开始 { FacePlayer(); ac.AttackT(JudgeAttackType()); canAttack = false; } else if (am.state.HandAction == Global.HandAction.SLASH) { // on FacePlayer(0.1f); } else { // 结束 FacePlayer(); fs = EnemyFS.READY; } }
/// <summary> /// 由于判断 和玩家之间的 距离 /// </summary> /// <returns>改變是否发生了改变</returns> private bool JudgeDist() { distance = Vector3.Distance(playerTransform.position, transform.position); EnemyFS former = fs; if (distance >= maxDist) { fs = EnemyFS.APPROCHING; } else if (distance <= minDist) { fs = EnemyFS.KEEPAWAY; } else { fs = EnemyFS.READY; } return(former != fs); }
private void Skill() { if (am.state.BodyAction == Global.BodyAction.GROUND && canSkill) // 开始 { FacePlayer(); ac.skillName = JudgeSkillType(); ac.Skill(); canSkill = false; canAttack = false; } else if (am.state.BodyAction == Global.BodyAction.SKILL) { // on //FacePlayer(0.01f); } else { // 结束 FacePlayer(); fs = EnemyFS.READY; } }
private void Ready() { if (FacePlayer() || JudgeDist()) { nma.velocity = Vector3.zero; return; } else { fomerVel = Vector3.MoveTowards(fomerVel, Vector3.zero, 0.05f); ac.Move(fomerVel); if (canSkill) { fs = EnemyFS.SKILL; } else if (canAttack) { fs = EnemyFS.ATTACK; } } }