public static bool SetObjWithColVisibleByFowAttached(GameObject inObj, GameFowManager fowMgr, COM_PLAYERCAMP inHostCamp, PoolObjHandle <ActorRoot> inAttachActor) { if (inObj == null) { return(false); } if (!inAttachActor || inAttachActor.get_handle().shape == null) { return(GameFowCollector.SetObjVisibleByFow(inObj, fowMgr, inHostCamp)); } VCollisionShape shape = inAttachActor.get_handle().shape; VInt3 location = inAttachActor.get_handle().location; location = new VInt3(location.x, location.z, 0); bool flag = fowMgr.IsSurfaceCellVisible(location, inHostCamp); if (flag) { MMGame_Math.SetLayer(inObj, "Actor", "Particles", true); } else { flag = shape.AcceptFowVisibilityCheck(inHostCamp, fowMgr); if (flag) { MMGame_Math.SetLayer(inObj, "Actor", "Particles", true); } else { MMGame_Math.SetLayer(inObj, "Hide", true); } } return(flag); }
public virtual void Apply() { if (this.Start == null || this.End == null || AstarPath.active == null) { return; } GraphNode node = AstarPath.active.GetNearest(this.Start.position).node; GraphNode node2 = AstarPath.active.GetNearest(this.End.position).node; if (node == null || node2 == null) { return; } if (this.deleteConnection) { node.RemoveConnection(node2); if (!this.oneWay) { node2.RemoveConnection(node); } } else { uint cost = (uint)MMGame_Math.RoundToInt((double)((float)(node.position - node2.position).costMagnitude * this.costFactor)); node.AddConnection(node2, cost); if (!this.oneWay) { node2.AddConnection(node, cost); } } }
public static void SetLayer(this GameObject go, string layerName, string layerNameParticles, bool bFileSkillIndicator = false) { int layer = LayerMask.NameToLayer(layerName); int layerParticles = LayerMask.NameToLayer(layerNameParticles); MMGame_Math.SetLayerRecursively(go, layer, layerParticles, bFileSkillIndicator); }
public void Update() { if (this.actor == null || !this.actor.Visible) { return; } float scalar = this.actor.groundY.get_scalar(); if (this.lastUpdateGroundY != scalar) { if (this.shadowMesh != null && this.shadowMesh.activeInHierarchy) { Transform transform = this.shadowMesh.transform; Vector3 position = transform.position; position.y = scalar; transform.position = position; } this.lastUpdateGroundY = scalar; } if (this.mats != null && this.mats.get_Count() > 0) { Vector4 vector = new Vector4(0f, 1f, 0f, 0f); vector.w = scalar; vector.w += 0.05f; float value = Mathf.Abs(PlaneShadowSettings.shadowProjDir.y / Mathf.Max(0.001f, this.height)); for (int i = 0; i < this.mats.get_Count(); i++) { Material material = this.mats.get_Item(i); material.SetVector("_ShadowPlane", vector); material.SetFloat("_ShadowInvLen", value); material.SetVector("_WorldPos", MMGame_Math.toVec4(base.gameObject.transform.position, 1f)); } } }
public static VInt3 operator *(VInt3 lhs, double rhs) { lhs.x = MMGame_Math.RoundToInt((double)lhs.x * rhs); lhs.y = MMGame_Math.RoundToInt((double)lhs.y * rhs); lhs.z = MMGame_Math.RoundToInt((double)lhs.z * rhs); return(lhs); }
public static bool SetObjVisibleByFowAttached(GameObject obj, GameFowManager fowMgr, COM_PLAYERCAMP inHostCamp, PoolObjHandle <ActorRoot> inAttachActor) { if (obj == null) { return(false); } bool flag; if (inAttachActor) { VInt3 location = inAttachActor.get_handle().location; location = new VInt3(location.x, location.z, 0); flag = fowMgr.IsSurfaceCellVisible(location, inHostCamp); if (flag) { MMGame_Math.SetLayer(obj, "Actor", "Particles", true); } else { MMGame_Math.SetLayer(obj, "Hide", true); } } else { flag = GameFowCollector.SetObjVisibleByFow(obj, fowMgr, inHostCamp); } return(flag); }
private void HidePrefab(GameObject _prefab) { if (_prefab != null) { MMGame_Math.SetLayer(_prefab, "Hide", false); } }
public void SetActorMesh(GameObject InActorMesh) { if (InActorMesh != this.ActorMesh) { this.ObjLinker.OnActorMeshChanged(InActorMesh); this.ActorMesh = InActorMesh; this.ActorMeshAnimation = ((!(this.ActorMesh != null)) ? null : this.ActorMesh.GetComponent <Animation>()); if (this.ActorMesh != null) { if (this._bVisible) { MMGame_Math.SetLayer(this.ActorMesh, "Actor", "Particles", true); } else { MMGame_Math.SetLayer(this.ActorMesh, "Hide", true); } } if (this.ActorControl != null) { this.ActorControl.UpdateAnimPlaySpeed(); } if (this.MatHurtEffect != null) { this.MatHurtEffect.OnMeshChanged(); } } }
private void Update() { if (this.m_belongedFormScript != null && this.m_belongedFormScript.IsClosed()) { return; } this.GetPivotScreenPosition(); if (this.m_lastPivotScreenPosition != this.m_pivotScreenPosition) { if (this.m_renderCamera != null) { if (this.m_renderCamera.orthographic) { for (int i = 0; i < this.m_3DGameObjects.get_Count(); i++) { if (this.m_3DGameObjects.get_Item(i).m_bindPivot) { this.ChangeScreenPositionToWorld(this.m_3DGameObjects.get_Item(i).m_gameObject, ref this.m_pivotScreenPosition); } } } else { float num = this.m_pivotScreenPosition.x / (float)Mathf.Max(Screen.width, Screen.height); num = num * 2f - 1f; this.m_renderCamera.rect = new Rect(0f, 0f, 1f, 1f); this.m_renderCamera.ResetAspect(); MMGame_Math.SetOffsetX(this.m_renderCamera, num); } } this.m_lastPivotScreenPosition = this.m_pivotScreenPosition; } }
private static bool CheckNearestNodeIntersection(TriangleMeshNode node, VInt3 srcLoc, VInt3 destLoc, ref int edge) { if (!node.ContainsPoint(destLoc)) { int num = 0; VInt3[] staticVerts = PathfindingUtility._staticVerts; node.GetPoints(ref staticVerts[0], ref staticVerts[1], ref staticVerts[2]); float num2 = 3.40282347E+38f; int num3 = -1; Vector3 vector = (Vector3)srcLoc; Vector3 vector2 = (Vector3)destLoc; for (int i = 0; i < 3; i++) { if (Polygon.Intersects(staticVerts[i], staticVerts[(i + 1) % 3], srcLoc, destLoc)) { num++; bool flag; Vector3 vector3 = Polygon.IntersectionPoint((Vector3)staticVerts[i], (Vector3)staticVerts[(i + 1) % 3], vector, vector2, ref flag); DebugHelper.Assert(flag); float num4 = MMGame_Math.XZSqrMagnitude(vector, ref vector3); if (num4 < num2) { num2 = num4; num3 = i; } } } if (num != 2 || num3 == -1) { return(false); } edge = num3; } return(true); }
private void CreateParticle(string _resName, ref PoolObjHandle <ActorRoot> _origin, ref PoolObjHandle <ActorRoot> _target) { if (!_target) { return; } string resourceName = SkinResourceHelper.GetResourceName(ref _origin, _resName, true); this.particleObj = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(resourceName, true, SceneObjType.ActionRes, _target.get_handle().myTransform.position); if (this.particleObj == null) { this.particleObj = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(_resName, true, SceneObjType.ActionRes, _target.get_handle().myTransform.position); } if (this.particleObj != null) { string text = "Particles"; if (_target.get_handle().gameObject.layer == LayerMask.NameToLayer("Hide")) { text = "Hide"; } MMGame_Math.SetLayer(this.particleObj, text, false); this.particleObj.transform.SetParent(_target.get_handle().myTransform); ParticleSystem component = this.particleObj.GetComponent <ParticleSystem>(); if (component != null) { component.Play(true); } } }
public static VInt3 operator /(VInt3 lhs, float rhs) { lhs.x = MMGame_Math.RoundToInt((double)((float)lhs.x / rhs)); lhs.y = MMGame_Math.RoundToInt((double)((float)lhs.y / rhs)); lhs.z = MMGame_Math.RoundToInt((double)((float)lhs.z / rhs)); return(lhs); }
public static VInt3 operator *(VInt3 lhs, Vector3 rhs) { lhs.x = MMGame_Math.RoundToInt((double)((float)lhs.x * rhs.x)); lhs.y = MMGame_Math.RoundToInt((double)((float)lhs.y * rhs.y)); lhs.z = MMGame_Math.RoundToInt((double)((float)lhs.z * rhs.z)); return(lhs); }
public void onActorDead(ref GameDeadEventParam prm) { if (!prm.bImmediateRevive || !this.actorPtr || this.actorPtr != prm.src) { return; } GameObject pooledGameObjLOD = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD("Prefab_Skill_Effects/tongyong_effects/Huanling_Effect/fuhuodun_buff_01", true, SceneObjType.ActionRes, this.actorPtr.get_handle().myTransform.position); if (pooledGameObjLOD != null) { string text = "Particles"; if (this.actorPtr.get_handle().gameObject.layer == LayerMask.NameToLayer("Hide")) { text = "Hide"; } MMGame_Math.SetLayer(pooledGameObjLOD, text, false); pooledGameObjLOD.transform.SetParent(this.actorPtr.get_handle().myTransform); ParticleSystem component = pooledGameObjLOD.GetComponent <ParticleSystem>(); if (component != null) { component.Play(true); } Singleton <CGameObjectPool> .GetInstance().RecycleGameObjectDelay(pooledGameObjLOD, 5000, null); } }
private void ShowPrefab(GameObject _prefab) { if (_prefab != null) { MMGame_Math.SetLayer(_prefab, "Actor", "Particles", false); } }
private static void ReviveTower(ActorRoot inActor, int inParam) { if (inActor != null && inActor.ActorControl != null && inActor.ActorControl.IsDeadState) { inActor.ActorControl.Revive(false); inActor.RecoverOriginalActorMesh(); if (inActor.ActorMesh != null) { MMGame_Math.SetLayer(inActor.ActorMesh, "Actor", "Particles", true); } } }
public void OnActorMeshChanged(GameObject newMesh) { if (this.meshObject != null) { Singleton <CGameObjectPool> .GetInstance().RecycleGameObject(this.meshObject); } this.meshObject = newMesh; this.myRenderer = MMGame_Math.GetSkinnedMeshRendererInChildren(base.gameObject); if (this.myRenderer == null) { this.myRenderer = MMGame_Math.GetMeshRendererInChildren(base.gameObject); } }
private void LateUpdate() { if (this.depthCam_ == null || this.depthTextures_ == null || !this.supportShadow) { return; } Matrix4x4 matrix4x = GL.GetGPUProjectionMatrix(this.depthCam_.projectionMatrix, false); matrix4x *= this.depthCam_.worldToCameraMatrix; Vector4 vec = MMGame_Math.toVec4(base.transform.forward.normalized, this.ShadowIntensity); Shader.SetGlobalMatrix("_SGameShadowMatrix", matrix4x); Shader.SetGlobalVector("_SGameShadowParams", vec); }
public static void SetLayerRecursively(GameObject go, int layer, bool bFileSkillIndicator) { if (bFileSkillIndicator && go.CompareTag("SCI")) { return; } go.layer = layer; int childCount = go.transform.childCount; for (int i = 0; i < childCount; i++) { MMGame_Math.SetLayerRecursively(go.transform.GetChild(i).gameObject, layer, bFileSkillIndicator); } }
public override void Enter(Action _action, Track _track) { Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); if (hostPlayer != null && hostPlayer.Captain) { DebugHelper.Assert(hostPlayer.Captain, "Captain Hero is NULL!!"); if (this.bShow) { MMGame_Math.SetLayer(hostPlayer.Captain.get_handle().ActorMesh, "Actor", false); } else { MMGame_Math.SetLayer(hostPlayer.Captain.get_handle().ActorMesh, "Hide", false); } } }
public static void SetLayerRecursively(GameObject go, int layer, int layerParticles, bool bFileSkillIndicator) { if (bFileSkillIndicator && go.CompareTag("SCI")) { return; } if (go.GetComponent <ParticleSystem>() != null) { go.layer = layerParticles; } else { go.layer = layer; } int childCount = go.transform.childCount; for (int i = 0; i < childCount; i++) { MMGame_Math.SetLayerRecursively(go.transform.GetChild(i).gameObject, layer, layerParticles, bFileSkillIndicator); } }
public static bool SetObjVisibleByFow(GameObject obj, GameFowManager fowMgr, COM_PLAYERCAMP inHostCamp) { if (obj == null) { return(false); } VInt3 worldLoc = (VInt3)obj.transform.position; worldLoc = new VInt3(worldLoc.x, worldLoc.z, 0); bool flag = fowMgr.IsSurfaceCellVisible(worldLoc, inHostCamp); if (flag) { MMGame_Math.SetLayer(obj, "Actor", "Particles", true); } else { MMGame_Math.SetLayer(obj, "Hide", true); } return(flag); }
private void OnHeroSoulLevelChange() { if (!this.actorPtr || this.actorPtr.get_handle().ActorControl.IsDeadState || !this.actorPtr.get_handle().Visible || !this.actorPtr.get_handle().InCamera || this.actorPtr.get_handle().ValueComponent.actorSoulLevel <= 1) { return; } Vector3 position = this.actor.myTransform.position; position = new Vector3(position.x, position.y + 0.24f, position.z); Quaternion rot = Quaternion.Euler(-90f, 0f, 0f); bool flag = false; string levelUpEftPath = ((HeroWrapper)this.actorPtr.get_handle().ActorControl).GetLevelUpEftPath(this.actorPtr.get_handle().ValueComponent.actorSoulLevel); GameObject gameObject = null; if (!string.IsNullOrEmpty(levelUpEftPath)) { gameObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(levelUpEftPath, true, SceneObjType.ActionRes, position, rot, out flag); } if (null == gameObject) { gameObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(EffectPlayComponent.s_heroSoulLevelUpEftPath, true, SceneObjType.ActionRes, position, rot, out flag); } if (null == gameObject) { return; } Singleton <CGameObjectPool> .GetInstance().RecycleGameObjectDelay(gameObject, 5000, null); Transform transform = (!this.actor.ActorMesh) ? this.actor.myTransform : this.actor.ActorMesh.transform; string text = "Particles"; if (transform && transform.gameObject.layer == LayerMask.NameToLayer("Hide")) { text = "Hide"; } gameObject.transform.SetParent(transform); MMGame_Math.SetLayer(gameObject, text, false); Singleton <CSoundManager> .get_instance().PlayBattleSound("Level_Up", this.actorPtr, base.gameObject); }
public void Add(PathNode node) { if (node == null) { throw new ArgumentNullException("Sending null node to BinaryHeap"); } if (this.numberOfItems == this.binaryHeap.Length) { int num = Math.Max(this.binaryHeap.Length + 4, MMGame_Math.RoundToInt((double)((float)this.binaryHeap.Length * this.growthFactor))); if (num > 262144) { throw new Exception("Binary Heap Size really large (2^18). A heap size this large is probably the cause of pathfinding running in an infinite loop. \nRemove this check (in BinaryHeap.cs) if you are sure that it is not caused by a bug"); } BinaryHeapM.Tuple[] array = new BinaryHeapM.Tuple[num]; for (int i = 0; i < this.binaryHeap.Length; i++) { array[i] = this.binaryHeap[i]; } this.binaryHeap = array; } BinaryHeapM.Tuple tuple = new BinaryHeapM.Tuple(node.F, node); this.binaryHeap[this.numberOfItems] = tuple; int num2 = this.numberOfItems; uint f = node.F; uint g = node.G; while (num2 != 0) { int num3 = (num2 - 1) / 4; if (f >= this.binaryHeap[num3].F && (f != this.binaryHeap[num3].F || g <= this.binaryHeap[num3].node.G)) { break; } this.binaryHeap[num2] = this.binaryHeap[num3]; this.binaryHeap[num3] = tuple; num2 = num3; } this.numberOfItems++; }
public void InitForInvisibleBullet() { if (this.actor == null) { return; } MMGame_Math.SetLayer(base.gameObject, "Actor", "Particles", true); this.actor.SkillControl = this.actor.CreateLogicComponent <SkillComponent>(this.actor); this.actor.BuffHolderComp = this.actor.CreateLogicComponent <BuffHolderComponent>(this.actor); if (FogOfWar.enable) { this.actor.HorizonMarker = this.actor.CreateLogicComponent <HorizonMarkerByFow>(this.actor); Player hostPlayer = Singleton <GamePlayerCenter> .get_instance().GetHostPlayer(); if (hostPlayer != null) { if (this.actor.TheActorMeta.ActorCamp == hostPlayer.PlayerCamp) { this.actor.Visible = true; } else { VInt3 worldLoc = new VInt3(this.actor.location.x, this.actor.location.z, 0); this.actor.Visible = Singleton <GameFowManager> .get_instance().IsSurfaceCellVisible(worldLoc, hostPlayer.PlayerCamp); } } } else { this.actor.HorizonMarker = this.actor.CreateLogicComponent <HorizonMarker>(this.actor); } this.actor.MatHurtEffect = this.actor.CreateActorComponent <MaterialHurtEffect>(this.actor); if (this.actor.MatHurtEffect != null && this.actor.MatHurtEffect.mats != null) { this.actor.MatHurtEffect.mats.Clear(); this.actor.MatHurtEffect.mats = null; } }
public void UpdateSubParObjVisibility(bool inVisible) { int count = this.SubParObjList_.get_Count(); if (count > 0) { for (int i = count - 1; i >= 0; i--) { GameObject gameObject = this.SubParObjList_.get_Item(i); if (gameObject == null) { this.SubParObjList_.RemoveAt(i); } else if (inVisible) { MMGame_Math.SetLayer(gameObject, "Actor", "Particles", true); } else { MMGame_Math.SetLayer(gameObject, "Hide", true); } } } }
private void GenerateVerticalFillMesh() { this.m_fillAmount = Mathf.Clamp01(this.m_fillAmount); if (this.m_fillAmount <= 0f) { return; } Vector3 localPosition = base.transform.localPosition; this.m_mesh.MarkDynamic(); float num = 0f; float num2 = 0f; if (this.m_alignHoriontal == Sprite3D.EnumHoriontal.Center) { num = -0.5f * this.m_width; } else if (this.m_alignHoriontal == Sprite3D.EnumHoriontal.Right) { num = -this.m_width; } if (this.m_alignVertical == Sprite3D.EnumVertical.Middle) { num2 = -0.5f * this.m_height; } else if (this.m_alignVertical == Sprite3D.EnumVertical.Top) { num2 = -this.m_height; } Vector3[] vertices = new Vector3[] { new Vector3(num, num2 + this.m_height * this.m_fillAmount, 0f), new Vector3(num + this.m_width, num2 + this.m_height * this.m_fillAmount, 0f), new Vector3(num, num2, 0f), new Vector3(num + this.m_width, num2, 0f) }; Vector2[] uv = new Vector2[] { MMGame_Math.Lerp(this.m_uv.uvBL, this.m_uv.uvTL, this.m_fillAmount), MMGame_Math.Lerp(this.m_uv.uvBR, this.m_uv.uvTR, this.m_fillAmount), this.m_uv.uvBL, this.m_uv.uvBR }; Color[] colors = new Color[] { this.m_color, this.m_color, this.m_color, this.m_color }; int[] triangles = new int[] { 0, 1, 2, 3, 2, 1 }; this.m_mesh.vertices = vertices; this.m_mesh.uv = uv; this.m_mesh.colors = colors; this.m_mesh.triangles = triangles; this.RecaculateDepth(); }
private void GenerateRadial360FillMesh() { this.m_fillAmount = Mathf.Clamp01(this.m_fillAmount); if (this.m_fillAmount <= 0f) { return; } Vector3 localPosition = base.transform.localPosition; this.m_mesh.MarkDynamic(); float num = 0f; float num2 = 0f; if (this.m_alignHoriontal == Sprite3D.EnumHoriontal.Center) { num = -0.5f * this.m_width; } else if (this.m_alignHoriontal == Sprite3D.EnumHoriontal.Right) { num = -this.m_width; } if (this.m_alignVertical == Sprite3D.EnumVertical.Middle) { num2 = -0.5f * this.m_height; } else if (this.m_alignVertical == Sprite3D.EnumVertical.Top) { num2 = -this.m_height; } int num3 = (int)(this.m_segments * this.m_fillAmount) + 1; float num4 = 2f * (this.width + this.height) / this.m_segments; Vector3[] array = new Vector3[num3 + 1]; Vector2[] array2 = new Vector2[num3 + 1]; array[0] = new Vector3(num + 0.5f * this.m_width, num2 + 0.5f * this.height, 0f); array2[0] = MMGame_Math.Lerp(this.m_uv.uvTL, this.m_uv.uvBR, 0.5f); int num5 = 0; int num6 = 0; float num7 = 0f; for (int i = 0; i < num3; i++) { if (num5 == 0) { float num8 = num + 0.5f * this.width + (float)num6 * num4; if (num8 >= num + this.width) { num7 = num8 - num - this.width; num8 = num + this.width; num5 = 1; num6 = 1; } else { num6++; } array[i + 1] = new Vector3(num8, num2 + this.height, 0f); } else if (num5 == 1) { float num9 = num2 + this.height - (float)num6 * num4 - num7; if (num9 <= num2) { num7 = num2 - num9; num9 = num2; num5 = 2; num6 = 1; } else { num6++; } array[i + 1] = new Vector3(num + this.width, num9, 0f); } else if (num5 == 2) { float num10 = num + this.width - (float)num6 * num4 - num7; if (num10 <= num) { num7 = num - num10; num10 = num; num5 = 3; num6 = 1; } else { num6++; } array[i + 1] = new Vector3(num10, num2, 0f); } else if (num5 == 3) { float num11 = num2 + (float)num6 * num4 + num7; if (num11 >= num2 + this.height) { num7 = num11 - num2 - this.height; num11 = num2 + this.height; num5 = 4; num6 = 1; } else { num6++; } array[i + 1] = new Vector3(num, num11); } else if (num5 == 4) { float num12 = num + (float)num6 * num4 + num7; if (num12 > num + 0.5f * this.width) { num12 = num + 0.5f * this.width; } num6++; array[i + 1] = new Vector3(num12, num2 + this.height, 0f); } float x = array[i + 1].x; float y = array[i + 1].y; array2[i + 1] = new Vector2(Mathf.Lerp(this.m_uv.uvTL.x, this.m_uv.uvTR.x, (x - num) / this.width), Mathf.Lerp(this.m_uv.uvBL.y, this.m_uv.uvTL.y, (y - num2) / this.height)); } Color[] array3 = new Color[num3 + 1]; for (int j = 0; j < array3.Length; j++) { array3[j] = this.m_color; } int[] array4 = new int[(num3 - 1) * 3]; for (int k = 0; k < num3 - 1; k++) { array4[k * 3] = 0; array4[k * 3 + 1] = k + 1; array4[k * 3 + 2] = k + 2; } this.m_mesh.vertices = array; this.m_mesh.uv = array2; this.m_mesh.colors = array3; this.m_mesh.triangles = array4; this.RecaculateDepth(); }
public VInt(float f) { this.i = MMGame_Math.RoundToInt((double)(f * VInt3.Precision)); }
public static double Round(double x) { return((double)MMGame_Math.RoundToInt(x)); }