void Awake()
    {
        try{
            //Dynamic reference to source config component
            cyPIPESmasterObj = GameObject.Find("cyPIPES");
            sourceConfigs    = cyPIPESmasterObj.GetComponent <cyPIPESConfigs> ();
            cyPIPESnetwork   = cyPIPESmasterObj.GetComponent <cyPIPESComms> ();

            //Checking to make sure that the Object.name changed to unitID and waiting if it's not
            if (unitID == "unitObject(Clone)")
            {
                StartCoroutine(waitForParse(0.5f));
            }

            //reference specific cyPIPESunit config data
            foreach (string key in sourceConfigs.allCyPIPESunits.Keys)
            {
                if (sourceConfigs.allCyPIPESunits[key].ID == unitID)
                {
                    if (cyPIPESLogActive)
                    {
                        Debug.Log("cyPIPES Log: Virtual cyPIPES unit " + unitID + " is instatiated and config parameters linked");
                    }
                }
            }
        }catch {
            if (cyPIPESErrorsActive)
            {
                Debug.LogError("cyPIPES ERROR: Unit " + gameObject.name + " has a null ref. to the cyPIPES prefab. Is it active in the scene?");
            }
        }

        //Debug.Log ("TESTING ch1 Type is " + unitData.ch1posX + " for unit " + unitID + " TESTING");
    }
示例#2
0
 // Use this for initialization
 void Start()
 {
     units = GameObject.Find("cyPIPES").GetComponent <cyPIPESConfigs>();
     populateUnitsHere();
 }