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 Direction = CameraRoot.forward;
|
||||
RaycastHit Hit;
|
||||
if (Physics.Raycast(From, Direction, out Hit)) {
|
||||
Vector3 To = Hit.point;
|
||||
ShotDelta = To - GunPoint;
|
||||
|
||||
if (Physics.Raycast(GunPoint, ShotDelta, out Hit, ShotDelta.magnitude + 0.1f, BulletHitLayer)) {
|
||||
Player Player = Hit.rigidbody.GetComponent<Player>();
|
||||
RaycastHit[] Hits = Physics.RaycastAll(From, Direction, BulletHitLayer);
|
||||
foreach (RaycastHit Hit in Hits) {
|
||||
Player Player = Hit.rigidbody != null ? Hit.rigidbody.GetComponent<Player>() : null;
|
||||
if (Player == this) {
|
||||
continue;
|
||||
}
|
||||
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);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
GameObject LaserEffect = Instantiate(LaserPrefab);
|
||||
|
Loading…
Reference in New Issue
Block a user