示例#1
0
    void Update()
    {
        if (!createSound)
        {
            return;
        }

        //Update _targetPosition to mouse position on _plane
        if (Input.GetMouseButtonDown(0))
        {
            if (!cameraToUse)
            {
                Debug.Log("SoundTesterScript: cameraToUse not set!");
                return;
            }

            Ray   ray     = cameraToUse.ScreenPointToRay(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0));
            float hitdist = 0.0f;

            Vector3 targetPosition;

            if (plane.Raycast(ray, out hitdist))
            {
                targetPosition = ray.GetPoint(hitdist);

                HearingScript.createNoise(targetPosition, 4);
            }
        }
    }
示例#2
0
 // Use this for initialization
 void Start()
 {
     enemyHearing = enemy.GetComponent <HearingScript> ();
 }
示例#3
0
    void Awake()
    {
        HearingScript.debug = debug;

        HearingScript.registerListener(new HearingScript.Listener(gameObject, DidHearSound));
    }