Exemplo n.º 1
0
    /// Use this for initialization
    void Start()
    {
#if UNITY_EDITOR
        // Some input validation
        UltrasoundDebug.Assert(NumberOfScanlines > 0,
                               "Number of scanlines should be a positive integer",
                               this, true);
        UltrasoundDebug.Assert(PointsPerScanline > 0,
                               "Points per scanline should be a positive integer",
                               this, true);
        UltrasoundDebug.Assert(ArcSizeInDegrees >= 0 && ArcSizeInDegrees <= 180f,
                               "Arc size should be between 0 and 180 degrees.",
                               this, true);
        UltrasoundDebug.Assert(MinDistance > 0,
                               "Min distance should be greater than 0",
                               this, true);
        UltrasoundDebug.Assert(MaxDistance > 0,
                               "Max distance should be greater than 0",
                               this, true);
        UltrasoundDebug.Assert(MinDistance < MaxDistance,
                               "Min distance should be smaller than max distance",
                               this, true);
#endif

        output     = new HorayProbeOutput(this.gameObject);
        dataSource = new HorayProbe(this.gameObject, output);
    }
    /**
     *  Instantiate a new HorayProbeOutput.
     *	@param gameObject The probe from which data will be transmitted.
     *	@throw ArgumentException If the probe object does not have the correct components.
     */
    public HorayProbeOutput(GameObject gameObject)
    {
        UltrasoundDebug.Assert(null != gameObject,
                               "Null GameObject passed to HorayProbeOutput constructor.",
                               this);

        if (null == gameObject.GetComponent <HorayBehavior>())
        {
            string str =
                "The probe object used to instantiate this output " +
                "does not have the required HorayBehavior script.";
            Debug.LogError(str);
        }
        this.probeGameObject = gameObject;
        probe = new HorayProbe(probeGameObject, this);
    }