Exemplo n.º 1
0
    public void Update()
    {
        if (inSight == true)
        {
            states = _AIstates.Attack;
        }
        switch (states)
        {
        default:
        case _AIstates.Idle:
            if (pathholder == null)
            {
            }
            else
            {
                states = _AIstates.Patrol;
            }
            break;

        case _AIstates.Patrol:
            if (pathholder != null)
            {
                StartCoroutine("Patroling");
            }
            break;

        case _AIstates.Attack:

            transform.LookAt(_target);
            print("Im shooting");
            break;
        }
    }
Exemplo n.º 2
0
    public void NoticePlayer(GameObject player)
    {
        RaycastHit hit;

        Physics.Raycast(viewpoint.transform.position, player.transform.position, out hit, Mathf.Infinity);

        if (hit.transform.tag == "Player")
        {
            inSight = true;
            states  = _AIstates.Attack;
        }
        else
        {
            inSight = false;
        }
    }