-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed NullReferenceException when binding levers and gates Fixed a bug which tries to access patients after destroying them
- Loading branch information
1 parent
bdf8a21
commit b528efa
Showing
8 changed files
with
132 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
public class MirrorInverse : Mirror | ||
{ | ||
protected override void Start() | ||
public MirrorInverse() | ||
{ | ||
base.Start(); | ||
|
||
Forward = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
public class LineStripRenderer : Component | ||
{ | ||
private readonly List<LineRenderer> lines; | ||
private readonly Component parent; | ||
|
||
public LineStripRenderer(Component parent) | ||
{ | ||
lines = new List<LineRenderer>(); | ||
this.parent = parent; | ||
} | ||
|
||
public void Draw(List<Vector2> points) | ||
{ | ||
var newLinesCount = points.Count - 1; | ||
|
||
for (var i = newLinesCount; i < lines.Count; i++) | ||
{ | ||
lines[i].enabled = false; | ||
} | ||
|
||
for (var i = lines.Count; i < newLinesCount; i++) | ||
{ | ||
var laser = new GameObject("Laser"); | ||
laser.transform.parent = parent.transform; | ||
|
||
var line = laser.AddComponent<LineRenderer>(); | ||
line.SetWidth(0.1f, 0.1f); | ||
line.SetVertexCount(2); | ||
|
||
lines.Add(line); | ||
} | ||
|
||
for (var i = 0; i < newLinesCount; i++) | ||
{ | ||
lines[i].SetPosition(0, points[i]); | ||
lines[i].SetPosition(1, points[i + 1]); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,51 @@ | ||
using UnityEngine; | ||
|
||
namespace Assets.Scripts.Utilities | ||
public static class Physics2DExt | ||
{ | ||
public static class Physics2DExt | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="origin"></param> | ||
/// <param name="direction"></param> | ||
/// <param name="distance"></param> | ||
/// <param name="includingOrigin">If true, include the origin when detecting collision</param> | ||
/// <returns></returns> | ||
public static RaycastHit2D Raycast(Vector2 origin, Vector2 direction, float distance, bool includingOrigin) | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="origin"></param> | ||
/// <param name="direction"></param> | ||
/// <param name="distance"></param> | ||
/// <param name="includingOrigin">If true, include the origin when detecting collision</param> | ||
/// <returns></returns> | ||
public static RaycastHit2D Raycast(Vector2 origin, Vector2 direction, float distance, bool includingOrigin) | ||
{ | ||
var currentDistance = includingOrigin ? 0 : 1; | ||
|
||
for (; currentDistance <= distance; currentDistance++) | ||
{ | ||
var newOrigin = origin + currentDistance * direction; | ||
var hit = Physics2D.Raycast(newOrigin, direction, 0); | ||
var currentDistance = includingOrigin ? 0 : 1; | ||
|
||
if (hit.collider != null) return hit; | ||
} | ||
for (; currentDistance <= distance; currentDistance++) | ||
{ | ||
var newOrigin = origin + currentDistance * direction; | ||
var hit = Physics2D.Raycast(newOrigin, direction, 0); | ||
|
||
return new RaycastHit2D(); | ||
if (hit.collider != null) return hit; | ||
} | ||
|
||
/// <summary> | ||
/// Include the origin when detecting collision | ||
/// </summary> | ||
/// <param name="origin"></param> | ||
/// <param name="direction"></param> | ||
/// <param name="distance"></param> | ||
/// <returns></returns> | ||
public static RaycastHit2D Raycast(Vector2 origin, Vector2 direction, float distance) | ||
{ | ||
return Raycast(origin, direction, distance, true); | ||
} | ||
return new RaycastHit2D(); | ||
} | ||
|
||
/// <summary> | ||
/// Exclude the origin when detecting collision | ||
/// </summary> | ||
/// <param name="origin"></param> | ||
/// <param name="direction"></param> | ||
/// <param name="distance"></param> | ||
/// <returns></returns> | ||
public static RaycastHit2D RaycastExclusive(Vector2 origin, Vector2 direction, float distance) | ||
{ | ||
return Raycast(origin, direction, distance, false); | ||
} | ||
/// <summary> | ||
/// Include the origin when detecting collision | ||
/// </summary> | ||
/// <param name="origin"></param> | ||
/// <param name="direction"></param> | ||
/// <param name="distance"></param> | ||
/// <returns></returns> | ||
public static RaycastHit2D Raycast(Vector2 origin, Vector2 direction, float distance) | ||
{ | ||
return Raycast(origin, direction, distance, true); | ||
} | ||
|
||
/// <summary> | ||
/// Exclude the origin when detecting collision | ||
/// </summary> | ||
/// <param name="origin"></param> | ||
/// <param name="direction"></param> | ||
/// <param name="distance"></param> | ||
/// <returns></returns> | ||
public static RaycastHit2D RaycastExclusive(Vector2 origin, Vector2 direction, float distance) | ||
{ | ||
return Raycast(origin, direction, distance, false); | ||
} | ||
} |