public NkEffectUnit(EFFECT_INFO effectInfo, NkBattleChar OrderChar, bool bAttachEffectPos, bool CheckScale) { GameObject gameObject = null; Nr3DCharBase nr3DCharBase = OrderChar.Get3DChar(); if (nr3DCharBase != null) { gameObject = nr3DCharBase.GetRootGameObject(); } Vector3 v3Target = Vector3.zero; Transform effectPos = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS); if (null != effectPos) { v3Target = effectPos.position; } if (effectInfo.EFFECT_POS == eEFFECT_POS.BONE && nr3DCharBase != null) { gameObject = nr3DCharBase.GetBoneRootObject(); if (gameObject == null) { gameObject = nr3DCharBase.GetRootGameObject(); } v3Target = Vector3.zero; v3Target.y = -1f; } this.m_CasterChar = OrderChar; if (bAttachEffectPos && effectPos != null) { gameObject = effectPos.gameObject; v3Target = Vector3.zero; } this.m_CheckScale = CheckScale; this.InitBase(eEFFECT_TARGET.GAMEOBJECT, effectInfo, gameObject, v3Target); }
public bool MoveTo(float x, float y, float z) { this.SetTargetPos(x, y, z); Nr3DCharBase nr3DCharBase = this.m_pkChar.Get3DChar(); if (nr3DCharBase == null) { return(false); } if (!nr3DCharBase.IsCreated() || !nr3DCharBase.Is3DCharActive()) { return(false); } NrCharDefine.eMoveTargetReason eMoveTargetReason = this.IsMovableArea(x, z); if (eMoveTargetReason != NrCharDefine.eMoveTargetReason.MTR_SUCCESS) { Vector3 lhs = Vector3.zero; lhs = this.FindMovableDestination(this.m_vTargetPos, eMoveTargetReason); if (lhs == Vector3.zero) { this.SetTargetPos(0f, 0f, 0f); return(false); } this.SetTargetPos(lhs.x, lhs.y, lhs.z); } if (this.m_vCharPos.x == this.m_vTargetPos.x && this.m_vCharPos.z == this.m_vTargetPos.z) { return(true); } this.MoveStart(); return(true); }
public NkEffectUnit(EFFECT_INFO effectInfo, NkBattleChar OrderChar) { GameObject gameObject = null; Transform transform = null; Nr3DCharBase nr3DCharBase = OrderChar.Get3DChar(); if (nr3DCharBase != null) { gameObject = nr3DCharBase.GetRootGameObject(); transform = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS); } Vector3 v3Target = Vector3.zero; if (null != transform) { v3Target = transform.position; } if (effectInfo.EFFECT_POS == eEFFECT_POS.BONE && nr3DCharBase != null) { gameObject = nr3DCharBase.GetBoneRootObject(); if (gameObject == null) { gameObject = nr3DCharBase.GetRootGameObject(); } v3Target = Vector3.zero; v3Target.y = -1f; } this.m_CasterChar = OrderChar; this.InitBase(eEFFECT_TARGET.POSITION, effectInfo, gameObject, v3Target); }
private void InitBase(eEFFECT_TARGET eType, EFFECT_INFO effectInfo, GameObject goParent, Vector3 v3Target) { this.m_eEffectTarget = eType; this.m_kEffectInfo = effectInfo; if (this.m_CasterChar != null) { Nr3DCharBase nr3DCharBase = this.m_CasterChar.Get3DChar(); if (nr3DCharBase != null) { this.m_fScale = this.m_kEffectInfo.SCALE * nr3DCharBase.GetDiffCharScale(); } else { this.m_fScale = this.m_kEffectInfo.SCALE; } } else { this.m_fScale = this.m_kEffectInfo.SCALE; } if (this.m_fScale < this.m_kEffectInfo.SCALE) { this.m_fScale = this.m_kEffectInfo.SCALE; } this.m_fStartTime = Time.time; this.m_goParent = goParent; this.m_v3Target = v3Target + this.m_kEffectInfo.DIFFPOS; this.m_fLifeTime = this.m_kEffectInfo.LIFE_TIME; this.m_eMakeScene = Scene.CurScene; }
public uint AddCenterPosEffect(string effectKind, NkBattleChar kBattleChar, Vector3 v3CenterPos) { if (this.m_bDontMakeEffect && NrTSingleton <NkEffectManager> .Instance.isEffectLimit(effectKind)) { return(0u); } if (kBattleChar == null) { return(0u); } Nr3DCharBase nr3DCharBase = kBattleChar.Get3DChar(); if (nr3DCharBase == null) { return(0u); } EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind); if (effectInfo == null) { return(0u); } Transform effectPos = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS); if (null != effectPos) { v3CenterPos.y = effectPos.position.y; } NkEffectUnit kEffectUnit = new NkEffectUnit(effectInfo, nr3DCharBase.GetRootGameObject(), v3CenterPos); return(this._AddEffect(kEffectUnit)); }
public void Init() { this.m_pkTarget3DChar = null; this.m_pkTargetKind = null; this.m_bOnlyWeaponControl = false; this.m_kCharPartInfo.Init(); this.m_bReadyPartInfo = false; }
public void NrAnimationEndCallbackEvt(AnimationEvent kAnimationEvt) { Nr3DCharBase nr3DCharBase = NrTSingleton <Nr3DCharSystem> .Instance.Get3DChar(kAnimationEvt.intParameter); if (nr3DCharBase == null) { Debug.LogError("3DChar not found!"); Debug.Break(); } nr3DCharBase.StartIdleAnimation(true); }
public uint AddEffect(string effectKind, NrCharBase kCharBase) { if (kCharBase == null) { return(0u); } Nr3DCharBase nr3DCharBase = kCharBase.Get3DChar(); if (nr3DCharBase == null) { return(0u); } EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind); if (effectInfo == null) { return(0u); } GameObject gameObject = nr3DCharBase.GetRootGameObject(); Vector3 v3Target = Vector3.zero; Transform effectPos = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS); if (null != effectPos) { v3Target = effectPos.position; if (effectInfo.EFFECT_POS == eEFFECT_POS.CENTERDM) { gameObject = effectPos.gameObject; } } if (effectInfo.EFFECT_POS == eEFFECT_POS.BONE) { gameObject = nr3DCharBase.GetBoneRootObject(); if (gameObject == null) { gameObject = nr3DCharBase.GetRootGameObject(); } v3Target = Vector3.zero; v3Target.y = -1f; } NkEffectUnit kEffectUnit; if (effectInfo.EFFECT_POS == eEFFECT_POS.CENTERDM) { kEffectUnit = new NkEffectUnit(effectInfo, gameObject); } else { kEffectUnit = new NkEffectUnit(effectInfo, gameObject, v3Target); } return(this._AddEffect(kEffectUnit)); }
public uint AddCasterEffect(string effectKind, NkBattleChar kBattleChar) { if (this.m_bDontMakeEffect && NrTSingleton <NkEffectManager> .Instance.isEffectLimit(effectKind)) { return(0u); } if (kBattleChar == null) { return(0u); } Nr3DCharBase nr3DCharBase = kBattleChar.Get3DChar(); if (nr3DCharBase == null) { return(0u); } Transform effectTarget = nr3DCharBase.GetEffectTarget(); if (effectTarget == null) { return(0u); } EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind); if (effectInfo == null) { return(0u); } GameObject goTarget = nr3DCharBase.GetRootGameObject(); Transform effectPos = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS); if (null != effectPos && effectInfo.EFFECT_POS == eEFFECT_POS.CENTERDM) { goTarget = effectPos.gameObject; } NkEffectUnit kEffectUnit; if (effectInfo.EFFECT_POS == eEFFECT_POS.CENTERDM) { kEffectUnit = new NkEffectUnit(effectInfo, goTarget); } else { kEffectUnit = new NkEffectUnit(effectInfo, kBattleChar); } return(this._AddEffect(kEffectUnit)); }
public NkEffectUnit(EFFECT_INFO effectInfo, NkBattleChar OrderChar, Vector3 v3CenterTarget) { GameObject goParent = null; Nr3DCharBase nr3DCharBase = OrderChar.Get3DChar(); if (nr3DCharBase != null) { goParent = nr3DCharBase.GetRootGameObject(); } Transform effectPos = nr3DCharBase.GetEffectPos(effectInfo.EFFECT_POS); if (null != effectPos) { v3CenterTarget.y = effectPos.position.y; } this.m_CasterChar = OrderChar; this.InitBase(eEFFECT_TARGET.POSITION, effectInfo, goParent, v3CenterTarget); }
public bool IsValidAniState(eCharAnimationType _anitype) { Nr3DCharBase pkParent3DChar = this.m_pkParent3DChar; if (pkParent3DChar == null) { return(false); } GameObject baseObject = pkParent3DChar.GetBaseObject(); if (baseObject == null) { return(false); } string name = this.m_pkParent3DChar.MakeAnimationKey(_anitype); return(baseObject.animation.GetClip(name) != null); }
public override void Update() { base.Update(); this.OnGeneralTouchCallback(); if (this.m_TargetChar != null && this.m_TargetChar.CastedTarget != null) { Nr3DCharBase nr3DCharBase = this.m_TargetChar.CastedTarget.Get3DChar(); if (nr3DCharBase != null) { Vector2 zero = Vector2.zero; Vector2 zero2 = Vector2.zero; Vector3 pos = Vector3.zero; pos = nr3DCharBase.GetRootGameObject().transform.position; pos = GUICamera.WorldToEZ(pos); zero = new Vector2(pos.x, pos.y - 150f); zero2 = new Vector2(pos.x - 20f, pos.y - 190f); this.Move(zero, zero2); } } if (this._ScreenWidth != GUICamera.width || this._ScreenHeight != GUICamera.height) { this.ResizeDlg(); } if (this.m_nOtherWinID != G_ID.NONE) { Form form = NrTSingleton <FormsManager> .Instance.GetForm(this.m_nOtherWinID); if (form != null) { form.SetLocation(form.GetLocationX(), form.GetLocationY(), NrTSingleton <FormsManager> .Instance.GetTopMostZ() - 1f); } } if (!this.bAutoClose) { return; } if (Time.realtimeSinceStartup > this.fCloseTime) { this.Close(); } }
public bool AdjustMovePosByCollision(Nr3DCharBase kChar, ref Vector2 vMovePos, bool bAlly) { if (Battle.BATTLE.m_bOnlyServerMove) { return(false); } if (kChar.GetCharController() == null) { return(false); } Vector2 b = Vector2.zero; bool result = false; for (int i = 1; i < 120; i++) { NkBattleChar nkBattleChar = this.m_arChar[i]; if (nkBattleChar != null) { Nr3DCharBase nr3DCharBase = nkBattleChar.Get3DChar(); if (!(nr3DCharBase.GetCharController() == null)) { if (nr3DCharBase.GetID() != kChar.GetID()) { if (bAlly || nr3DCharBase.GetParentBattleChar().Ally != kChar.GetParentBattleChar().Ally) { b = vMovePos - new Vector2(nr3DCharBase.GetParentBattleChar().GetCharPos().x, nr3DCharBase.GetParentBattleChar().GetCharPos().z); float num = Vector2.Distance(Vector2.zero, b); float num2 = kChar.GetParentBattleChar().GetCharHalfBound() + nr3DCharBase.GetParentBattleChar().GetCharHalfBound() - num; if (num2 >= 0f) { this.GetTurningPos(kChar, nr3DCharBase, ref vMovePos); result = true; } } } } } } return(result); }
public float PlayTimeAniState(eCharAnimationType _anitype) { Nr3DCharBase pkParent3DChar = this.m_pkParent3DChar; if (pkParent3DChar == null) { return(0f); } GameObject baseObject = pkParent3DChar.GetBaseObject(); if (baseObject == null) { return(0f); } string name = this.m_pkParent3DChar.MakeAnimationKey(_anitype); if (this.IsValidAniState(_anitype)) { return(baseObject.animation[name].length); } return(0f); }
public uint AddEffectByTarget(string effectKind, NrCharBase kCharBase, Vector3 diffPos) { if (kCharBase == null) { return(0u); } Nr3DCharBase nr3DCharBase = kCharBase.Get3DChar(); if (nr3DCharBase == null) { return(0u); } EFFECT_INFO effectInfo = NrTSingleton <NkEffectManager> .Instance.GetEffectInfo(effectKind); if (effectInfo == null) { return(0u); } NkEffectUnit kEffectUnit = new NkEffectUnit(effectInfo, nr3DCharBase.GetRootGameObject(), diffPos); return(this._AddEffect(kEffectUnit)); }
public Nr3DCharBase GetCollisionChar(Nr3DCharBase kChar, Vector2 movepos) { if (kChar.GetCharController() == null) { return(null); } Vector3 vector = Vector3.zero; float num = -3.40282347E+38f; NkBattleChar nkBattleChar = null; NkBattleChar[] charArray = this.GetCharArray(); for (int i = 0; i < charArray.Length; i++) { NkBattleChar nkBattleChar2 = charArray[i]; if (nkBattleChar2 != null) { if (nkBattleChar2.GetBUID() != kChar.GetParentBattleChar().GetBUID()) { if (!(nkBattleChar2.Get3DChar().GetCharController() == null)) { vector = nkBattleChar2.Get3DChar().GetCharController().transform.position; float num2 = kChar.GetParentBattleChar().GetCharHalfBound() + nkBattleChar2.GetCharHalfBound(); float num3 = Vector2.Distance(movepos, new Vector2(vector.x, vector.z)); if (num3 <= num2 && num2 - num3 > num) { num = num2 - num3; nkBattleChar = nkBattleChar2; } } } } } if (nkBattleChar != null) { return(nkBattleChar.Get3DChar()); } return(null); }
public void Init(string charcode, Nr3DCharBase k3DChar, eCharKindType chartype) { this.m_szCharCode = charcode; switch (chartype) { case eCharKindType.CKT_USER: this.m_pkParent3DChar = (k3DChar as Nr3DCharActor); break; case eCharKindType.CKT_SOLDIER: case eCharKindType.CKT_MONSTER: case eCharKindType.CKT_NPC: this.m_pkParent3DChar = (k3DChar as Nr3DCharNonePart); break; case eCharKindType.CKT_OBJECT: this.m_pkParent3DChar = (k3DChar as Nr3DCharObject); break; default: this.m_pkParent3DChar = k3DChar; break; } this.m_eCurrentAniType = eCharAnimationType.Stay1; this.m_ePrevAniType = eCharAnimationType.Stay1; this.m_bLoop = false; this.m_eNextAniTypeList.Clear(); this.m_bProcessStatus = true; this.m_nSetAniCount = 0; this.m_bFinishAnimationFrame = false; this.m_bBattleState = false; this.m_CurrentAniState = null; this.m_fAniPlayingTime = 0f; this.m_fAnimationLength = 0f; this.AttachFacialAnimation(); }
public void GetTurningPos(Nr3DCharBase kChar, Nr3DCharBase k3DChar, ref Vector2 vMovePos) { float x = kChar.GetCharController().transform.position.x; float z = kChar.GetCharController().transform.position.z; float x2 = vMovePos.x; float y = vMovePos.y; Vector2 b = Vector2.zero; for (int i = 44; i < 180; i += 2) { double num = (double)i / 180.0 * 3.1414999961853027; float x3 = (float)Math.Cos(num) * (x2 - x) - (float)Math.Sin(num) * (y - z) + x; float y2 = (float)Math.Sin(num) * (x2 - x) + (float)Math.Cos(num) * (y - z) + z; b = new Vector2(x3, y2) - new Vector2(k3DChar.GetParentBattleChar().GetCharPos().x, k3DChar.GetParentBattleChar().GetCharPos().z); float num2 = Vector2.Distance(Vector2.zero, b); float num3 = kChar.GetParentBattleChar().GetCharHalfBound() + k3DChar.GetParentBattleChar().GetCharHalfBound() - num2; if (num3 < 0f) { vMovePos.x = x3; vMovePos.y = y2; return; } } }
public Vector2 ObstacleAvoidance(Nr3DCharBase kChar, Vector2 curPos, Vector2 dir) { if (kChar.GetCharController() == null) { return(Vector2.zero); } float num = 10f; float num2 = 3.40282347E+38f; Nr3DCharBase nr3DCharBase = null; Vector2 vector = Vector2.zero; NkBattleChar[] charArray = this.GetCharArray(); for (int i = 0; i < charArray.Length; i++) { NkBattleChar nkBattleChar = charArray[i]; if (nkBattleChar != null) { Nr3DCharBase nr3DCharBase2 = nkBattleChar.Get3DChar(); if (nkBattleChar.GetBUID() != kChar.GetParentBattleChar().GetBUID()) { if (!(nr3DCharBase2.GetCharController() == null)) { Vector2 pos = new Vector2(nr3DCharBase2.GetCharController().transform.position.x, nr3DCharBase2.GetCharController().transform.position.z); Vector2 vector2 = this.PointToLocalSpace(pos, dir, curPos); if (vector2.x >= 0f) { float num3 = kChar.GetParentBattleChar().GetCharHalfBound() + nr3DCharBase2.GetParentBattleChar().GetCharHalfBound(); if (Mathf.Abs(vector2.y) < num3) { float x = vector2.x; float y = vector2.y; float num4 = Mathf.Sqrt(num3 * num3 - y * y); float num5 = x - num4; if (num5 <= 0f) { num5 = x + num4; } if (num5 < num2) { num2 = num5; nr3DCharBase = nr3DCharBase2; vector = vector2; } } } } } } } Vector2 zero = Vector2.zero; if (nr3DCharBase != null) { float num6 = 1f + (num - vector.x) / num; zero.y = (nr3DCharBase.GetParentBattleChar().GetCharHalfBound() - vector.y) * num6; zero.x = (nr3DCharBase.GetParentBattleChar().GetCharHalfBound() - vector.x) * 0.2f; if (kChar.GetParentBattleChar().GetBUID() == 0) { Debug.Log("*** TYS : steering Force " + zero); Debug.Log("*** TYS : closestIntersectionObstacle " + nr3DCharBase.GetCharCode()); } } return(this.VectorToWorldSpace(zero, dir)); }
public void SetPartControl(Nr3DCharBase pk3DChar, bool bOnlyWeapon) { this.m_pkTarget3DChar = pk3DChar; this.m_bOnlyWeaponControl = bOnlyWeapon; }
public void ProcessBundleCallBack(IDownloadedItem wItem, object kParamObj) { if (wItem == null || kParamObj == null) { return; } NkBundleParam nkBundleParam = kParamObj as NkBundleParam; string bundleKey = nkBundleParam.GetBundleKey(); if (!wItem.canAccessAssetBundle) { switch (nkBundleParam.GetBundleType()) { case NkBundleParam.eBundleType.BUNDLE_CHAR_BONE: case NkBundleParam.eBundleType.BUNDLE_CHAR_BONEPRELOAD: case NkBundleParam.eBundleType.BUNDLE_CHAR_SWITCHPART: case NkBundleParam.eBundleType.BUNDLE_CHAR_ATTACHPART: case NkBundleParam.eBundleType.BUNDLE_CHAR_ATTACHITEM: case NkBundleParam.eBundleType.BUNDLE_CHAR_RIDE: case NkBundleParam.eBundleType.BUNDLE_CHAR_NONEPART: case NkBundleParam.eBundleType.BUNDLE_CHAR_OBJECT: { if (nkBundleParam.GetBundleType() == NkBundleParam.eBundleType.BUNDLE_CHAR_BONEPRELOAD) { this.m_fPreloadCount -= 1f; } int id = int.Parse(bundleKey); Nr3DCharBase nr3DCharBase = this.Get3DChar(id); if (nr3DCharBase == null) { return; } bool itembundle = nkBundleParam.GetBundleType() == NkBundleParam.eBundleType.BUNDLE_CHAR_ATTACHITEM; nr3DCharBase.InitBundleLoadFailed(itembundle, wItem.indexParam); if (nkBundleParam.GetBundleType() == NkBundleParam.eBundleType.BUNDLE_CHAR_NONEPART || nkBundleParam.GetBundleType() == NkBundleParam.eBundleType.BUNDLE_CHAR_OBJECT) { nr3DCharBase.Set3DCharLoadFailed(true); } if (Scene.IsCurScene(Scene.Type.SELECTCHAR)) { MsgHandler.Handle("SetCreateCharPartInfo", new object[] { true, false }); } break; } } return; } WWWItem wWWItem = wItem as WWWItem; if (wWWItem != null) { wWWItem.SetIndexParam(nkBundleParam.GetNumParam()); wWWItem.SetStringParam(nkBundleParam.GetStrParam()); } switch (nkBundleParam.GetBundleType()) { case NkBundleParam.eBundleType.BUNDLE_CHAR_BONE: case NkBundleParam.eBundleType.BUNDLE_CHAR_BONEPRELOAD: this.FinishDownloadAsync(wItem, nkBundleParam); if (nkBundleParam.GetBundleType() == NkBundleParam.eBundleType.BUNDLE_CHAR_BONEPRELOAD) { this.m_fPreloadCount -= 1f; } break; case NkBundleParam.eBundleType.BUNDLE_CHAR_ANIMATION: NrTSingleton <Nr3DCharSystem> .Instance.FinishDownloadAnimation(wItem); break; case NkBundleParam.eBundleType.BUNDLE_CHAR_SWITCHPART: { int id2 = int.Parse(bundleKey); Nr3DCharActor nr3DCharActor = this.Get3DChar(id2) as Nr3DCharActor; if (nr3DCharActor == null) { return; } nr3DCharActor.FinishDownloadPart(ref wItem); break; } case NkBundleParam.eBundleType.BUNDLE_CHAR_ATTACHPART: case NkBundleParam.eBundleType.BUNDLE_CHAR_ATTACHITEM: { int id3 = int.Parse(bundleKey); Nr3DCharBase nr3DCharBase2 = this.Get3DChar(id3); if (nr3DCharBase2 == null) { return; } nr3DCharBase2.FinishDownloadItem(ref wItem); break; } case NkBundleParam.eBundleType.BUNDLE_CHAR_RIDE: { int id4 = int.Parse(bundleKey); Nr3DCharActor nr3DCharActor2 = this.Get3DChar(id4) as Nr3DCharActor; if (nr3DCharActor2 == null) { return; } nr3DCharActor2.FinishDownloadRide(ref wItem); break; } case NkBundleParam.eBundleType.BUNDLE_CHAR_NONEPART: case NkBundleParam.eBundleType.BUNDLE_CHAR_OBJECT: { int id5 = int.Parse(bundleKey); Nr3DCharBase nr3DCharBase3 = this.Get3DChar(id5); if (nr3DCharBase3 == null) { return; } nr3DCharBase3.FinishDownloadBase(ref wItem); break; } case NkBundleParam.eBundleType.BUNDLE_UI_DIALOG: { int indexParam = wItem.indexParam; Form form = NrTSingleton <FormsManager> .Instance.GetForm((G_ID)indexParam); if (form == null) { return; } form.FinishDownloadBundle(ref wItem); break; } case NkBundleParam.eBundleType.BUNDLE_NORMAL_CALLBACK: nkBundleParam.funcCallBack(ref wItem); break; case NkBundleParam.eBundleType.BUNDLE_OBJECTPARAM_CALLBACK: nkBundleParam.funcParamCallBack(ref wItem, nkBundleParam.GetParamObject()); break; default: return; } }
public bool Destroy3DChar(Nr3DCharBase k3DCharInst) { return(this.Destroy3DChar(k3DCharInst.GetID())); }