public static float CalcHeight(Vector3 pos) { float result = 0f; float y = pos.y; pos.y = 200f; Vector3 vector = Vector3.zero; Ray ray = new Ray(pos, new Vector3(0f, -1f, 0f)); if (NkRaycast.Raycast(ray)) { vector = NkRaycast.POINT; RaycastHit hIT = NkRaycast.HIT; if (hIT.transform != null) { if (hIT.transform.position == Vector3.zero) { result = NrTSingleton <NrTerrain> .Instance.SampleHeight(pos); } else { result = hIT.transform.collider.ClosestPointOnBounds(pos).y; } } } pos.y = y; return(result); }
private void UpdateWalkEffect(bool bDirectUpdate) { NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1); if (@char != null) { bool flag = @char.m_kCharMove.IsMoving(); bool flag2 = this.preRunState != flag; if (!bDirectUpdate && !flag2) { return; } this.preRunState = flag; Vector3 centerPosition = @char.GetCenterPosition(); Vector3 vPos = @char.m_kCharMove.GetCharPos(); string effectKey = string.Empty; Ray ray = new Ray(centerPosition, Vector3.down); if (NkRaycast.Raycast(ray)) { effectKey = this.GetEffectState(NkRaycast.HIT.transform, flag); vPos = NkRaycast.HIT.point; Debug.DrawRay(ray.origin, ray.direction * 1000f, Color.black); } @char.OnWalkEffect(effectKey, vPos); } }
public static bool Raycast(float fDistance, int Mask) { if (null == Camera.main) { return(NkRaycast.SetHitFaile()); } Ray ray = Camera.main.ScreenPointToRay(NkInputManager.mousePosition); return(NkRaycast.UpdateRayCast(ray, fDistance, Mask)); }
public static Vector3 GetHitPointFromVector2(Vector2 vPos) { Ray ray = new Ray(new Vector3(vPos.x, 200f, vPos.y), Vector3.down); int mask = 256; if (NkRaycast.Raycast(ray, float.PositiveInfinity, mask)) { return(NkRaycast.POINT); } return(Vector3.zero); }
private static bool UpdateRayCast(Ray ray, float fDistance, int Mask) { if (NkRaycast.UpdateRay(ray, fDistance, Mask)) { if (Physics.Raycast(ray, out NkRaycast.m_Hit, fDistance, Mask)) { NkRaycast.m_bHit = true; } else { NkRaycast.m_bHit = false; NkRaycast.SetHitFaile(); } } return(NkRaycast.m_bHit); }
private bool Raycast(Vector3 _Pos, ref Vector3 _Vertex) { GameObject gameObject = GameObject.Find("battle_height"); if (gameObject != null) { _Vertex = _Pos; _Vertex.y = gameObject.transform.position.y; return(true); } Vector3 down = Vector3.down; float fDistance = 1000f; if (NkRaycast.Raycast(new Ray(_Pos, down), fDistance, SoldierBatchGridCell.mc_kPickLayer)) { _Vertex = NkRaycast.POINT; return(true); } return(false); }
public float GetBattleMapHeight(Vector3 pos) { Terrain component = this.m_BattleTerrain.GetComponent <Terrain>(); float num = 0f; if (component != null) { num = component.SampleHeight(pos) + this.m_BattleTerrain.transform.position.y; } TsLayerMask layerMask = TsLayer.NOTHING + TsLayer.TERRAIN; pos.y += 1000f; if (!NkRaycast.Raycast(new Ray(pos, Vector3.down), 1500f, layerMask)) { return(num); } RaycastHit hIT = NkRaycast.HIT; if (hIT.point != Vector3.zero && num < hIT.point.y) { num = hIT.point.y; } return(num); }
public static bool PickTerrain(Vector3 _RayPos, ref Vector3 _CenterPos) { GameObject gameObject = GameObject.Find("battle_height"); if (gameObject != null) { _CenterPos = _RayPos; _CenterPos.y = gameObject.transform.position.y; return(false); } Vector3 down = Vector3.down; _RayPos.y = 600f; if (NkRaycast.Raycast(new Ray(_RayPos, down), 600f, SoldierBatchGridCell.mc_kPickLayer)) { RaycastHit hIT = NkRaycast.HIT; _CenterPos = hIT.point; if (hIT.collider && typeof(MeshCollider) == hIT.collider.GetType()) { return(false); } } return(true); }
public static float CalcHeight(Vector3 pos) { float result = 0f; pos.y = 200f; Ray ray = new Ray(pos, new Vector3(0f, -1f, 0f)); if (NkRaycast.Raycast(ray)) { RaycastHit hIT = NkRaycast.HIT; if (hIT.transform != null) { if (hIT.transform.position == Vector3.zero) { result = NrTSingleton <NrTerrain> .Instance.SampleHeight(pos); } else { result = hIT.point.y; } } } return(result); }
public void GridInputMouse() { bool mouseButtonUp = NkInputManager.GetMouseButtonUp(0); bool mouseButtonDown = NkInputManager.GetMouseButtonDown(0); if (mouseButtonDown && NrTSingleton <UIManager> .Instance.DragUpUI) { return; } if (mouseButtonUp && NrTSingleton <UIManager> .Instance.DragUpUI) { this.m_SoldierBatch.CastedTarget.InitSelectMoveChar(this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendPersonID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendCharKind); this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.Init(); return; } if (NrTSingleton <FormsManager> .Instance.GetForm(G_ID.BABELTOWER_CHAT) != null && NrTSingleton <FormsManager> .Instance.GetForm(G_ID.BABELTOWER_CHAT).Visible) { return; } if (this.m_SoldierBatch.CastedTarget.IsMessageBox) { return; } SoldierBatchGrid soldierBatchGrid = null; if (NkRaycast.Raycast(this.mc_kPlunderPickLayer)) { GameObject gameObject = NkRaycast.HIT.transform.gameObject; if (null != gameObject) { soldierBatchGrid = gameObject.GetComponent <SoldierBatchGrid>(); if (null != soldierBatchGrid) { eBATTLE_ALLY aLLY = soldierBatchGrid.ALLY; short sTARTPOS_INDEX = soldierBatchGrid.STARTPOS_INDEX; int iNDEX = soldierBatchGrid.INDEX; long solID = soldierBatchGrid.SolID; long personID = soldierBatchGrid.PersonID; int charKind = soldierBatchGrid.CharKind; byte objID = soldierBatchGrid.ObjID; if (aLLY == eBATTLE_ALLY.eBATTLE_ALLY_0) { soldierBatchGrid.SetMODE(E_RENDER_MODE.ACTIVE_SELECT); } if (mouseButtonDown) { if (aLLY != eBATTLE_ALLY.eBATTLE_ALLY_0) { return; } if (solID != 0L && this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID == 0L) { this.SetMakeUpChar(solID, personID, charKind, objID); } } else if (mouseButtonUp) { if (aLLY != eBATTLE_ALLY.eBATTLE_ALLY_0) { if (this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID != 0L) { this.m_SoldierBatch.CastedTarget.InitCharBattlePos(this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendPersonID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendCharKind); } this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.Init(); return; } if (solID != 0L) { if (this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID != solID) { if (this.m_SoldierBatch.CastedTarget.EnableChangePos(this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID, solID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendPersonID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendCharKind) && !this.m_SoldierBatch.CastedTarget.ChangePos(this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID, solID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendPersonID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendCharKind)) { this.m_SoldierBatch.CastedTarget.InitSelectMoveChar(this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendPersonID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendCharKind); } } else { this.m_SoldierBatch.CastedTarget.InitSelectMoveChar(solID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendPersonID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendCharKind); } this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.Init(); } else { if (!this.m_SoldierBatch.CastedTarget.InsertEmptyGrid((byte)sTARTPOS_INDEX, (byte)iNDEX, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendPersonID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendCharKind, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_nObjectid)) { this.m_SoldierBatch.CastedTarget.InitSelectMoveChar(this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendPersonID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendCharKind); } this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.Init(); } } } } } else if (mouseButtonUp) { if (this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID != 0L) { this.m_SoldierBatch.CastedTarget.InitCharBattlePos(this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendPersonID, this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_FriendCharKind); } this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.Init(); } this.m_SoldierBatch.CastedTarget.SelectGrid = soldierBatchGrid; }
public static bool Raycast(Ray ray, float fDistance, int Mask) { return(NkRaycast.UpdateRayCast(ray, fDistance, Mask)); }
public static bool Raycast(int Mask) { return(NkRaycast.Raycast(3.40282347E+38f, Mask)); }
public static bool Raycast(Ray ray) { return(NkRaycast.Raycast(ray, 3.40282347E+38f, NkRaycast.mc_kPickLayer)); }
private void GridInputMouse() { if (this.m_Battle.CastedTarget == null) { return; } if (this.m_Battle.CastedTarget.InputControlTrigger) { return; } if (NrTSingleton <FormsManager> .Instance.IsMouseOverForm()) { return; } if (!this.m_Battle.CastedTarget.IsEnableMouseInput()) { return; } NmBattleGrid nmBattleGrid = null; bool mouseButtonUp = NkInputManager.GetMouseButtonUp(0); bool mouseButtonUp2 = NkInputManager.GetMouseButtonUp(1); if (NkRaycast.Raycast(this.mc_kBattlePickLayer)) { GameObject gameObject = NkRaycast.HIT.transform.gameObject; if (null != gameObject) { nmBattleGrid = gameObject.GetComponent <NmBattleGrid>(); if (null != nmBattleGrid) { eBATTLE_ALLY aLLY = nmBattleGrid.ALLY; short sTARTPOS_INDEX = nmBattleGrid.STARTPOS_INDEX; int iNDEX = nmBattleGrid.INDEX; short bUID = nmBattleGrid.BUID; NkBattleChar charByBUID = NrTSingleton <NkBattleCharManager> .Instance.GetCharByBUID(bUID); Vector3 pOINT = NkRaycast.POINT; BATTLESKILL_BASE bATTLESKILL_BASE = null; int num = 0; if (this.m_Battle.CastedTarget.m_iBattleSkillIndex >= 0 && this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_SKILL) { NkBattleChar nkBattleChar = this.m_Battle.CastedTarget.SelectBattleSkillChar(); if (nkBattleChar == null) { return; } int skillUnique = nkBattleChar.GetSoldierInfo().SelectBattleSkillByWeapon(this.m_Battle.CastedTarget.m_iBattleSkillIndex); bATTLESKILL_BASE = NrTSingleton <BattleSkill_Manager> .Instance.GetBattleSkillBase(skillUnique); if (bATTLESKILL_BASE == null) { return; } this.m_Battle.CastedTarget.GRID_MANAGER.SetSelectBattleSkillGrid(); if (bATTLESKILL_BASE.m_nSkillTargetType == 1 || bATTLESKILL_BASE.m_nSkillTargetType == 2) { num = 1; } else if (bATTLESKILL_BASE.m_nSkillTargetType == 3) { num = 2; } else if (bATTLESKILL_BASE.m_nSkillTargetType == 4) { num = 3; } } if (this.m_Battle.CastedTarget.MyAlly != aLLY) { if (bATTLESKILL_BASE != null) { if ((num == 2 || num == 3) && bUID >= 0) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveBattleSkillGrid(aLLY, sTARTPOS_INDEX, iNDEX, bATTLESKILL_BASE.m_nSkillUnique); } } if (mouseButtonUp) { if (this.m_Battle.CastedTarget.IsEmotionSet) { this.m_Battle.CastedTarget.Send_GS_BATTLE_EMOTICON_REQ(bUID); } else if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_ATTACK_LAND) { this.m_Battle.CastedTarget.Send_AttackLand_Order(pOINT); this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } else if (this.m_Battle.CastedTarget.m_iBattleSkillIndex >= 0 && this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_SKILL) { if (num == 2 || num == 3) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveBattleSkillGrid(aLLY, sTARTPOS_INDEX, iNDEX, bATTLESKILL_BASE.m_nSkillUnique); this.m_Battle.CastedTarget.Send_BattleSkill_Order(this.m_Battle.CastedTarget.m_iBattleSkillIndex, this.m_Battle.CastedTarget.SelectBattleSkillChar(), charByBUID, pOINT, (short)iNDEX); this.m_Battle.CastedTarget.Init_BattleSkill_Input(false); this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } else { Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("578"), SYSTEM_MESSAGE_TYPE.IMPORTANT_MESSAGE); } } else if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_SEARCH) { NkBattleChar currentSelectChar = this.m_Battle.CastedTarget.GetCurrentSelectChar(); if (currentSelectChar != null) { } this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } else { if (Battle.BATTLE.BattleRoomtype == eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_PLUNDER || Battle.BATTLE.BattleRoomtype == eBATTLE_ROOMTYPE.eBATTLE_ROOMTYPE_INFINITY) { if (Battle.BATTLE.GetCheckTargetBt() && charByBUID != null && charByBUID.GetSoldierInfo().GetHP() > 0 && charByBUID.GetCharKindInfo().GetCharKind() != 916) { Battle.BATTLE.Send_GS_BATTLE_PLUNDER_AGGROADD_REQ(charByBUID.GetBUID()); Battle.BATTLE.ClickCheckTargetBt(); Battle.BATTLE.SetTargetBtDisCount(); NrTSingleton <NkEffectManager> .Instance.AddEffect("FX_ATTACK_TARGET", charByBUID); } } else { NkBattleChar currentSelectChar2 = this.m_Battle.CastedTarget.GetCurrentSelectChar(); if (currentSelectChar2 != null && charByBUID != null) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveAttack(aLLY, sTARTPOS_INDEX, iNDEX, charByBUID); if (charByBUID.GetSoldierInfo().GetHP() > 0) { currentSelectChar2.OrderAttackReq(charByBUID, (short)iNDEX, nmBattleGrid.GetCenter()); } } } this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } } } else { if (bATTLESKILL_BASE != null && (num == 1 || num == 3) && bUID >= 0) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveBattleSkillGrid(aLLY, sTARTPOS_INDEX, iNDEX, bATTLESKILL_BASE.m_nSkillUnique); } if (mouseButtonUp) { if (this.m_Battle.CastedTarget.IsEmotionSet) { this.m_Battle.CastedTarget.Send_GS_BATTLE_EMOTICON_REQ(bUID); } else if (this.m_Battle.CastedTarget.m_iBattleSkillIndex >= 0 && this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_SKILL) { if (num == 1 || num == 3) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveBattleSkillGrid(aLLY, sTARTPOS_INDEX, iNDEX, bATTLESKILL_BASE.m_nSkillUnique); this.m_Battle.CastedTarget.Send_BattleSkill_Order(this.m_Battle.CastedTarget.m_iBattleSkillIndex, this.m_Battle.CastedTarget.SelectBattleSkillChar(), charByBUID, pOINT, (short)iNDEX); this.m_Battle.CastedTarget.Init_BattleSkill_Input(false); this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } } else if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_CHANGEPOS) { NkBattleChar currentSelectChar3 = this.m_Battle.CastedTarget.GetCurrentSelectChar(); if (currentSelectChar3 != null) { int num2 = currentSelectChar3.OrderChangePosReq(sTARTPOS_INDEX, (short)iNDEX); if (num2 < 0) { if (num2 < -1) { Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("176"), SYSTEM_MESSAGE_TYPE.NAGATIVE_MESSAGE); } else { Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("404"), SYSTEM_MESSAGE_TYPE.IMPORTANT_MESSAGE); } } } this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } else if (charByBUID != null) { if (charByBUID.GetTurnState() == eBATTLE_TURN_STATE.eBATTLE_TURN_STATE_ENABLE) { this.m_Battle.CastedTarget.SelectCharacter(bUID); } this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } else { this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; } } else if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_CHANGEPOS) { NkBattleChar currentSelectChar4 = this.m_Battle.CastedTarget.GetCurrentSelectChar(); if (currentSelectChar4 != null) { this.m_Battle.CastedTarget.GRID_MANAGER.ActiveChangePos(nmBattleGrid.ALLY, nmBattleGrid.STARTPOS_INDEX, currentSelectChar4.GetBUID(), (short)iNDEX); } } else { this.m_Battle.CastedTarget.GRID_MANAGER.SetOver(nmBattleGrid); } } } } } if (mouseButtonUp2) { if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_CHANGEPOS) { this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("402"), SYSTEM_MESSAGE_TYPE.IMPORTANT_MESSAGE); } else if (this.m_Battle.CastedTarget.REQUEST_ORDER == eBATTLE_ORDER.eBATTLE_ORDER_SKILL) { this.m_Battle.CastedTarget.REQUEST_ORDER = eBATTLE_ORDER.eBATTLE_ORDER_NONE; this.m_Battle.CastedTarget.Init_BattleSkill_Input(true); } } if (null == nmBattleGrid) { this.m_Battle.CastedTarget.GRID_MANAGER.SetOver(null); if (this.m_Battle.CastedTarget.m_iBattleSkillIndex < 0 && this.m_Battle.CastedTarget.REQUEST_ORDER != eBATTLE_ORDER.eBATTLE_ORDER_SKILL && this.m_Battle.CastedTarget.GetCurrentSelectChar() == null) { this.m_Battle.CastedTarget.GRID_MANAGER.InitAll(); } } }