public void OnUpdate() { myEnemy.MyAnimatorController.SetTrigger("Patrol"); Rotation(); myEnemy.navMeshAgent.SetDestination(myEnemy.transform.position); remaingTime += Time.deltaTime; if (remaingTime > timerPatrol) { myEnemy.ChangeState(new DefaultState()); } if (Patrol()) { myEnemy.ChangeState(new WalkState()); } }
public void OnUpdate() { rotation += Time.deltaTime; myEnemy.navMeshAgent.SetDestination(myEnemy.player.position); myEnemy.transform.eulerAngles = new Vector3(myEnemy.transform.eulerAngles.x, Mathf.Lerp(myEnemy.transform.eulerAngles.y, myEnemy.player.transform.eulerAngles.y, rotation), myEnemy.transform.eulerAngles.z); if (myEnemy.navMeshAgent.remainingDistance <= myEnemy.AttackRange && myEnemy.navMeshAgent.remainingDistance > 0) { myEnemy.ChangeState(new AttackState()); } }
public void OnUpdate() { myEnemy.MyAnimatorController.SetTrigger("FastWalk"); rotation += Time.deltaTime; myEnemy.navMeshAgent.SetDestination(myEnemy.player.position); Rotation(); if (myEnemy.navMeshAgent.remainingDistance <= myEnemy.AttackRange && myEnemy.navMeshAgent.remainingDistance > 0) { myEnemy.ChangeState(new AttackState()); } }
public void OnUpdate() { rotation += Time.deltaTime; myEnemy.transform.eulerAngles = new Vector3(myEnemy.transform.eulerAngles.x, Mathf.Lerp(myEnemy.transform.eulerAngles.y, myEnemy.nexus.transform.eulerAngles.y, rotation), myEnemy.transform.eulerAngles.z); myEnemy.navMeshAgent.SetDestination(myEnemy.nexus.transform.position); if (myEnemy.MyTarget != null) { myEnemy.navMeshAgent.SetDestination(myEnemy.player.position); myEnemy.ChangeState(new WalkState()); } }
public void OnUpdate() { myEnemy.navMeshAgent.SetDestination(myEnemy.transform.position); Debug.Log("PatrolState"); remaingTime += Time.deltaTime; if (remaingTime > timerPatrol) { myEnemy.ChangeState(new DefaultState()); } if (Patrol()) { myEnemy.ChangeState(new WalkState()); } if (whichside == 1) { myEnemy.transform.Rotate(0, 1f, 0); } else { myEnemy.transform.Rotate(0, -1f, 0); } }
public void OnUpdate() { rotation += Time.deltaTime; myEnemy.navMeshAgent.SetDestination(myEnemy.player.position); myEnemy.transform.eulerAngles = new Vector3(myEnemy.transform.eulerAngles.x, Mathf.Lerp(myEnemy.transform.eulerAngles.y, myEnemy.player.transform.eulerAngles.y, rotation), myEnemy.transform.eulerAngles.z); remaingTime += Time.deltaTime; if (remaingTime > timerAttack) { Attack();//tutaj jest attack na przeciwnika remaingTime = 0; } if (myEnemy.navMeshAgent.remainingDistance > myEnemy.AttackRange + 1) { myEnemy.ChangeState(new PatrolState()); } }
public void OnUpdate() { myEnemy.MyAnimatorController.SetTrigger("DefaultWalk"); rotation += Time.deltaTime; Rotation(); myEnemy.navMeshAgent.SetDestination(myEnemy.nexus.transform.position); if (myEnemy.MyTarget != null) { myEnemy.navMeshAgent.SetDestination(myEnemy.player.position); myEnemy.ChangeState(new WalkState()); } }
public void OnUpdate() { Debug.Log(myEnemy.navMeshAgent.remainingDistance); myEnemy.navMeshAgent.SetDestination(myEnemy.MyTarget.position); rotation += Time.deltaTime; Rotation(); remaingTime += Time.deltaTime; if (remaingTime > timerAttack) { myEnemy.MyAnimatorController.SetTrigger("CanAttack"); Attack();//tutaj jest attack na przeciwnika remaingTime = 0; } if (myEnemy.navMeshAgent.remainingDistance > myEnemy.AttackRange + 1) { myEnemy.ChangeState(new PatrolState()); } }