Exemple #1
0
    void Start()
    {
        enemySight    = GetComponentInChildren <EnemySight>();
        fieldOfVision = GetComponentInChildren <FieldOfVision>();

        //set angle
        enemySight.setConeSize(fieldViewAngle / 2);                 //degrees
        fieldOfVision.setAngle(fieldViewAngle * Mathf.Deg2Rad / 2); //in radians

        //set radius - need to adjust for weird scaling
        //Debug.Log(enemyFront.transform.localScale.x);
        enemySight.setColliderRadius(fieldDepth);
        fieldOfVision.setSightRange(fieldDepth / (1 / enemyFront.transform.localScale.x));


        //set the raycast height
        enemySight.setRaycastHeight(enemyEyeHeight);

        //set number of rays in the raycast
        fieldOfVision.setRaysToCast(raysInCast);
    }