예제 #1
0
    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;
        }
    }
예제 #2
0
 public void ChangeStatesBasedOnButtons(string aiState)
 {
     if (aiState == "Agressive")
     {
         state = SummonStates.AGGRESSIVE;
     }
     if (aiState == "Wait")
     {
         state = SummonStates.WAIT;
     }
     if (aiState == "Passive")
     {
         state = SummonStates.PASSIVE;
     }
 }
예제 #3
0
 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;
 }
예제 #4
0
    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;
    }
예제 #5
0
    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;
        }
    }
예제 #6
0
    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;
            }
        }
    }