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 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); }
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); }
private Nr3DCharBase Get3DChar(int id) { Nr3DCharBase result; if (id <= 300) { NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(id); if (@char == null) { return(null); } result = @char.Get3DChar(); } else { id -= 300; NkBattleChar char2 = NrTSingleton <NkBattleCharManager> .Instance.GetChar(id); if (char2 == null) { return(null); } result = char2.Get3DChar(); } return(result); }
public NkBattleChar GetChar(GameObject kGameObj) { NkBattleChar[] arChar = this.m_arChar; for (int i = 0; i < arChar.Length; i++) { NkBattleChar nkBattleChar = arChar[i]; if (nkBattleChar != null) { if (nkBattleChar.Get3DChar() != null) { if (nkBattleChar.Get3DChar().GetRootGameObject() == kGameObj) { return(nkBattleChar); } } } } return(null); }
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 ChangeCharLayer(eBATTLE_ALLY eBattleAlly, short nExceptBUID, bool bShow, bool bNameCheck) { NkBattleChar[] arChar = this.m_arChar; for (int i = 0; i < arChar.Length; i++) { NkBattleChar nkBattleChar = arChar[i]; if (nkBattleChar != null && nkBattleChar.m_k3DChar != null) { if (nkBattleChar.Ally == eBattleAlly && nkBattleChar.GetBUID() != nExceptBUID) { if (!bShow) { nkBattleChar.Get3DChar().SetLayer(TsLayer.BLOCK); } else { switch (nkBattleChar.GetCharKindType()) { case eCharKindType.CKT_USER: nkBattleChar.Get3DChar().SetLayer(TsLayer.PC); break; case eCharKindType.CKT_SOLDIER: nkBattleChar.Get3DChar().SetLayer(TsLayer.NPC, TsTag.NPC_MOB.ToString()); break; case eCharKindType.CKT_MONSTER: nkBattleChar.Get3DChar().SetLayer(TsLayer.NPC, TsTag.NPC_MOB.ToString()); break; case eCharKindType.CKT_NPC: nkBattleChar.Get3DChar().SetLayer(TsLayer.NPC, TsTag.NPC_QUEST.ToString()); break; case eCharKindType.CKT_OBJECT: nkBattleChar.Get3DChar().SetLayer(TsLayer.NPC, TsTag.NPC_EXTRA.ToString()); break; default: nkBattleChar.Get3DChar().SetLayer(TsLayer.NPC, TsTag.NPC_EXTRA.ToString()); break; } } } if (nkBattleChar.Ally != eBattleAlly) { nkBattleChar.SetShowHeadUp(bShow, !bShow, true); } } } }
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 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 void SetLastAttackCamera(NkBattleChar pkTarget, bool bSet) { if (bSet) { if (pkTarget == null) { return; } if (pkTarget.Get3DChar() == null) { Debug.LogError("ERROR, SetLastAttackCamera(), pkTarget.Get3DChar() is Null"); return; } if (pkTarget.Get3DChar().GetRootGameObject() == null) { Debug.LogError("ERROR, SetLastAttackCamera(), pkTarget.Get3DChar().GetRootGameObject() is Null"); return; } GameObject gameObject = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene); if (gameObject == null) { return; } Transform child = NkUtil.GetChild(gameObject.transform, "Main Camera"); if (child == null) { return; } maxCamera component = child.GetComponent <maxCamera>(); if (component == null) { return; } Transform child2 = NkUtil.GetChild(pkTarget.Get3DChar().GetRootGameObject().transform, "dmaction1"); if (child2 != null) { Transform child3 = NkUtil.GetChild(child2, "actioncam"); if (child3 != null) { Camera component2 = child3.GetComponent <Camera>(); if (component2 == null) { return; } if (component2.renderingPath != RenderingPath.Forward) { component2.renderingPath = RenderingPath.Forward; } component2.backgroundColor = new Color(0f, 0f, 0f); if (component2 != null) { component.enabled = false; Camera component3 = child.GetComponent <Camera>(); if (component3 == null) { return; } int cullingMask = component3.cullingMask; component3.CopyFrom(component2); component3.cullingMask = cullingMask; if (NrBattleCamera.m_BackupCameraData == null) { return; } NrBattleCamera.m_BackupCameraData.trParent = child.parent; child.parent = child2; NrBattleCamera.m_BackupCameraData.CameraLevel = component.m_nCameraLevel; NrBattleCamera.m_BackupCameraData.checkbackup = true; if (this.m_TargetGo != null) { this.m_veTriggerStartPos = this.m_TargetGo.transform.position; } this.SetcameraPos(pkTarget.GetCharPos()); Transform child4 = NkUtil.GetChild(gameObject.transform, "@battlemap"); if (child4 != null) { Transform child5 = NkUtil.GetChild(child4, "normal1"); if (child5 != null) { child5.gameObject.SetActive(false); this.m_SkyBoxMaterial = RenderSettings.skybox; RenderSettings.skybox = null; NrTSingleton <NkBattleCharManager> .Instance.ShowHideAlly(pkTarget.Ally, pkTarget.GetBUID(), false, true); Battle.BATTLE.GRID_MANAGER.ShowHideGrid(false); } } GameObject gameObject2 = GameObject.Find("UI Camera"); if (gameObject2 != null) { Camera componentInChildren = gameObject2.GetComponentInChildren <Camera>(); if (componentInChildren != null) { componentInChildren.enabled = false; } } Battle.BATTLE.InputControlTrigger = true; } } } } else { if (NrBattleCamera.m_BackupCameraData == null) { return; } if (NrBattleCamera.m_BackupCameraData.checkbackup && NrBattleCamera.m_BackupCameraData.trParent != null) { GameObject gameObject3 = TsSceneSwitcher.Instance._GetSwitchData_RootSceneGO(TsSceneSwitcher.ESceneType.BattleScene); if (gameObject3 == null) { return; } Transform child6 = NkUtil.GetChild(gameObject3.transform, "Main Camera"); if (child6 == null) { return; } maxCamera component4 = child6.GetComponent <maxCamera>(); if (component4 == null) { return; } if (!component4.enabled && NrBattleCamera.m_BackupCameraData.trParent != null) { child6.parent = NrBattleCamera.m_BackupCameraData.trParent; component4.enabled = true; NrBattleCamera.m_BackupCameraData.trParent = null; } component4.m_nCameraLevel = NrBattleCamera.m_BackupCameraData.CameraLevel; component4.SetLevelValue(); NrBattleCamera.m_BackupCameraData.checkbackup = false; this.SetcameraPos(this.m_veTriggerStartPos); Battle.BATTLE.InputControlTrigger = false; Transform child7 = NkUtil.GetChild(gameObject3.transform, "@battlemap"); if (child7 != null) { Transform child8 = NkUtil.GetChild(child7, "normal1"); if (child8 != null) { child8.gameObject.SetActive(true); if (this.m_SkyBoxMaterial != null) { RenderSettings.skybox = this.m_SkyBoxMaterial; this.m_SkyBoxMaterial = null; } NrTSingleton <NkBattleCharManager> .Instance.ShowHideAlly(pkTarget.Ally, pkTarget.GetBUID(), true, true); Battle.BATTLE.GRID_MANAGER.ShowHideGrid(true); } } GameObject gameObject4 = GameObject.Find("UI Camera"); if (gameObject4 != null) { Camera componentInChildren2 = gameObject4.GetComponentInChildren <Camera>(); if (componentInChildren2 != null) { componentInChildren2.enabled = true; } } } } }
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)); }