Exemple #1
0
    public override void Act(GameObject player, GameObject npc)
    {
        playerTrans    = player.transform;
        npcTrans       = npc.transform;
        npcNav         = npc.GetComponent <AINavAgent>();
        npcNav.enabled = true;
        float playerDist = Vector3.Distance(npcTrans.position, playerTrans.position);

        if (npc.GetComponent <ZombieController>().soundDetector.Detect(player.GetComponent <PlayerController>(), playerDist))
        {
            Debug.Log("Heard by " + npc.ToString());
            destination = playerTrans.position;
            npcNav.SetDestination(destination);
        }

        npcNav.Resume();

        npcNav.speed = 1f;
    }
Exemple #2
0
    public override void Act(GameObject player, GameObject npc)
    {
        playerTrans = player.transform;
//        Transform npcTrans = npc.transform;
        destination = playerTrans.position;

        npcNav         = npc.GetComponent <AINavAgent>();
        npcNav.enabled = true;

        npcNav.speed = 2f;

        if (doOnce == 0)
        {
            npcNav.SetDestination(destination);
            doOnce++;
        }

        npcNav.TrackMovingTarget(player.GetComponent <PlayerController>() as IAITrackable);
    }