Exemple #1
0
    private void PatrolUpdate()
    {
        if (atEndOfPath())
        {
            if (nodeList.Count > 0)
            {
                PathfindingNode node = nodeList[rnd.Next(nodeList.Count)];
                target_position = node.getPosition();
            }
            else
            {
                target_position = new Vector3();
            }
        }

        Monster.GetComponent <SoundPlayer>().Stop(2);
        if (CheckPlayerInRange(calcDetectionRange()) && !InSafezone())
        {
            state = AIstate.hunting;
            Monster.GetComponent <SoundPlayer>().Play(1);
            Monster.GetComponent <SoundPlayer>().Play(2);
        }
    }