예제 #1
0
    void SearchForFireballs()
    {
        if (fireballs.Length > 0)
        {
            foreach (Fireball f in fireballs)
            {
                float range = 1.0f;

                Survivor_AI sAI = FindClosestSurvivorToFireBall(f);

                float distance = Vector3.Distance(sAI.GetSurvivor().transform.position, f.transform.position);

                if (distance < range)
                {
                    ResetSurvivorsBT();

                    sAI.GetBlackBoard().incomingFireball = f;

                    sAI.GetBlackBoard().currentSurvivorPosition = sAI.GetSurvivor().transform.position;

                    Task BT_Evade_Fireball = new Sequence_EvadeFireballs();

                    sAI.SetBehaviorTree(BT_Evade_Fireball);
                }
            }
        }
    }
예제 #2
0
    void SurvivorFlee()
    {
        List <Enemy> enemies = GameManager.getAllEnemies();

        if (enemies.Count > 0)
        {
            foreach (Enemy e in enemies)
            {
                float range = 5.0f;

                Survivor_AI sAI = FindClosestSurvivorToTarget(e);

                float distance = Vector3.Distance(sAI.GetSurvivor().transform.position, e.transform.position);

                if (distance < range)
                {
                    ResetSurvivorsBT();

                    Task BT_Flee_Zombie = new Sequence_FleeZombie();

                    sAI.GetBlackBoard().target = e;

                    sAI.GetBlackBoard().currentSurvivorPosition = sAI.GetSurvivor().transform.position;

                    sAI.SetBehaviorTree(BT_Flee_Zombie);
                }
            }
        }
    }
예제 #3
0
    void SpendGold()
    {
        if (GameManager.GetBreakTimeRemaining() > 0)
        {
            // let the first survivor on list make the purchasing decesions
            Survivor_AI sAI = survivorAIs[0];

            ResetSurvivorsBT(); // reset before making purchases
            sAI.SetBehaviorTree(new Sequence_SpendGold());
        }
    }
예제 #4
0
    void DefensivePositionSetup(DefensivePosition pos)
    {
        for (int i = 0; i < pos.defensePoints.Length; i++)
        {
            Survivor_AI targetAI = null;

            for (int j = 0; j < survivorAIs.Length; j++)
            {
                Survivor_AI sAI = survivorAIs[j];

                if (sAI.currDefensePoint == null)
                {
                    targetAI = sAI;
                    targetAI.currDefensePoint = pos.defensePoints[i];
                    targetAI.SetBehaviorTree(new Task_FindPath(targetAI.currDefensePoint.transform.position, targetAI));
                    break;
                }
            }
        }
    }
예제 #5
0
    void SearchForHellephants()
    {
        List <Enemy> hellephants = GameManager.getHellephantList();

        if (hellephants.Count > 0 && GameManager.getZomBearList().Count == 0)
        {
            ResetSurvivorsBT();

            foreach (Enemy hellephant in hellephants)
            {
                Survivor_AI sAI = FindClosestSurvivorToTarget(hellephant);

                if (CheckWeapons())
                {
                    Task BT_Kill_Hellephant = new Sequence_KillHellephant(hellephant);

                    sAI.SetBehaviorTree(BT_Kill_Hellephant);
                }
            }
        }
    }
예제 #6
0
    void SearchForBears()
    {
        List <Enemy> bears = GameManager.getZomBearList();

        if (bears.Count > 0)
        {
            ResetSurvivorsBT();

            foreach (Enemy bear in bears)
            {
                Survivor_AI sAI = FindClosestSurvivorToTarget(bear);

                if (CheckWeapons())
                {
                    Task BT_Kill_Special = new Sequence_KillSpecial(bear);

                    sAI.SetBehaviorTree(BT_Kill_Special);
                }
            }
        }

        Invoke("SearchForBears", 1.0f);
    }
예제 #7
0
    public override TASK_RETURN_STATUS Run(Survivor_AI sAI)
    {
        sAI.SetBehaviorTree(new Sequence_DefaultFire());

        return(TASK_RETURN_STATUS.SUCCESS);
    }