Make dying disable inputs

This commit is contained in:
Sofia 2020-08-08 16:22:46 +03:00
parent 231054030b
commit be2c5a8640
4 changed files with 122 additions and 10 deletions

View File

@ -97,7 +97,7 @@ LightmapSettings:
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 112000000, guid: 598a4fae95edbca4f81df6d5b3bd0688, type: 2}
m_LightingDataAsset: {fileID: 112000000, guid: 34a8b00aa8bba4449a5285eb76698434, type: 2}
m_LightingSettings: {fileID: 4890085278179872738, guid: eab3e4c589c0a1147a910511c80f5e0c, type: 2}
--- !u!196 &4
NavMeshSettings:
@ -150,8 +150,8 @@ Transform:
m_LocalPosition: {x: 4.822436, y: -2.032894, z: 3.4411402}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1433022807}
- {fileID: 1782355448}
- {fileID: 1433022807}
- {fileID: 1901268757}
m_Father: {fileID: 0}
m_RootOrder: 8
@ -1684,6 +1684,108 @@ Light:
m_UseBoundingSphereOverride: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!1001 &1355058974
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1734890299}
m_Modifications:
- target: {fileID: 5012256108666685483, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_Name
value: DeadScreen
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
--- !u!224 &1355058975 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 8861545984823841015, guid: 118c1cf390ce96243b1b8b147ae99885, type: 3}
m_PrefabInstance: {fileID: 1355058974}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1358596444
GameObject:
m_ObjectHideFlags: 0
@ -1753,7 +1855,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9809d6aa0cef6934db26a1986ab67665, type: 3}
propertyPath: m_RootOrder
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 9809d6aa0cef6934db26a1986ab67665, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@ -1978,6 +2080,7 @@ RectTransform:
m_Children:
- {fileID: 629769913}
- {fileID: 267525579}
- {fileID: 1355058975}
m_Father: {fileID: 187747573}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -2157,7 +2260,7 @@ Transform:
m_LocalScale: {x: 2, y: 2, z: 1}
m_Children: []
m_Father: {fileID: 21404627}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!65 &1782355449
BoxCollider:

View File

@ -89,10 +89,7 @@ namespace NeonTea.Quakeball.Networking.Instances {
}
} else if (packet is PlayerUpdatePckt) {
PlayerUpdatePckt updatePckt = (PlayerUpdatePckt)packet;
if (Players[conn.uid].Controlled != null) {
updatePckt.PlayerId = conn.uid;
Players[conn.uid].Controlled.ProcessUpdatePacket(updatePckt);
}
HandleUpdatePckt(conn.uid, updatePckt);
} else if (packet is PlayerSyncPacket) {
PlayerSyncPacket syncPckt = (PlayerSyncPacket)packet;
HandleSyncPckt(conn.uid, syncPckt);
@ -138,8 +135,15 @@ namespace NeonTea.Quakeball.Networking.Instances {
PlayerList.Remove(player);
}
private void HandleUpdatePckt(ulong uid, PlayerUpdatePckt pckt) {
if (Players[uid].Controlled != null && !Players[uid].Controlled.IsDead) {
pckt.PlayerId = uid;
Players[uid].Controlled.ProcessUpdatePacket(pckt);
}
}
private void HandleSyncPckt(ulong uid, PlayerSyncPacket pckt) {
if (Players[uid].Controlled != null) {
if (Players[uid].Controlled != null && !Players[uid].Controlled.IsDead) {
pckt.PlayerId = uid;
if (!Players[uid].Controlled.ProcessSyncPacket(pckt, false)) {
Players[uid].Unsynced = true;

View File

@ -89,6 +89,9 @@ namespace NeonTea.Quakeball.Players {
if (Time.time - PreviousPlayerUpdate >= 1f / Player.UpdateFrequency) {
PreviousPlayerUpdate = Time.time;
if (Player.IsDead) {
return;
}
Vector2 MovementInput = MoveAction.ReadValue<Vector2>();
Vector3 Move = new Vector3(MovementInput.x, 0, MovementInput.y);

View File

@ -223,12 +223,13 @@ namespace NeonTea.Quakeball.Players {
if (IsDead) {
return;
}
// Do something so the dead can not move even if they so wish.
if (Net.Singleton.Instance != null && Net.Singleton.Instance.LocalPlayer.Id == NetId) {
string name = $"Connection {killer}";
GameObject.FindGameObjectWithTag("DeadScreen").GetComponent<DeadScreen>().StartCountdown(name);
Net.Singleton.Instance.LocalPlayer.Controlled.GetComponent<LocalPlayer>().DisableInput += 1;
}
TimeofDeath = Time.time;
MoveDirection = Vector3.zero;
IsDead = true;
}
@ -236,6 +237,7 @@ namespace NeonTea.Quakeball.Players {
public void Respawn(Vector3 location) {
if (Net.Singleton.Instance != null && Net.Singleton.Instance.LocalPlayer.Id == NetId) {
GameObject.FindGameObjectWithTag("DeadScreen").GetComponent<DeadScreen>().Open = false;
Net.Singleton.Instance.LocalPlayer.Controlled.GetComponent<LocalPlayer>().DisableInput -= 1;
}
transform.position = location;
IsDead = false;