void EnemyOutOfRange() //Checks if the enemy is out of range { float dist = Vector3.Distance(transform.position, lookAt.transform.position); if (dist > attackRange * Scalar.rangeScalar) { attackProjector.SetActive(false); state = SummonStates.WAIT; isAttacking = false; } }
public void ChangeStatesBasedOnButtons(string aiState) { if (aiState == "Agressive") { state = SummonStates.AGGRESSIVE; } if (aiState == "Wait") { state = SummonStates.WAIT; } if (aiState == "Passive") { state = SummonStates.PASSIVE; } }
void CheckIfInEnemyIsInRange() { Collider[] col = Physics.OverlapSphere(transform.position, attackRange * Scalar.rangeScalar); foreach (Collider temp in col) { if (temp.GetComponent <EnemyInformation>()) { //look towards that target lookAt = temp.gameObject; state = SummonStates.ATTACK; return; } } Debug.Log("Found nothing"); // state = SummonStates.WAIT; }
void Start() { isDying = false; if (!gameObject.GetComponent <NavMeshAgent>()) { gameObject.AddComponent <NavMeshAgent>(); agent = gameObject.GetComponent <NavMeshAgent>(); } if (!gameObject.GetComponent <TeleGrams>()) { gameObject.AddComponent <TeleGrams>(); tele = gameObject.GetComponent <TeleGrams>(); } summoner = GameObject.FindGameObjectWithTag("Player"); state = SummonStates.WAIT; isRefreshed = false; summon.SummonLevel = GameInformation.PlayerLevel; agent.speed = moveSpeed; }
void HealSummonAiController() { //Because they can only heal, they only need to be able to heal, wait, or follow there summoner GetPercent(); if (percent < 0.9f) { state = SummonStates.HEAL; Debug.Log("Heal"); } else if (percent >= 1) { state = SummonStates.PASSIVE; } if (state == SummonStates.AGGRESSIVE || state == SummonStates.ATTACK) { state = SummonStates.PASSIVE; Debug.Log("Not Heal"); } switch (state) { case SummonStates.PASSIVE: PassiveState(); break; case SummonStates.FOLLOW: PassiveState(); break; case SummonStates.HEAL: HealTarget(); break; case SummonStates.WAIT: Waiting(); break; } }
void HealAndAttackSummonAiController() // <- in this state either the monsters attacks will heal or the monster heals and attacks { if (isAttackHeals) { switch (state) { case SummonStates.FOLLOW: agent.isStopped = false; agent.speed = moveSpeed; FollowState(); break; case SummonStates.PASSIVE: agent.speed = moveSpeed; PassiveState(); break; case SummonStates.WAIT: agent.speed = moveSpeed; Waiting(); break; case SummonStates.AGGRESSIVE: agent.speed = moveSpeed; agent.isStopped = false; AgressiveState(); break; case SummonStates.ATTACK: agent.speed = attackMoveSpeed; agent.isStopped = false; AttackState(); break; } } else { GetPercent(); if (percent < 0.9f) { state = SummonStates.HEAL; Debug.Log("Heal"); } else if (percent >= 1) { state = SummonStates.PASSIVE; } if (state == SummonStates.AGGRESSIVE || state == SummonStates.ATTACK) { state = SummonStates.PASSIVE; Debug.Log("Not Heal"); } switch (state) { case SummonStates.FOLLOW: agent.isStopped = false; agent.speed = moveSpeed; FollowState(); break; case SummonStates.PASSIVE: agent.speed = moveSpeed; PassiveState(); break; case SummonStates.WAIT: agent.speed = moveSpeed; Waiting(); break; case SummonStates.AGGRESSIVE: agent.speed = moveSpeed; agent.isStopped = false; AgressiveState(); break; case SummonStates.ATTACK: agent.speed = attackMoveSpeed; agent.isStopped = false; AttackState(); break; case SummonStates.HEAL: agent.speed = moveSpeed; agent.isStopped = false; HealFire(); break; } } }