Example #1
0
    // Use this for initialization, not Start() to make sure RadarProperties is set up properly before copying values
    public void Initialize()
    {
        trackedObj = GetComponent <SteamVR_TrackedObject>();

        m_radarProperties = transform.parent.GetComponent <RadarProperties>();

        m_radarCamera    = m_radarProperties.radarCamera.transform;
        m_playerPos      = m_radarProperties.playerPos;
        m_switchDistance = m_radarProperties.switchDistance;

        m_radarObjects   = m_radarProperties.radarObjects;
        m_radarRenderers = m_radarProperties.radarRenderers;

        m_isInuse     = false;
        m_selfIsInuse = false;
    }
Example #2
0
    void Start()
    {
        if (radarPrefab != null && iconTexture != null)
        {
            GameObject obj = Instantiate(radarPrefab, transform.position, transform.rotation) as GameObject;

            // need to make a parent for the obj to have a reference of the original RadarObject position
            obj.transform.parent = this.transform;

            Renderer rend = obj.GetComponentInChildren <Renderer>();
            rend.material.mainTexture = iconTexture;
            if (!_isInitialized)
            {
                m_radarProp    = FindObjectOfType <RadarProperties>();
                _isInitialized = true;
            }
            m_radarProp.AddTrackedObjects(obj);
            m_radarProp.AddRendererForRadarObjects(rend);
        }
    }
Example #3
0
 // Start is called before the first frame update
 void Awake()
 {
     rp = GameObject.FindObjectOfType <RadarProperties>();
 }