/// <summary> /// /// </summary> public override void StartState() { agent = GetComponent <NavMeshAgent>(); anim = GetComponent <Animator>(); enemyAI = GetComponent <EnemyStormAI>(); if (patrolPositions.Length > 0) { enemyAI.SetTarget(patrolPositions[activePatrolPos]); } animMovingHash = Animator.StringToHash(animMovingTrigger); agent.speed = walkSpeed; }
/// <summary> /// /// </summary> public override void TriggerEnter(Collider col) { if (col.gameObject.tag == "Patrol_position") { activePatrolPos++; if (activePatrolPos == patrolPositions.Length) { activePatrolPos = 0; } enemyAI.SetTarget(patrolPositions[activePatrolPos]); } else if (col.gameObject.tag == "Player_saber") { newState.SetNewState(stateManager.EnemyDying()); } else if (col.gameObject.tag == "Force_lightning") { col.gameObject.GetComponentInParent <ForceLightning>().AddExperience(enemy.GetXP()); newState.SetNewState(stateManager.EnemyDying()); } }