示例#1
0
    public override TASK_RETURN_STATUS Run(Survivor_AI sAI)
    {
        TASK_RETURN_STATUS output = TASK_RETURN_STATUS.FAILED;

        Blackboard bb = sAI.GetBlackboard();

        if (bb.enemyTarget != null)
        {
            if (bb.enemyTarget.getEnemyType() == EnemyType.HELLEPHANT || bb.enemyTarget.getEnemyType() == EnemyType.ZOMBEAR)
            {
                Vector3 dir             = bb.enemyTarget.transform.position - sAI.transform.position;
                float   distFromCrystal = (Vector3.zero - sAI.transform.position).magnitude;
                float   dist            = dir.magnitude;
                if (dist > 5.0f && distFromCrystal < 50.0f)
                {
                    UnityEngine.AI.NavMeshAgent agent = sAI.GetComponent <UnityEngine.AI.NavMeshAgent>();

                    agent.destination = bb.enemyTarget.transform.position;

                    output = TASK_RETURN_STATUS.SUCCEED;
                }
            }
        }


        return(output);
    }
示例#2
0
    public override TASK_RETURN_STATUS Run(Survivor_AI sAI)
    {
        TASK_RETURN_STATUS output = TASK_RETURN_STATUS.FAILED;

        Blackboard bb   = sAI.GetBlackboard();
        float      dist = (sAI.transform.position - bb.moveToPosition).magnitude;

        if (dist > 1.0f)
        {
            UnityEngine.AI.NavMeshAgent agent = sAI.GetComponent <UnityEngine.AI.NavMeshAgent>();
            agent.destination = bb.moveToPosition;

            output = TASK_RETURN_STATUS.FAILED;
        }
        else
        {
            bb.nodesForAStar.Remove(bb.currNodeToGetTo);
            if (bb.nodesForAStar.Count > 0)
            {
                bb.currNodeToGetTo = bb.nodesForAStar[0];
                bb.moveToPosition  = bb.currNodeToGetTo.transform.position;
            }
            output = TASK_RETURN_STATUS.SUCCEED;
        }

        return(output);
    }
示例#3
0
    public override TASK_RETURN_STATUS Run(Survivor_AI sAI)
    {
        TASK_RETURN_STATUS output = TASK_RETURN_STATUS.FAILED;

        Blackboard bb = sAI.GetBlackboard();

        if (bb.enemyTarget != null)
        {
            Vector3 dir = sAI.transform.position - bb.enemyTarget.gameObject.transform.position;

            float dist = dir.magnitude;
            if (dist < 5.0f)
            {
                //dir.Normalize();

                dir += sAI.transform.position;
                UnityEngine.AI.NavMeshAgent agent = sAI.GetComponent <UnityEngine.AI.NavMeshAgent>();
                agent.destination = dir;

                //sAI.transform.position += dir;

                output = TASK_RETURN_STATUS.SUCCEED;
            }
        }
        return(output);
    }
示例#4
0
    public override TASK_RETURN_STATUS Run(Survivor_AI sAI)
    {
        TASK_RETURN_STATUS output = TASK_RETURN_STATUS.FAILED;

        Blackboard bb = sAI.GetBlackboard();

        if (GameManager.getZomBunnyList().Count > 5)
        {
            if ((FindClosestBunnyTarget(sAI).transform.position - sAI.transform.position).magnitude < 8.0f)
            {
                //sAI.gameObject
                Vector3 normalizedDir             = FleeHord(sAI);
                UnityEngine.AI.NavMeshAgent agent = sAI.GetComponent <UnityEngine.AI.NavMeshAgent>();

                agent.destination = normalizedDir + sAI.transform.position;
                output            = TASK_RETURN_STATUS.SUCCEED;
            }
        }

        return(output);
    }