bool updateWallCollision(int i, int j, int iOffset, ref Vector2f stepPos, FloatRect stepRect) { var dirType = iOffset > 0 ? DirectionType.Right : DirectionType.Left; Tile[] walls = new Tile[] { world.GetTile(i + iOffset, j - 1), world.GetTile(i + iOffset, j - 2), world.GetTile(i + iOffset, j - 3), }; bool isWallCollided = false; foreach (Tile t in walls) { if (t == null) { continue; } FloatRect tileRect = new FloatRect(t.Position, new Vector2f(Tile.TILE_SIZE, Tile.TILE_SIZE)); DebugRender.AddRectangle(tileRect, Color.Yellow); if (updateCollision(stepRect, tileRect, dirType, ref stepPos)) { isWallCollided = true; } } return(isWallCollided); }
public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected) { var transform = WorldMatrix; var c = transform.TranslationVector + transform.Left * Width * 0.40f + transform.Up * Height * 0.40f; float len = Math.Min(Width, Height) / 6; var x = transform.Right * len; var y = transform.Down * len; var p0 = Vector3.TransformCoordinate(new Vector3(Width / 2, Height / 2, 0), transform); var p1 = Vector3.TransformCoordinate(new Vector3(-Width / 2, Height / 2, 0), transform); var p2 = Vector3.TransformCoordinate(new Vector3(-Width / 2, -Height / 2, 0), transform); var p3 = Vector3.TransformCoordinate(new Vector3(Width / 2, -Height / 2, 0), transform); var p4 = Vector3.TransformCoordinate(new Vector3(0, 0, Depth), transform); var p5 = Vector3.TransformCoordinate(new Vector3(0, 0, -Depth), transform); dr.DrawLine(p0, p1, color, color, 1, 1); dr.DrawLine(p1, p2, color, color, 1, 1); dr.DrawLine(p2, p3, color, color, 1, 1); dr.DrawLine(p3, p0, color, color, 1, 1); dr.DrawLine(c, c + x, Color.Red, Color.Red, 2, 2); dr.DrawLine(c, c + y, Color.Lime, Color.Lime, 2, 2); dr.DrawLine(p4, p5, color, color, 2, 2); }
/// <summary> /// /// </summary> /// <param name="dr"></param> /// <param name="pickRay"></param> /// <param name="origin"></param> /// <param name="axisA"></param> /// <param name="axisB"></param> /// <param name="color"></param> protected void DrawRing(DebugRender dr, Ray pickRay, Vector3 origin, Vector3 axis, Color color) { axis = Vector3.Normalize(axis); var axisA = Vector3.Cross(axis, Vector3.Up); if (axisA.LengthSquared() < 0.001f) { axisA = Vector3.Cross(axis, Vector3.Right); } var axisB = Vector3.Cross(axisA, axis); int N = 64; Vector3[] points = new Vector3[N + 1]; var radius = editor.camera.PixelToWorldSize(origin, 90); for (int i = 0; i <= N; i++) { var p = origin; p += axisA * radius * (float)Math.Cos(Math.PI * 2 * i / N); p += axisB * radius * (float)Math.Sin(Math.PI * 2 * i / N); points[i] = p; } for (int i = 0; i < N; i++) { dr.DrawLine(points[i], points[i + 1], color, color, 2, 2); } }
public override void UpdateNPC() { updateMovement(); if (UIManager.Over == null && UIManager.Drag == null) { var mousePos = Mouse.GetPosition(Program.Window); var tile = world.GetTileByWorldPos(mousePos); if (tile != null) { FloatRect tileRect = tile.GetFloatRect(); DebugRender.AddRectangle(tileRect, Color.Green); if (Mouse.IsButtonPressed(Mouse.Button.Left)) { int i = (int)(mousePos.X / Tile.TILE_SIZE); int j = (int)(mousePos.Y / Tile.TILE_SIZE); world.SetTile(TileType.NONE, i, j); } } if (Mouse.IsButtonPressed(Mouse.Button.Right)) { int i = (int)(mousePos.X / Tile.TILE_SIZE); int j = (int)(mousePos.Y / Tile.TILE_SIZE); world.SetTile(TileType.GROUND, i, j); } } }
public void MoveCharacterController(CharacterControllerProxy char_controller) { AnimatorStateInfo currentAnimatorStateInfo = this.m_Animator.GetCurrentAnimatorStateInfo(0); foreach (AnimatorClipInfo animatorClipInfo in this.m_Animator.GetCurrentAnimatorClipInfo(0)) { if ((double)animatorClipInfo.weight == 1.0) { float time = currentAnimatorStateInfo.length * (currentAnimatorStateInfo.normalizedTime % 1f); float num = currentAnimatorStateInfo.length * (currentAnimatorStateInfo.normalizedTime % 1f) - Time.deltaTime; num = Mathf.Clamp(num, 0f, currentAnimatorStateInfo.length); animatorClipInfo.clip.SampleAnimation(this.m_Animator.gameObject, num); Vector3 position = this.m_OffsetHelper.position; Quaternion quaternion = Quaternion.Inverse(this.m_OffsetHelper.rotation); animatorClipInfo.clip.SampleAnimation(this.m_Animator.gameObject, time); Vector3 position2 = this.m_OffsetHelper.position; Quaternion rotation = this.m_OffsetHelper.rotation; quaternion *= rotation; Vector3 vector = position2 - position; char_controller.Move(vector, true); char_controller.transform.rotation *= quaternion; DebugRender.DrawLine(position2, position2 + vector, Color.blue, 0f); } } }
public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected) { dr.DrawBasis(WorldMatrix, 1); Factory.Draw(dr, WorldMatrix, color); if (selected) { if (Entity != null) { var targets = world.GetTargets(Factory.Target); if (targets.Any()) { dr.DrawBox(new BoundingBox(0.5f, 0.5f, 0.5f), WorldMatrix, Color.Yellow); } foreach (var target in targets) { var dir = target.Position - Entity.Position; var len = dir.Length(); var dirn = dir.Normalized(); var p0 = Entity.Position; var p1 = target.Position; dr.DrawLine(p0, p1, Color.Yellow, Color.Yellow, 1, 1); } } } }
public override void UpdateNPC() { updateMovement(); if (UIManager.Over == null && UIManager.Drag == null) { Vector2i mousePos = Mouse.GetPosition(Program.Window); Tile tile = world.GetTileByWorldPos(mousePos); DebugRender.AddRectangle(mousePos.X + world.XShift * Tile.TILE_SIZE, mousePos.Y + world.YShift * Tile.TILE_SIZE, Tile.TILE_SIZE, Tile.TILE_SIZE, Color.Green); if (mousePos.X + world.XShift * Tile.TILE_SIZE >= Program.Game.World.MIN_XShift && mousePos.X + world.XShift * Tile.TILE_SIZE <= Program.Game.World.MAX_XShift + 1500) { if (Mouse.IsButtonPressed(Mouse.Button.Left)) { int i = (int)(mousePos.X / Tile.TILE_SIZE) + (int)world.XShift; int j = (int)(mousePos.Y / Tile.TILE_SIZE) + (int)world.YShift; world.SetTile(TileType.NONE, i, j); } if (Mouse.IsButtonPressed(Mouse.Button.Right)) { int i = (int)(mousePos.X / Tile.TILE_SIZE) + (int)world.XShift; int j = (int)(mousePos.Y / Tile.TILE_SIZE) + (int)world.YShift; world.SetTile(TileType.GROUND, i, j); } } } }
private void UpdateTransform() { this.m_Rotation = this.m_ObjectRigidBody.transform.rotation; this.m_Bounds.center = this.m_ObjectRigidBody.transform.position; this.m_Bounds.center = this.m_Bounds.center + -this.m_ObjectRigidBody.transform.right * this.m_LocalPos.x; this.m_Bounds.center = this.m_Bounds.center + -this.m_ObjectRigidBody.transform.up * this.m_LocalPos.y; this.m_Bounds.center = this.m_Bounds.center + -this.m_ObjectRigidBody.transform.forward * this.m_LocalPos.z; DebugRender.DrawBounds(this.m_Bounds, this.m_Rotation, Color.red, 0f); }
public override void Draw(DebugRender dr, Matrix transform, Color color) { var w = Width / 2; var h = Height / 2; var d = Depth / 2; dr.DrawBox(new BoundingBox(new Vector3(-w, -h, -d), new Vector3(w, h, d)), transform, color); dr.DrawPoint(transform.TranslationVector, (w + h + d) / 3 / 2, color); }
/// <summary> /// Draw standard arrow. /// </summary> /// <param name="dr"></param> /// <param name="dir"></param> /// <param name="color"></param> /// <param name="length"></param> /// <param name="scale"></param> protected void DrawArrow(DebugRender dr, Ray pickRay, Vector3 origin, Vector3 dir, Color color) { var p0 = origin; var p1 = p0 + dir * editor.camera.PixelToWorldSize(origin, 90); var p2 = p1 + dir * editor.camera.PixelToWorldSize(origin, 20); dr.DrawLine(p0, p1, color, color, 2, 2); dr.DrawLine(p1, p2, color, color, 9, 1); }
public override void Draw(DebugRender dr, Matrix transform, Color color) { var p0 = transform.TranslationVector; var p1 = transform.TranslationVector + Vector3.Up * 2; var pf = transform.TranslationVector + transform.Forward; dr.DrawRing(p0, 0.50f, color, 16); dr.DrawRing(p1, 0.50f, color, 16); dr.DrawLine(p0, pf, color, color, 5, 1); }
public Vector3 findWaypoint() { Vector3 zero = Vector3.zero; Vector3 zero2 = Vector3.zero; zero2.Set(UnityEngine.Random.Range(-this._spawner._spawnSphere, this._spawner._spawnSphere), UnityEngine.Random.Range(-this._spawner._spawnSphereHeight, this._spawner._spawnSphereHeight), UnityEngine.Random.Range(-this._spawner._spawnSphereDepth, this._spawner._spawnSphereDepth)); Vector3 vector = this._spawner._thisT.rotation * zero2 + this._spawner._posBuffer; DebugRender.DrawPoint(vector, Color.black, 0.3f, 100f); return(vector); }
public override void Draw(DebugRender dr, Matrix transform, Color color) { if (factory == null) { base.Draw(dr, transform, color); } else { factory.Draw(dr, transform, color); } }
public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected) { dr.DrawPoint(WorldMatrix.TranslationVector, 0.5f, color, 1); var bbox1 = new BoundingBox(Width, Height, Depth); var bbox2 = new BoundingBox(0.5f, 0.5f, 0.5f); if (selected) { dr.DrawBox(bbox1, WorldMatrix, color); } else { dr.DrawBox(bbox2, WorldMatrix, color); } }
private void FixedUpdate() { if (this.m_RigidBody == null) { base.GetComponents <Rigidbody>(this.m_TempList); if (this.m_TempList.Count > 0) { this.m_RigidBody = this.m_TempList[0]; } } if (this.m_RigidBody != null && this.m_AddAngularVelOnStart && Time.time - this.m_StartTime < this.m_AddAngularVelocityOnStartDuration) { this.m_RigidBody.isKinematic = false; this.m_RigidBody.AddTorque(this.m_AngularVelocityOnStart * 1f, ForceMode.Acceleration); DebugRender.DrawLine(base.transform.position, base.transform.position + this.m_AngularVelocityOnStart, default(Color), 0f); } }
private bool CheckCornerInAir(Vector3 corner) { corner.y += this.m_RayCheckUpOffset; RaycastHit[] array = Physics.RaycastAll(corner, Vector3.down, this.m_RayCheckLength); for (int i = 0; i < array.Length; i++) { if (!(array[i].collider == this.m_BoxCollider)) { if (array[i].collider.GetType() == typeof(TerrainCollider)) { DebugRender.DrawLine(corner, corner + Vector3.down * this.m_RayCheckLength, Color.green, 0f); return(false); } } } DebugRender.DrawLine(corner, corner + Vector3.down * this.m_RayCheckLength, Color.red, 0f); return(true); }
public void SetFlockRandomPosition() { Vector3 vector = Vector3.zero; Vector3 zero = Vector3.zero; zero.Set(UnityEngine.Random.Range(-this._positionSphere, this._positionSphere), UnityEngine.Random.Range(-this._positionSphereHeight, this._positionSphereHeight), UnityEngine.Random.Range(-this._positionSphereDepth, this._positionSphereDepth)); vector = this._thisT.rotation * zero; vector += this._thisT.position; DebugRender.DrawPoint(vector, Color.white, 0.3f, 100f); this._posBuffer = vector; if (this._forceChildWaypoints) { for (int i = 0; i < this._roamers.Count; i++) { this._roamers[i].Wander(UnityEngine.Random.value * this._forcedRandomDelay); } } }
public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected) { dr.DrawBasis(WorldMatrix, 1, 2); if (scene != null && selected) { for (int i = 0; i < scene.Nodes.Count; i++) { var node = scene.Nodes[i]; if (node.MeshIndex < 0) { continue; } dr.DrawBox(bboxes[node.MeshIndex], transforms[i] * WorldMatrix, color, 1); } } }
protected void Update() { Vector3 from = transform.position; from.y = 0.0f; Vector3 to = _target.transform.position; to.y = 0.0f; DebugRender.Draw(from, to, Color.green); DebugRender.Draw(from, from + transform.forward * to.magnitude, Color.blue); Vector3 direction = to - from; if (Vector3.Angle(direction, transform.forward) > _cullingAngle) { transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.LookRotation(direction), _rotationSpeed * Time.deltaTime); } }
public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected) { var transform = WorldMatrix; var lightColor = LightPresetColor.GetColor(LightPreset, Intensity); var max = Math.Max(Math.Max(lightColor.Red, lightColor.Green), Math.Max(lightColor.Blue, 1)); var dispColor = new Color((byte)(lightColor.Red / max * 255), (byte)(lightColor.Green / max * 255), (byte)(lightColor.Blue / max * 255), (byte)255); dr.DrawPoint(transform.TranslationVector, 1, color, 1); if (selected) { dr.DrawSphere(transform.TranslationVector, Radius, dispColor); } else { } }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) { Material targetMat = materialEditor.target as Material; EditorGUI.BeginChangeCheck(); RaymarchAlgorithm = (RaymarchType)EditorGUILayout.EnumPopup("Marching to use", RaymarchAlgorithm); DebugType = (DebugRender)EditorGUILayout.EnumPopup("Debug?", DebugType); if (EditorGUI.EndChangeCheck()) { var names = Enum.GetNames(typeof(RaymarchType)); foreach (var name in names) { if (name.Equals(RaymarchAlgorithm.ToString())) { targetMat.EnableKeyword(name); } else { targetMat.DisableKeyword(name); } } names = Enum.GetNames(typeof(DebugRender)); foreach (var name in names) { if (name.Equals(DebugType.ToString())) { targetMat.EnableKeyword(name); } else { targetMat.DisableKeyword(name); } } } base.OnGUI(materialEditor, properties); }
public void OnDrawGizmos() { if (this._thisT == null) { this._thisT = base.transform; } if (!Application.isPlaying && this._posBuffer != this._thisT.position + this._startPosOffset) { this._posBuffer = this._thisT.position + this._startPosOffset; } if (this._positionSphereDepth == -1f) { this._positionSphereDepth = this._positionSphere; } if (this._spawnSphereDepth == -1f) { this._spawnSphereDepth = this._spawnSphere; } Gizmos.color = Color.blue; DebugRender.DrawBoxGizmos(this._posBuffer, new Vector3(this._spawnSphere * 2f, this._spawnSphereHeight * 2f, this._spawnSphereDepth * 2f), base.transform.rotation); Gizmos.color = Color.cyan; DebugRender.DrawBoxGizmos(this._thisT.position, new Vector3(this._positionSphere * 2f + this._spawnSphere * 2f, this._positionSphereHeight * 2f + this._spawnSphereHeight * 2f, this._positionSphereDepth * 2f + this._spawnSphereDepth * 2f), base.transform.rotation); }
public void DrawDebug() { bool flag = false; bool flag2 = true; bool flag3 = true; for (int i = 0; i < this.m_NumCellsX; i++) { for (int j = 0; j < this.m_NumCellsY; j++) { QuadTreeCellBalanceSystem quadTreeCellBalanceSystem = this.m_Cells[i, j]; if (flag || (flag3 && quadTreeCellBalanceSystem.m_Objects.Count > 0)) { Vector3 zero = Vector3.zero; zero.x = quadTreeCellBalanceSystem.m_Pos.x; zero.z = quadTreeCellBalanceSystem.m_Pos.y; Vector3 end = zero; end.x += quadTreeCellBalanceSystem.m_Size.x; DebugRender.DrawLine(zero, end, Color.white, 0f); end = zero; end.z += quadTreeCellBalanceSystem.m_Size.y; DebugRender.DrawLine(zero, end, Color.white, 0f); } if (flag2) { for (int k = 0; k < quadTreeCellBalanceSystem.m_Objects.Count; k++) { BalanceSystemObject balanceSystemObject = quadTreeCellBalanceSystem.m_Objects[k]; if (balanceSystemObject.m_GameObject != null) { DebugRender.DrawPoint(balanceSystemObject.m_GameObject.transform.position, (!balanceSystemObject.m_GameObject.activeSelf) ? Color.green : Color.red, 0.3f, 0f); } } } } } }
public void DrawDebug() { bool flag = false; bool flag2 = true; bool flag3 = true; for (int i = 0; i < this.m_NumCellsX; i++) { for (int j = 0; j < this.m_NumCellsY; j++) { QuadTreeStaticObjectsCell quadTreeStaticObjectsCell = this.m_Cells[i, j]; if (flag || (flag3 && quadTreeStaticObjectsCell.m_Objects.Count > 0)) { Vector3 zero = Vector3.zero; zero.x = quadTreeStaticObjectsCell.m_Pos.x; zero.z = quadTreeStaticObjectsCell.m_Pos.y; Vector3 end = zero; end.x += quadTreeStaticObjectsCell.m_Size.x; DebugRender.DrawLine(zero, end, Color.white, 0f); end = zero; end.z += quadTreeStaticObjectsCell.m_Size.y; DebugRender.DrawLine(zero, end, Color.white, 0f); } if (flag2) { for (int k = 0; k < quadTreeStaticObjectsCell.m_Objects.Count; k++) { GameObject gameObject = quadTreeStaticObjectsCell.m_Objects[k].m_GameObject; if (gameObject) { DebugRender.DrawPoint(gameObject.transform.position, gameObject.activeSelf ? Color.red : Color.green, 0.3f, 0f); } } } } } }
public override void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected) { var transform = WorldMatrix; var lightColor = LightPresetColor.GetColor(LightPreset, Intensity);; var max = Math.Max(Math.Max(lightColor.Red, lightColor.Green), Math.Max(lightColor.Blue, 1)); var dispColor = new Color((byte)(lightColor.Red / max * 255), (byte)(lightColor.Green / max * 255), (byte)(lightColor.Blue / max * 255), (byte)255); dr.DrawPoint(transform.TranslationVector, 1, color, 2); if (selected) { var frustum = new BoundingFrustum(SpotView * SpotProjection); var points = frustum.GetCorners(); dr.DrawLine(points[0], points[1], color); dr.DrawLine(points[1], points[2], color); dr.DrawLine(points[2], points[3], color); dr.DrawLine(points[3], points[0], color); dr.DrawLine(points[4], points[5], color); dr.DrawLine(points[5], points[6], color); dr.DrawLine(points[6], points[7], color); dr.DrawLine(points[7], points[4], color); dr.DrawLine(points[0], points[4], color); dr.DrawLine(points[1], points[5], color); dr.DrawLine(points[2], points[6], color); dr.DrawLine(points[3], points[7], color); } else { } }
public void DrawNavigationMeshDebug(DebugRender dr) { if (SourceNavigationMesh != null) { var srcNavMesh = SourceNavigationMesh; foreach (var p in srcNavMesh.Vertices) { //dr.DrawPoint( p, 0.1f, Color.Yellow ); } } if (navIndices == null) { return; } foreach (var p in navVertices) { dr.DrawPoint(p, 0.1f, Color.Yellow); } var color = Color.Yellow; for (int i = 0; i < navIndices.Length / 3; i++) { var p0 = navVertices[navIndices[i * 3 + 0]]; var p1 = navVertices[navIndices[i * 3 + 1]]; var p2 = navVertices[navIndices[i * 3 + 2]]; dr.DrawLine(p0, p1, color, color, 2, 2); dr.DrawLine(p1, p2, color, color, 2, 2); dr.DrawLine(p2, p0, color, color, 2, 2); } }
private void UpdateDebug() { if (Input.GetKeyDown(KeyCode.Alpha0) && Input.GetKey(KeyCode.LeftAlt)) { DamageInfo damageInfo = new DamageInfo(); damageInfo.m_Damage = 10f; damageInfo.m_HitDir = base.transform.up * -1f; Player.Get().TakeDamage(damageInfo); DebugRender.DrawLine(base.transform.position, base.transform.position + damageInfo.m_HitDir, Color.cyan, 50f); } if (Input.GetKeyDown(KeyCode.Alpha1) && Input.GetKey(KeyCode.LeftAlt)) { DamageInfo damageInfo2 = new DamageInfo(); damageInfo2.m_Damage = 10f; damageInfo2.m_HitDir = base.transform.up * -1f; damageInfo2.m_HitDir += base.transform.right * 1f; damageInfo2.m_HitDir.Normalize(); Player.Get().TakeDamage(damageInfo2); DebugRender.DrawLine(base.transform.position, base.transform.position + damageInfo2.m_HitDir, Color.cyan, 50f); } if (Input.GetKeyDown(KeyCode.Alpha2) && Input.GetKey(KeyCode.LeftAlt)) { DamageInfo damageInfo3 = new DamageInfo(); damageInfo3.m_Damage = 10f; damageInfo3.m_HitDir = base.transform.right * 1f; damageInfo3.m_HitDir.Normalize(); Player.Get().TakeDamage(damageInfo3); DebugRender.DrawLine(base.transform.position, base.transform.position + damageInfo3.m_HitDir, Color.cyan, 50f); } if (Input.GetKeyDown(KeyCode.Alpha3) && Input.GetKey(KeyCode.LeftAlt)) { DamageInfo damageInfo4 = new DamageInfo(); damageInfo4.m_Damage = 10f; damageInfo4.m_HitDir = base.transform.right * 1f; damageInfo4.m_HitDir += base.transform.up * 1.3f; damageInfo4.m_HitDir.Normalize(); Player.Get().TakeDamage(damageInfo4); DebugRender.DrawLine(base.transform.position, base.transform.position + damageInfo4.m_HitDir, Color.cyan, 50f); } if (Input.GetKeyDown(KeyCode.Alpha4) && Input.GetKey(KeyCode.LeftAlt)) { DamageInfo damageInfo5 = new DamageInfo(); damageInfo5.m_Damage = 10f; damageInfo5.m_HitDir = base.transform.up; damageInfo5.m_HitDir.Normalize(); Player.Get().TakeDamage(damageInfo5); DebugRender.DrawLine(base.transform.position, base.transform.position + damageInfo5.m_HitDir, Color.cyan, 50f); } if (Input.GetKeyDown(KeyCode.Alpha5) && Input.GetKey(KeyCode.LeftAlt)) { DamageInfo damageInfo6 = new DamageInfo(); damageInfo6.m_Damage = 10f; damageInfo6.m_HitDir = base.transform.up * 1.2f; damageInfo6.m_HitDir += base.transform.right * -1f; damageInfo6.m_HitDir.Normalize(); Player.Get().TakeDamage(damageInfo6); DebugRender.DrawLine(base.transform.position, base.transform.position + damageInfo6.m_HitDir, Color.cyan, 50f); } if (Input.GetKeyDown(KeyCode.Alpha6) && Input.GetKey(KeyCode.LeftAlt)) { DamageInfo damageInfo7 = new DamageInfo(); damageInfo7.m_Damage = 10f; damageInfo7.m_HitDir = base.transform.right * -1f; damageInfo7.m_HitDir.Normalize(); Player.Get().TakeDamage(damageInfo7); DebugRender.DrawLine(base.transform.position, base.transform.position + damageInfo7.m_HitDir, Color.cyan, 50f); } if (Input.GetKeyDown(KeyCode.Alpha7) && Input.GetKey(KeyCode.LeftAlt)) { DamageInfo damageInfo8 = new DamageInfo(); damageInfo8.m_Damage = 10f; damageInfo8.m_HitDir = base.transform.up * -1f; damageInfo8.m_HitDir += base.transform.right * -1f; damageInfo8.m_HitDir.Normalize(); Player.Get().TakeDamage(damageInfo8); DebugRender.DrawLine(base.transform.position, base.transform.position + damageInfo8.m_HitDir, Color.cyan, 50f); } }
private void SetupSurroundingConstructions() { Bounds coumpoundObjectBounds = General.GetCoumpoundObjectBounds(base.gameObject); DebugRender.DrawBox(coumpoundObjectBounds, Color.blue); List <Construction> list = new List <Construction>(); for (int i = 0; i < Construction.s_EnabledConstructions.Count; i++) { Construction construction = Construction.s_EnabledConstructions[i]; if (construction.gameObject.activeSelf && construction.m_Info != null) { float magnitude = (construction.gameObject.transform.position - base.gameObject.transform.position).magnitude; if (magnitude <= 10f) { float paramsMulRadius = ((ConstructionInfo)construction.m_Info).m_ParamsMulRadius; if (paramsMulRadius >= 0f) { if (magnitude < paramsMulRadius) { list.Add(construction); } } else { Bounds coumpoundObjectBounds2 = General.GetCoumpoundObjectBounds(construction.gameObject); DebugRender.DrawBox(coumpoundObjectBounds2, Color.blue); if (coumpoundObjectBounds2.Intersects(coumpoundObjectBounds)) { list.Add(construction); } } } } } if (this.m_RestingPlace) { float num = ((ConstructionInfo)this.m_RestingPlace.m_Info).m_RestingParamsMul; for (int j = 0; j < list.Count; j++) { ConstructionInfo constructionInfo = (ConstructionInfo)list[j].m_Info; if (list[j] != null && list[j].HasRestInfluence()) { num *= constructionInfo.m_RestingParamsMul; } } this.m_ParamsMul = num; } this.m_Shelter = null; this.m_Firecamps.Clear(); foreach (Construction construction2 in list) { if (construction2.GetType() == typeof(Firecamp)) { this.m_Firecamps.Add((Firecamp)construction2); } else if (construction2.m_Info.m_ID.ToString().ToLower().Contains("shelter")) { this.m_Shelter = construction2; } } }
/// <summary> /// /// </summary> /// <param name="dr"></param> public abstract void DrawNode(GameWorld world, DebugRender dr, Color color, bool selected);
/// <summary> /// Draws entity in editor /// </summary> /// <param name="dr"></param> /// <param name="transform"></param> /// <param name="color"></param> public virtual void Draw(DebugRender dr, Matrix transform, Color color) { dr.DrawBox(MapEditor.DefaultBox, transform, color); }