Ejemplo n.º 1
0
    private Vector3 CalculateRandomError(Vector3 dir)
    {
        AI_Controller owner = UT_FindComponent.FindComponent <AI_Controller>(gameObject);

        if (owner == null)
        {
            return(dir);
        }

        SO_AI_Base bs = owner.GetBase();

        if (!bs.mFireInaccurately)
        {
            return(dir);
        }

        // now find a random spread up to the max spread.
        float spread = Random.Range(0, bs.mInacRange);

        if (Random.value > 0.5f)
        {
            spread *= -1;
        }

        // now apply that spread to the bullets direction.
        Vector3 newDir = Quaternion.AngleAxis(spread, Vector3.up) * dir;

        return(newDir);
    }
Ejemplo n.º 2
0
    public void HandleShooting()
    {
        SO_AI_Base bs = GetComponent <AI_Controller>().GetBase();

        StartCoroutine(PlayDialogueDelayed(bs.mShootLine));
    }