Remove self shooty
This commit is contained in:
parent
a028ca93c9
commit
75037e5514
@ -155,23 +155,19 @@ namespace NeonTea.Quakeball.Players {
|
|||||||
|
|
||||||
Vector3 From = CameraRoot.position;
|
Vector3 From = CameraRoot.position;
|
||||||
Vector3 Direction = CameraRoot.forward;
|
Vector3 Direction = CameraRoot.forward;
|
||||||
RaycastHit Hit;
|
RaycastHit[] Hits = Physics.RaycastAll(From, Direction, BulletHitLayer);
|
||||||
if (Physics.Raycast(From, Direction, out Hit)) {
|
foreach (RaycastHit Hit in Hits) {
|
||||||
Vector3 To = Hit.point;
|
Player Player = Hit.rigidbody != null ? Hit.rigidbody.GetComponent<Player>() : null;
|
||||||
ShotDelta = To - GunPoint;
|
if (Player == this) {
|
||||||
|
continue;
|
||||||
if (Physics.Raycast(GunPoint, ShotDelta, out Hit, ShotDelta.magnitude + 0.1f, BulletHitLayer)) {
|
|
||||||
Player Player = Hit.rigidbody.GetComponent<Player>();
|
|
||||||
if (Player != null) {
|
|
||||||
Debug.DrawLine(GunPoint, To, Color.red, 5f);
|
|
||||||
if (Net.Singleton.Instance is Server) {
|
|
||||||
((Server)Net.Singleton.Instance).SendHit(Player.NetId);
|
|
||||||
}
|
|
||||||
Player.Hit();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Debug.DrawLine(GunPoint, To, Color.yellow, 5f);
|
|
||||||
}
|
}
|
||||||
|
if (Player != null) {
|
||||||
|
if (Net.Singleton.Instance is Server) {
|
||||||
|
((Server)Net.Singleton.Instance).SendHit(Player.NetId);
|
||||||
|
}
|
||||||
|
Player.Hit();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject LaserEffect = Instantiate(LaserPrefab);
|
GameObject LaserEffect = Instantiate(LaserPrefab);
|
||||||
|
Loading…
Reference in New Issue
Block a user