public virtual void Awake() { MF_AbstractStats sScript = null; if (transform.parent) { sScript = transform.parent.GetComponentInParent <MF_AbstractStats>(); } if (sScript) { sScript.statsScript.Add(this); } poolRefScript = gameObject.GetComponent <AP_Reference>(); if (size == 0) // Find size of object if not already defined { size = UtilityMF.FindColliderBoundsSize(transform, true); } }
// create brackets public GameObject MakeBracket(GameObject prefab) { if (prefab == null) { return(null); } GameObject newBracket = (GameObject)Instantiate(prefab, transform.position, transform.rotation); newBracket.transform.SetParent(transform); if (bracketSize == 0) // try to determine size from collider bounds { bracketSize = UtilityMF.FindColliderBoundsSize(clickObjectBase.transform, true) * 3f; if (bracketSize == 0) { bracketSize = 1; } // if no collider found, set to 1 } newBracket.GetComponent <ParticleSystem>().startSize = bracketSize; newBracket.SetActive(false); return(newBracket); }
// create brackets public GameObject MakeMark(GameObject prefab) { if (prefab == null) { return(null); } GameObject newMark = (GameObject)Instantiate(prefab, transform.position, transform.rotation); newMark.transform.SetParent(transform); if (markSize == 0) // try to determine size from collider bounds { markSize = UtilityMF.FindColliderBoundsSize(clickObjectBase.transform, true) * 3f; if (markSize == 0) { markSize = 1; } // if no collider found, set to 1 } ParticleSystem.MainModule ps = newMark.GetComponent <ParticleSystem>().main; ps.startSize = markSize; newMark.SetActive(false); return(newMark); }