Exemple #1
0
    protected void Start()
    {
        circle      = (GameObject)Instantiate(Resources.Load("Internals/SightCircle"), transform.position + new Vector3(0f, 0.03f, 0f), transform.rotation * Quaternion.Euler(new Vector3(90f, 0f, 0f)), transform);
        circle.name = "Chase Sight";
        scm         = circle.GetComponent <SightCircleManager> ();
        scm.SetColor(circleColor);
        scm.SetScale(0f);

        HideInfo[] hii = transform.root.GetComponentsInChildren <HideInfo> (true);
        foreach (HideInfo hi in hii)
        {
            if (hi.hideMe && !hi.transform.gameObject.activeInHierarchy)
            {
                scm.active = false;
            }
        }

        PoV = new Vector3(0f, transform.root.localScale.y * heightOfSight, 0f);
    }
    protected void Start()
    {
        circle                  = (GameObject)Instantiate(Resources.Load("Internals/SightCircle"), transform.position + new Vector3(0f, 0.03f, 0f), transform.rotation * Quaternion.Euler(new Vector3(90f, 0f, 0f)));
        circle.name             = "Chase Sight";
        circle.transform.parent = this.transform; // if taken away, for some reason the circle is instantiated not under the npc.
        scm = circle.GetComponent <SightCircleManager> ();
        scm.SetColor(circleColor);
        scm.SetScale(sensingRange);

        agent = GetComponent <NavMeshAgent>();

        HideInfo[] hii = transform.root.GetComponentsInChildren <HideInfo> (true);
        foreach (HideInfo hi in hii)
        {
            if (hi.hideMe && !hi.transform.gameObject.activeInHierarchy)
            {
                scm.active = false;
            }
        }
        PoV = new Vector3(0f, transform.root.localScale.y * heightOfSight, 0f);
    }