public static GameObject GameObjectCopy(GameObject Org, Transform Dest) { GameObject gameObject = new GameObject(Org.name); if (gameObject != null) { gameObject.transform.parent = Dest; Component[] components = Org.GetComponents(typeof(Component)); Component[] array = components; for (int i = 0; i < array.Length; i++) { Component org = array[i]; EventTriggerHelper.ComponentCopy(org, gameObject, true); } if (Org.transform.childCount > 0) { for (int j = 0; j < Org.transform.childCount; j++) { GameObject gameObject2 = Org.transform.GetChild(j).gameObject; if (gameObject2 != null) { EventTriggerHelper.GameObjectCopy(gameObject2, gameObject.transform); } } } } return(gameObject); }
void Start() { EventTrigger myTrigger = GetComponent <EventTrigger>(); EventTriggerHelper.InsertFunctionIntoCallback(myTrigger, EventTriggerType.PointerEnter, show); EventTriggerHelper.InsertFunctionIntoCallback(myTrigger, EventTriggerType.PointerExit, hide); }
private void ReadListXML(XmlReader Reader, EventTrigger._EVENTTRIGGER Category) { try { Reader.Read(); while (Reader.ReadToNextSibling("Item")) { if (Reader.NodeType == XmlNodeType.EndElement) { break; } if (Reader.NodeType == XmlNodeType.Element) { Reader.MoveToNextAttribute(); GameObject item = EventTriggerHelper.CreateEventTriggerItem(this, Category, Reader.Value.ToString()); this.AddItem(Category, item); this.ReadItemXML(Reader, ref item); Reader.ReadEndElement(); } } } catch (Exception ex) { TsLog.Log(ex.Message, new object[0]); } }
public void DestoryTriggerObject() { if (this.Loaded) { EventTriggerHelper.DestoryChildObject(this.m_goMap.transform); } }
public static void AddHistroyLog(GameObject go, EventTriggerItem item, string log) { if (EventTriggerHelper.AddLog != null) { EventTriggerHelper.AddLog(go, item, log); } }
private void AddViseme(string animName) { if (base.animation[animName] == null) { AnimationClip animationClip = (AnimationClip)Resources.Load("viseme/" + animName, typeof(AnimationClip)); if (animationClip == null) { Debug.LogError("Anim not found :" + animName); } EventTriggerHelper.AddAniClip(base.gameObject, animationClip); } AnimationState animationState = base.animation[animName]; animationState.layer = 20; animationState.blendMode = AnimationBlendMode.Additive; animationState.normalizedSpeed = 0f; animationState.weight = 0f; animationState.normalizedTime = 1f; animationState.wrapMode = WrapMode.ClampForever; animationState.enabled = true; Transform transform = base.transform.Find("bone01 pelvis/bone01 spine/bone01 spine1/bone01 neck/bone01 head"); if (transform) { animationState.AddMixingTransform(transform.Find("bone01 facial jaw")); animationState.AddMixingTransform(transform.Find("bone01 facial lip")); animationState.AddMixingTransform(transform.Find("bone01 facial mouth r")); animationState.AddMixingTransform(transform.Find("bone01 facial mouth l")); } }
public void Claer() { UnityEngine.Debug.Log("EventTriggerMapManager Clear"); EventTriggerHelper.DestoryChildObject(base.transform); base.transform.DetachChildren(); this._ActiveMap.Clear(); this._ActionEventTrigger.Clear(); this.m_MapTriggerList.Clear(); }
void Start() { trigger = GetComponent <EventTrigger>(); EventTriggerHelper.AddEvent(trigger, EventTriggerType.PointerDown, Shield); shieldCD = GetComponent <CooldownTimer>(); audioSrc = GetComponent <AudioSource>(); shipHitbox = playerShip.GetComponent <Collider2D>(); bg_ready = transform.GetChild(1).GetComponent <Image>(); }
// Use this for initialization void Start() { trigger = GetComponent <EventTrigger>(); untouchable = GetComponent <Untouchable>(); camMovement = Camera.main.GetComponent <Movement>(); EventTriggerHelper.AddEvent(trigger, EventTriggerType.PointerDown, (data) => { fingerMoveId = untouchable.IsTouchingUI(data.position) ? -1 : data.pointerId; }); EventTriggerHelper.AddEvent(trigger, EventTriggerType.PointerUp, (data) => { fingerMoveId = -1; }); }
public static void DelAniClip(Animation Ani, AnimationClip clip) { if (Ani == null || clip == null) { return; } if (EventTriggerHelper.HasAniClip(Ani, clip)) { Ani.RemoveClip(clip); } }
void Start() { camMovement = Camera.main.GetComponent <Movement>(); moveableArea = GetComponent <BoxCollider2D>(); moveableArea.size = new Vector2(Camera.main.orthographicSize * Camera.main.aspect, Camera.main.orthographicSize);//new Vector2(Camera.main.orthographicSize * 2f * Camera.main.aspect, Camera.main.orthographicSize * 2f); trigger = GetComponent <EventTrigger>(); //data is PointerEventData type //onpointerdown is fired only when the cursor/finger is on the shipPivot for the first frame. EventTriggerHelper.AddEvent(trigger, EventTriggerType.PointerDown, (data) => { fingerMoveId = (IsTouchingAbilityBar(data.position))? -1 : data.pointerId; }); EventTriggerHelper.AddEvent(trigger, EventTriggerType.PointerUp, (data) => { fingerMoveId = -1; }); }
void Start() { trigger = GetComponent <EventTrigger>(); laserCD = GetComponent <CooldownTimer>(); audioSrc = GetComponent <AudioSource>(); laserBar = GetComponent <Slider>(); shipAnim = playerShip.GetComponent <Animator>(); energyAccum = playerShip.GetComponent <EnergyAccumulator>(); //tap button to fire laser EventTriggerHelper.AddEvent(trigger, EventTriggerType.PointerDown, ActivateLaser); }
public static void ActiveAllTreeChildren(GameObject obj, bool bActive) { for (int i = 0; i < obj.transform.childCount; i++) { Transform child = obj.transform.GetChild(i); EventTriggerHelper.ActiveAllTreeChildren(child.gameObject, bActive); child.gameObject.SetActive(bActive); if (bActive && child.gameObject.animation != null) { child.gameObject.animation.Play(); } } }
public static GameObject CreateGameDramaObject(string objectname, Type type) { GameObject gameObject = GameObject.Find("EventTriggerObject"); if (gameObject == null) { gameObject = GameObject.Find("GameDrama"); if (gameObject == null) { gameObject = new GameObject("GameDrama"); UnityEngine.Object.DontDestroyOnLoad(gameObject); } } return(EventTriggerHelper.CreateEventTriggerObject(objectname, type, gameObject)); }
private void Start() { if (this.m_DeActiveGameObjectList != null) { foreach (GameObject current in this.m_DeActiveGameObjectList) { if (!(current == null)) { current.SetActive(false); EventTriggerHelper.ActiveAllTreeChildren(current, false); } } } UnityEngine.Object.Destroy(base.gameObject); }
public GameObject[] ReadXML(XmlReader Reader) { if (Reader == null) { if (NrTSingleton <NrGlobalReference> .Instance.IsEnableLog) { TsLog.Log("Can't Read XMLFile : " + Application.dataPath + "/../Test.xml", new object[0]); } return(null); } GameObject[] result; try { List <GameObject> list = new List <GameObject>(); Reader.ReadStartElement("EventTrigger"); while (Reader.ReadToNextSibling("Object")) { if (Reader.NodeType == XmlNodeType.EndElement) { break; } if (Reader.NodeType == XmlNodeType.Element) { string attribute = Reader.GetAttribute("Name"); GameObject gameObject = EventTriggerHelper.CreateEventTriggerObject(attribute, typeof(EventTrigger_Game), null); EventTrigger component = gameObject.GetComponent <EventTrigger>(); component.ReadXML(Reader); list.Add(gameObject); } Reader.Read(); } Reader.Close(); if (NrTSingleton <NrGlobalReference> .Instance.IsEnableLog) { TsLog.Log("Readed XML", new object[0]); } result = list.ToArray(); } catch (Exception ex) { if (NrTSingleton <NrGlobalReference> .Instance.IsEnableLog) { TsLog.LogError(ex.Message + " " + ex.StackTrace, new object[0]); } result = null; } return(result); }
public static bool AddAniClip(Animation Ani, AnimationClip clip) { if (Ani == null || clip == null) { return(false); } if (!EventTriggerHelper.HasAniClip(Ani, clip)) { Ani.AddClip(clip, clip.name); } if (EventTriggerHelper.AddLog != null) { EventTriggerHelper.AddLog(Ani.gameObject, null, string.Format("Add AniClip : {0}", clip.name)); } return(true); }
public void Trans() { if (this.m_RootGameObject == null) { return; } Transform transform; if (this.m_PositionGameObjectName == string.Empty || this.m_PositionGameObjectName == null) { transform = base.gameObject.transform; } else { transform = EventTriggerHelper.GetChildTransform(this.m_RootGameObject.transform, this.m_PositionGameObjectName); } if (transform == null) { return; } base.gameObject.transform.position = transform.position; base.gameObject.transform.eulerAngles = transform.eulerAngles; base.gameObject.transform.localScale = transform.root.localScale; if (base.gameObject.transform.childCount > 0) { Transform child = base.gameObject.transform.GetChild(0); if (child) { Vector3 localPosition = child.localPosition; Vector3 localEulerAngles = child.localEulerAngles; Vector3 localScale = child.localScale; child.parent = transform; child.localPosition = localPosition; child.localEulerAngles = localEulerAngles; child.localScale = localScale; child.localPosition = this.m_Position; child.localEulerAngles = this.m_Rotation; if (!this.m_Scale.Equals(Vector3.zero)) { child.localScale = this.m_Scale; } } } }
public static Transform GetChildTransform(Transform parent, string ObjectName) { Transform transform = parent.FindChild(ObjectName); if (transform == null) { int childCount = parent.childCount; for (int i = 0; i < childCount; i++) { Transform child = parent.GetChild(i); transform = EventTriggerHelper.GetChildTransform(child, ObjectName); if (transform != null) { return(transform); } } } return(transform); }
private void _OnCompleteDownload(IDownloadedItem wItem, object obj) { if (wItem.mainAsset == null) { TsLog.LogWarning("wItem.mainAsset is null -> Path = {0}", new object[] { wItem.assetPath }); } else { UnityEngine.Object mainAsset = wItem.mainAsset; if (mainAsset != null && base.gameObject) { GameObject gameObject = UnityEngine.Object.Instantiate(mainAsset, new Vector3(base.gameObject.transform.position.x, base.gameObject.transform.position.y + 0.5f, base.gameObject.transform.position.z), base.gameObject.transform.localRotation) as GameObject; gameObject.transform.parent = base.gameObject.transform; EventTriggerHelper.ActiveAllTreeChildren(base.gameObject, this._Visible); base.gameObject.collider.enabled = this._Visible; } wItem.unloadImmediate = true; } }
public bool CreateModel(ModelPrefabInfo prefabInfo) { if (prefabInfo == null) { return(false); } if (prefabInfo.m_Prefab == null) { return(false); } foreach (ModelInfo current in prefabInfo.m_ModelInfoList) { if (!(current.Model == null)) { GameObject gameObject = UnityEngine.Object.Instantiate(prefabInfo.m_Prefab, current.Model.transform.position, current.Model.transform.rotation) as GameObject; if (!gameObject.transform.localScale.Equals(prefabInfo.m_PrefabScale)) { TsLog.LogWarning(string.Concat(new object[] { "Bundle Scale Miss ", prefabInfo.m_Prefab.name, " Org: ", prefabInfo.m_PrefabScale, " Bundle: ", gameObject.transform.localScale }), new object[0]); } int childCount = gameObject.transform.childCount; for (int i = 0; i < childCount; i++) { Transform child = gameObject.transform.GetChild(0); if (!(child == null)) { child.parent = current.Model.transform; } } Component[] components = gameObject.GetComponents(typeof(Component)); Component[] array = components; for (int j = 0; j < array.Length; j++) { Component component = array[j]; if (current.Model.GetComponent(component.GetType()) == null) { EventTriggerHelper.ComponentCopy(component, current.Model, false); } if (component.GetType() == typeof(Animation)) { EventTriggerHelper.ComponentCopy(component, current.Model, true); Animation component2 = current.Model.GetComponent <Animation>(); Animation animation = component as Animation; if (component2 != null && animation != null) { foreach (AnimationState animationState in animation) { component2.AddClip(animationState.clip, animationState.clip.name); } component2.clip = animation.clip; } } } UnityEngine.Object.Destroy(gameObject); if (current.ChangeScale && !prefabInfo.m_PrefabScale.Equals(current.Scale)) { current.Model.transform.localScale = current.Scale; } } } return(true); }
public static bool AddAniClip(GameObject obj, AnimationClip clip) { return(!(obj == null) && !(clip == null) && EventTriggerHelper.AddAniClip(obj.animation, clip)); }