private void FindTouchView() { for (int i = 0; i < m_tags.Length; ++i) { Color clr = m_meshColor[i]; clr.a = m_meshAlpha; GUI.backgroundColor = clr; GameObject[] table = GameObject.FindGameObjectsWithTag(m_tags[i]); foreach (GameObject obj in table) { if (obj.GetComponent <XNavObstacleViewFlagment>() == null) { TouchView <NavMeshObstacle>(obj, (sc) => { switch (sc.shape) { case NavMeshObstacleShape.Box: GameObject unitBox = XFunctions.InstanceChild(m_viewUnitBox, Vector3.zero, Quaternion.identity, obj); unitBox.GetComponent <XNavObstacleViewUnitBox>().Initialize(this, m_meshColor[i]); break; case NavMeshObstacleShape.Capsule: GameObject unitCapsule = XFunctions.InstanceChild(m_viewUnitCapsule, Vector3.zero, Quaternion.identity, obj); unitCapsule.GetComponent <XNavObstacleViewUnitCapsule>().Initialize(this, m_meshColor[i]); break; } }); obj.AddComponent <XNavObstacleViewFlagment>(); } } } }
public void Initialize() { GameObject obj = XFunctions.FindSingleObjectWithTag(LibConstants.Tag.SoundPlayer, "SEPlayer"); XLogger.LogValidObject(obj, LibConstants.ErrorMsg.GetMsgNotFoundObject("Tag:SEPlayer")); m_objPlayerUnit = obj.GetComponent <SEPlayerUnit>(); XLogger.LogValidObject(m_objPlayerUnit, LibConstants.ErrorMsg.GetMsgNotBoundComponent("SEPlayerUnit")); }
public static UnityEngine.GameObject InstanceChildRename( UnityEngine.GameObject obj, Vector3 vec, Quaternion rotate, string rename, UnityEngine.GameObject objParent) { UnityEngine.GameObject reobj = XFunctions.InstanceRename(obj, vec, rotate, rename); reobj.transform.SetParent(objParent.transform); return(reobj); }
// Awake is called when the script instance is being loaded. void Awake() { m_pool = this.transform.FindChild("SEPool"); XLogger.LogValidObject(m_pool, LibConstants.ErrorMsg.GetMsgNotFoundObject("SEPool"), gameObject); // Instance Pool for (int i = 0; i < m_startInstance; ++i) { XFunctions.InstanceChild(m_unit, Vector3.zero, Quaternion.identity, m_pool.gameObject); } }
public static UnityEngine.GameObject InstanceChild( UnityEngine.GameObject obj, Vector3 vec, Quaternion rotate, UnityEngine.GameObject objParent) { UnityEngine.GameObject reobj = XFunctions.Instance(obj, vec, rotate); reobj.transform.SetParent(objParent.transform); reobj.transform.localPosition = vec; reobj.transform.localRotation = rotate; return(reobj); }
private GameObject AllocPlayerUnit(Vector3 position, Quaternion rotate) { if (m_pool.childCount > 0) { GameObject obj = m_pool.GetChild(0).gameObject; obj.transform.parent = this.transform; obj.transform.position = position; obj.transform.rotation = rotate; return(obj); } else { return(XFunctions.InstanceChild(m_unit, position, rotate, gameObject)); } }
private void FindTouchView() { for (int i = 0; i < m_tags.Length; ++i) { Color clr = m_meshColor[i]; clr.a = m_meshAlpha; GUI.backgroundColor = clr; GameObject[] table = GameObject.FindGameObjectsWithTag(m_tags[i]); foreach (GameObject obj in table) { if (obj.GetComponent <XCollisionViewFlagment>() == null) { TouchView <SphereCollider>(obj, (sc) => { GameObject unit = XFunctions.InstanceChild(m_viewUnitSphere, Vector3.zero, Quaternion.identity, obj); unit.GetComponent <XCollisionViewUnitSphere>().Initialize(this, m_meshColor[i]); }); TouchView <BoxCollider>(obj, (sc) => { GameObject unit = XFunctions.InstanceChild(m_viewUnitBox, Vector3.zero, Quaternion.identity, obj); unit.GetComponent <XCollisionViewUnitBox>().Initialize(this, m_meshColor[i]); }); TouchView <CapsuleCollider>(obj, (sc) => { GameObject unit = XFunctions.InstanceChild(m_viewUnitCapsule, Vector3.zero, Quaternion.identity, obj); unit.GetComponent <XCollisionViewUnitCapsule>().Initialize(this, m_meshColor[i]); }); obj.AddComponent <XCollisionViewFlagment>(); } } } }