Exemplo n.º 1
0
Arquivo: Shoot.cs Projeto: Dokitsu/AI-
    void Shot()
    {
        float shotDistance = 10000;

        Ray        ray = new Ray(Barrel.position, Barrel.forward);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, shotDistance, enemymask))
        {
            if (hit.collider.GetComponent <Enemy>())
            {
                hit.collider.GetComponent <Enemy>().TakeDamage(damage);
            }
        }

        if (Physics.Raycast(ray, out hit, shotDistance, terrormask))
        {
            enemy = hit.transform.gameObject.GetComponent <AImov>();
            enemy.shotat();

            //if (hit.collider.GetComponent<AICharacterControl>())
            //{
            //    hit.collider.GetComponent<AICharacterControl>().shotat();
            //}
        }

        StartCoroutine("RenderTrace", ray.direction * shotDistance);

        //Debug.DrawRay(ray.origin, ray.direction * shotDistance, Color.red, 1);

        GetComponent <AudioSource>().Play();
    }
Exemplo n.º 2
0
Arquivo: AImov.cs Projeto: Dokitsu/AI-
    public IEnumerator fire(AImov _owner, int random)
    {
        yield return(new WaitForSeconds(random));

        eman = GameObject.FindWithTag("Manager").GetComponent <EnemyManager>();
        muzzle.gameObject.GetComponent <ShootEnemy>().attacking = true;
        yield return(new WaitForSeconds(2));

        muzzle.gameObject.GetComponent <ShootEnemy>().attacking = false;
        _owner.stateMachine.ChangeState(State_Default.Instance);
        eman.ticketreturn();
    }
Exemplo n.º 3
0
Arquivo: AImov.cs Projeto: Dokitsu/AI-
    public void Shoot(AImov _owner)
    {
        int random = Random.Range(0, 3);

        StartCoroutine(fire(_owner, random));
    }