private void _AssignBaseObject(GameObject Base) { if (this.m_kBaseObject) { UnityEngine.Object.Destroy(this.m_kBaseObject); this.m_kBaseObject = null; } this.m_kBaseObject = Base; this.m_kBaseObject.name = this.m_szCharCode; if (null == this.m_kBaseObject) { Debug.LogError("TTTTTT - m_kBaseObj is null"); } if (null == this.m_kRootGameObj) { Debug.LogError("char bone root go is null"); this.m_kBaseObject.transform.parent = null; } else { this.m_kBaseObject.transform.parent = this.m_kRootGameObj.transform; this.m_kBaseObject.transform.localPosition = new Vector3(0f, -0.07f, 0f); this.m_kBaseObject.transform.localRotation = Quaternion.identity; } if (this._RemoveScriptAction != null) { this._RemoveScriptAction(); } NkUtil.SetAllChildActive(this.m_kBaseObject, true); this.m_kBaseObject.animation.enabled = true; base.downloadCounter--; }
public void MakeMoveMark(Vector3 objPos) { if (this.m_pkTargetChar != null || this.m_pkChar.GetID() > 1) { return; } if (this.m_bHideMoveMark) { this.DestroyMoveMark(); return; } if (this.m_objMoveMark == null) { this.m_objMoveMark = new GameObject("CLICK_MOVE"); NrTSingleton <NkEffectManager> .Instance.AddEffect("CLICK_MOVE", this.m_objMoveMark); } this.m_objMoveMark.transform.position = new Vector3(objPos.x, objPos.y, objPos.z); this.m_objMoveMark.transform.localScale = new Vector3(1f, 1f, 1f); Animation[] componentsInChildren = this.m_objMoveMark.GetComponentsInChildren <Animation>(); Animation[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Animation animation = array[i]; animation.Rewind(); } NkUtil.SetAllChildActive(this.m_objMoveMark, true); }
private void UpdateCurveMove() { float num = Time.time - this.m_fStartTime; Vector3 position; position.x = this.m_PosStart.x + this.m_initVelVector.x * num; position.y = this.m_PosStart.y + this.m_initVelVector.y * num - 0.5f * NkBulletUnit.gravitationalConstant * num * num; position.z = this.m_PosStart.z + this.m_initVelVector.z * num; if (!this.m_EffectUnit.CastedTarget.m_goEffect.activeInHierarchy) { this.m_EffectUnit.CastedTarget.m_goEffect.SetActive(true); if (this.m_EffectUnit.CastedTarget.m_TrailerRenderer != null) { this.m_EffectUnit.CastedTarget.m_TrailerRenderer.enabled = true; } NkUtil.SetAllChildActive(this.m_EffectUnit.CastedTarget.m_goEffect, true); } if (this.m_EffectUnit.IsAlive) { this.m_EffectUnit.CastedTarget.m_goEffect.transform.position = position; Vector3 a = new Vector3(this.m_HitPosEnd.x, this.m_PosStart.y, this.m_HitPosEnd.z); Vector3 forward = a - this.m_PosStart; Quaternion localRotation = Quaternion.LookRotation(forward); this.m_EffectUnit.CastedTarget.m_goEffect.transform.localRotation = localRotation; } }
public void SetShow(bool bShow) { if (null != this.m_goEffect) { NkUtil.SetAllChildActive(this.m_goEffect, bShow); } }
public void FinishDownloadWeaponTrail(IDownloadedItem wItem, object kParamObj) { try { if (!(this.m_kBaseObject == null)) { if (!wItem.isCanceled) { if (wItem.GetSafeBundle() == null) { TsLog.LogWarning("wItem.mainAsset is null -> Path = {0}", new object[] { wItem.assetPath }); } else { GameObject original = wItem.GetSafeBundle().mainAsset as GameObject; this.m_kWeaponTrailObject = (GameObject)UnityEngine.Object.Instantiate(original); this.m_kWeaponTrailObject.transform.parent = this.m_kBaseObject.transform; this.m_kWeaponTrailObject.transform.localPosition = Vector3.zero; this.m_kWeaponTrailObject.SetActive(true); NkUtil.SetAllChildActive(this.m_kWeaponTrailObject, false, true); } } } } catch (Exception obj) { TsLog.LogError(obj); } }
private void UpdateLineMove() { if (this.m_EffectUnit.CastedTarget.m_goEffect == null) { return; } float num = this.m_fBulletEndTime - this.m_fStartTime; float num2 = Time.time - this.m_fStartTime; if (this.m_BulletInfo.HIT_TYPE == eBULLET_HIT_TYPE.eBULLET_HIT_TYPE_CHAR) { this.m_HitPosEnd = this.m_TargetChar.CastedTarget.GetCenterPosition(); } Vector3 position = Vector3.Lerp(this.m_PosStart, this.m_BulletPosEnd, num2 / num); if (!this.m_EffectUnit.CastedTarget.m_goEffect.activeInHierarchy) { this.m_EffectUnit.CastedTarget.m_goEffect.SetActive(true); if (this.m_EffectUnit.CastedTarget.m_TrailerRenderer != null) { this.m_EffectUnit.CastedTarget.m_TrailerRenderer.enabled = true; } NkUtil.SetAllChildActive(this.m_EffectUnit.CastedTarget.m_goEffect, true); } if (this.m_EffectUnit.IsAlive) { this.m_EffectUnit.CastedTarget.m_goEffect.transform.position = position; Vector3 a = new Vector3(this.m_BulletPosEnd.x, this.m_PosStart.y, this.m_BulletPosEnd.z); Vector3 forward = a - this.m_PosStart; Quaternion localRotation = Quaternion.LookRotation(forward); this.m_EffectUnit.CastedTarget.m_goEffect.transform.localRotation = localRotation; } }
public void DestroyMoveMark() { if (this.m_objMoveMark != null) { this.m_bHideMoveMark = false; NkUtil.SetAllChildActive(this.m_objMoveMark, false); } }
private GameObject _GetEffectGameObject(string effectKind, GameObject goOriginal) { GameObject gameObject = UnityEngine.Object.Instantiate(goOriginal, Vector3.zero, Quaternion.identity) as GameObject; if (null == gameObject) { return(null); } gameObject.name = effectKind; gameObject.transform.rotation = goOriginal.transform.rotation; gameObject.transform.localScale = goOriginal.transform.localScale; NkUtil.SetAllChildActive(gameObject, true); return(gameObject); }
public override void FinishDownloadBase(ref IDownloadedItem wItem) { base.downloadCounter--; GameObject original; if (!TsPlatform.IsMobile) { GameObject gameObject = wItem.mainAsset as GameObject; AudioSource[] components = gameObject.GetComponents <AudioSource>(); AudioSource[] array = components; for (int i = 0; i < array.Length; i++) { AudioSource audioSource = array[i]; if (audioSource.clip == null) { audioSource.clip = TsAudioManager.Instance.GetTempClip(); } } original = gameObject; } else { original = (wItem.mainAsset as GameObject); } this.m_kBaseObject = (UnityEngine.Object.Instantiate(original) as GameObject); this.m_kBaseObject.name = this.m_szCharCode; if (null == this.m_kBaseObject) { Debug.LogError("TTTTTT - m_kBaseObj is null"); } if (null == this.m_kRootGameObj) { Debug.LogError("char bone root go is null"); this.m_kBaseObject.transform.parent = null; } else { this.m_kBaseObject.transform.parent = this.m_kRootGameObj.transform; this.m_kBaseObject.transform.localPosition = new Vector3(0f, -0.07f, 0f); this.m_kBaseObject.transform.localRotation = Quaternion.identity; } if (this._RemoveScriptAction != null) { this._RemoveScriptAction(); } NkUtil.SetAllChildActive(this.m_kBaseObject, true); this.m_kBaseObject.animation.enabled = true; base.FinishDownloadBase(ref wItem); }
public static void SetFindChildActive(GameObject parent, string strFindName, bool _isActive) { if (null != parent) { Transform child = NkUtil.GetChild(parent.transform, strFindName); if (child != null) { NkUtil.SetAllChildActive(child.gameObject, _isActive); } } else { Debug.LogWarning("KKIComment2011/6/2/ : SetFindChildActive:if( null != parent)"); } }
private void _RegisterEffectGameObject(GameObject originalEffect, string effectKind) { if (originalEffect == null) { return; } if (this.m_kEffectModelRoot == null) { this.m_kEffectModelRoot = GameObject.Find("@internal effects"); if (this.m_kEffectModelRoot == null) { this.m_kEffectModelRoot = new GameObject("@internal effects"); UnityEngine.Object.DontDestroyOnLoad(this.m_kEffectModelRoot); } } if (this.m_kEffectGameObject.ContainsKey(effectKind)) { return; } GameObject gameObject = UnityEngine.Object.Instantiate(originalEffect) as GameObject; if (gameObject == null) { return; } UnityEngine.Object.DontDestroyOnLoad(gameObject); try { gameObject.name = "@" + effectKind; gameObject.transform.parent = this.m_kEffectModelRoot.transform; NkUtil.SetAllChildActive(gameObject, false); this.m_kEffectGameObject.Add(effectKind, gameObject); } catch (ArgumentException ex) { Debug.LogWarning(string.Concat(new object[] { "Already registered effect key : key=", effectKind, " (", ex, ")" })); } }
private void _MakeEffect(NkEffectUnit kEffectUnit, GameObject goOriginal) { GameObject gameObject = this._GetEffectGameObject(kEffectUnit.EffectKind, goOriginal); if (null == gameObject) { Debug.LogError(kEffectUnit.EffectKind + "Make Fail:"); return; } kEffectUnit.m_goEffect = gameObject; kEffectUnit.MakeProcess(); this.RegistAdaptor(gameObject, kEffectUnit); switch (kEffectUnit.EffectType) { case eEFFECT_TYPE.INSTANT: case eEFFECT_TYPE.CHAREFFECT: if (gameObject.animation != null) { if (!gameObject.animation.enabled) { gameObject.animation.enabled = true; } gameObject.animation.Play(); } break; case eEFFECT_TYPE.BULLET: { gameObject.SetActive(false); TrailRenderer componentInChildren = gameObject.GetComponentInChildren <TrailRenderer>(); if (componentInChildren != null) { componentInChildren.enabled = false; kEffectUnit.m_TrailerRenderer = componentInChildren; } NkUtil.SetAllChildActive(gameObject, false); break; } } this.m_kEffectList.Add(kEffectUnit.RegistNum, kEffectUnit); if (kEffectUnit.LifeTime > 0f) { this.m_kLifeTimeEffectList.Add(kEffectUnit.RegistNum); } }
public static void SetAllChildActiveRecursive(GameObject goTarget, bool bActive) { if (null == goTarget) { return; } int childCount = goTarget.transform.childCount; for (int i = 0; i < childCount; i++) { Transform child = goTarget.transform.GetChild(i); if (!(child == null)) { NkUtil.SetAllChildActive(child.gameObject, bActive); } } goTarget.SetActive(bActive); }
public void SetShowHeadUp(bool bShow) { if (this.m_pkHeadUpRoot == null) { return; } if (this.m_pkNameSprite != null) { CharNameBillboardSprite component = this.m_pkNameSprite.GetComponent <CharNameBillboardSprite>(); if (component != null) { component.SetShowHide(bShow); } } if (this.m_pkChatSprite != null) { CharChatBillboardSprite component2 = this.m_pkChatSprite.GetComponent <CharChatBillboardSprite>(); if (component2 != null) { component2.SetShowHide(bShow); } } if (this.m_pkCharStatus != null) { NkUtil.SetAllChildActive(this.m_pkCharStatus, bShow); NkUtil.SetShowHideRenderer(this.m_pkCharStatus, bShow, true); } if (this.m_pkGuildSprite != null) { CharNameBillboardSprite component3 = this.m_pkGuildSprite.GetComponent <CharNameBillboardSprite>(); if (component3 != null) { component3.SetShowHide(bShow); } } this.m_bShowHeadUp = bShow; if (bShow) { this.SyncBillboardRotate(true); } }
private GameObject _GetEffectGameObject(string effectKind) { if (!this.m_kEffectGameObject.ContainsKey(effectKind)) { return(null); } GameObject gameObject = this.m_kEffectGameObject[effectKind]; if (null == gameObject) { return(null); } GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject, Vector3.zero, Quaternion.identity) as GameObject; if (null == gameObject2) { return(null); } gameObject2.name = effectKind; gameObject2.transform.rotation = gameObject.transform.rotation; gameObject2.transform.localScale = gameObject.transform.localScale; NkUtil.SetAllChildActive(gameObject2, true); return(gameObject2); }
public void _RegisterPlayerModel(GameObject originalPlayer, string assetPath, string charcode) { if (originalPlayer == null) { return; } GameObject gameObject = UnityEngine.Object.Instantiate(originalPlayer) as GameObject; if (gameObject == null) { return; } if (this.m_mapPlayerModels.ContainsKey(charcode)) { return; } AudioSource[] components = gameObject.GetComponents <AudioSource>(); AudioSource[] array = components; for (int i = 0; i < array.Length; i++) { AudioSource audioSource = array[i]; if (audioSource.clip == null) { audioSource.clip = TsAudioManager.Instance.GetTempClip(); } } UnityEngine.Object.DontDestroyOnLoad(gameObject); charcode = charcode.ToLower(); Animation animation = gameObject.animation; if (animation) { animation.playAutomatically = false; try { if (this.m_kPlayerModelRoot == null) { this.m_kPlayerModelRoot = GameObject.Find("@internal chars"); if (this.m_kPlayerModelRoot == null) { this.m_kPlayerModelRoot = new GameObject("@internal chars"); UnityEngine.Object.DontDestroyOnLoad(this.m_kPlayerModelRoot); } } try { gameObject.name = "@" + charcode; gameObject.transform.parent = this.m_kPlayerModelRoot.transform; gameObject.animation.enabled = false; NkUtil.SetAllChildActive(gameObject, false); this.m_mapPlayerModels.Add(charcode, gameObject); } catch (ArgumentException ex) { Debug.LogWarning(string.Concat(new object[] { "[narlamy] already registered key : key=", charcode, ", Path=", assetPath, " (", ex, ")" })); } } catch (NullReferenceException arg) { Debug.LogError("[narlamy] register model => error (null object) " + arg); } catch (Exception message) { Debug.Log(message); } } }
public static void SetAllChildActive(GameObject goTarget, bool bActive) { NkUtil.SetAllChildActive(goTarget, bActive, false); }