Make Hit send source, and add splashes
This commit is contained in:
parent
1562209504
commit
0a3ba11688
1
.gitignore
vendored
1
.gitignore
vendored
@ -102,4 +102,5 @@ InitTestScene*.unity
|
||||
LightingData.asset*
|
||||
|
||||
# Sprites
|
||||
!/[Aa]ssets/[Gg]raphics/[Ss]plashes/**/*
|
||||
!/[Aa]ssets/[Gg]raphics/[Ss]prites/**/*
|
||||
|
BIN
Assets/Graphics/Splashes/NeonTea.png
Normal file
BIN
Assets/Graphics/Splashes/NeonTea.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
118
Assets/Graphics/Splashes/NeonTea.png.meta
Normal file
118
Assets/Graphics/Splashes/NeonTea.png.meta
Normal file
@ -0,0 +1,118 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49f9a3737fb462a4b9e0b34216971d29
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 2
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 5e97eb03825dee720800000000000000
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -15,13 +15,19 @@ namespace NeonTea.Quakeball.Networking.Instances {
|
||||
private Connection Server;
|
||||
|
||||
private Dictionary<ulong, NetPlayer> Players = new Dictionary<ulong, NetPlayer>();
|
||||
private NetPlayer LocalPlayer;
|
||||
private bool SelfIdentified = false;
|
||||
|
||||
public float Ping { get; private set; }
|
||||
private float LastPingReceived;
|
||||
private byte LastPingIdent;
|
||||
|
||||
public Client() {
|
||||
Net = GameObject.FindGameObjectWithTag("Net").GetComponent<NetChaperone>();
|
||||
|
||||
LocalPlayer = new NetPlayer(ulong.MaxValue - 1);
|
||||
LocalPlayer.Controlled = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
|
||||
}
|
||||
|
||||
public override void Start(string address, int port, PeerMessageListener listener) {
|
||||
if (Peer.Running) {
|
||||
return;
|
||||
@ -31,11 +37,6 @@ namespace NeonTea.Quakeball.Networking.Instances {
|
||||
Peer.Start(0);
|
||||
byte ident = Peer.RegisterProtocol(new GameProtocol(this));
|
||||
Peer.Connect(address, port, ident);
|
||||
|
||||
Net = GameObject.FindGameObjectWithTag("Net").GetComponent<NetChaperone>();
|
||||
|
||||
LocalPlayer = new NetPlayer(ulong.MaxValue - 1);
|
||||
LocalPlayer.Controlled = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
|
||||
}
|
||||
|
||||
public override void OnStop() {
|
||||
@ -130,7 +131,7 @@ namespace NeonTea.Quakeball.Networking.Instances {
|
||||
} else if (packet is HitPckt) {
|
||||
HitPckt hit = (HitPckt)packet;
|
||||
if (Players[hit.Target].Controlled != null) {
|
||||
Players[hit.Target].Controlled.Hit();
|
||||
Players[hit.Target].Controlled.Hit(hit.Source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ namespace NeonTea.Quakeball.Networking.Instances {
|
||||
public Peer Peer;
|
||||
public List<ulong> Connections = new List<ulong>();
|
||||
|
||||
public NetPlayer LocalPlayer;
|
||||
|
||||
public NetInstance() {
|
||||
Peer = new Peer(Fingerprint);
|
||||
}
|
||||
|
@ -16,12 +16,14 @@ namespace NeonTea.Quakeball.Networking.Instances {
|
||||
public List<NetPlayer> PlayerList { get; private set; } = new List<NetPlayer>();
|
||||
private ulong PlayerIdCounter;
|
||||
|
||||
private NetPlayer LocalPlayer = new NetPlayer(ulong.MaxValue);
|
||||
|
||||
private byte LastPingIdent;
|
||||
private float LastSentPing;
|
||||
public static float PingInterval = 1;
|
||||
|
||||
public Server() {
|
||||
LocalPlayer = new NetPlayer(ulong.MaxValue);
|
||||
}
|
||||
|
||||
public override void Start(string address, int port, PeerMessageListener listener) {
|
||||
if (Peer.Running) {
|
||||
return;
|
||||
@ -201,8 +203,8 @@ namespace NeonTea.Quakeball.Networking.Instances {
|
||||
SendUnreliableToAll(pckt);
|
||||
}
|
||||
|
||||
public void SendHit(ulong id) {
|
||||
HitPckt hit = new HitPckt(id);
|
||||
public void SendHit(ulong source, ulong target) {
|
||||
HitPckt hit = new HitPckt(source, target);
|
||||
SendReliableToAll(hit);
|
||||
}
|
||||
|
||||
|
@ -4,16 +4,22 @@ using NeonTea.Quakeball.TeaNet.Packets;
|
||||
namespace NeonTea.Quakeball.Networking.Packets {
|
||||
public class HitPckt : Packet {
|
||||
|
||||
public ulong Source;
|
||||
public ulong Target;
|
||||
|
||||
public HitPckt() { }
|
||||
public HitPckt(ulong id) { Target = id; }
|
||||
public HitPckt(ulong source, ulong target) {
|
||||
Source = source;
|
||||
Target = target;
|
||||
}
|
||||
|
||||
public override void Read(ByteBuffer buffer) {
|
||||
Source = buffer.ReadULong();
|
||||
Target = buffer.ReadULong();
|
||||
}
|
||||
|
||||
public override void Write(ByteBuffer buffer) {
|
||||
buffer.Write(Source);
|
||||
buffer.Write(Target);
|
||||
}
|
||||
}
|
||||
|
@ -60,11 +60,6 @@ namespace NeonTea.Quakeball.Players {
|
||||
transform.position = new Vector3(float.Parse(args[0]), float.Parse(args[1]), float.Parse(args[2]));
|
||||
return true;
|
||||
}, "tp x y z - Teleports the local player to the specified coordinates.");
|
||||
|
||||
Terminal.Singleton.RegisterCommand("hit", args => {
|
||||
Player.Hit();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
|
@ -179,8 +179,8 @@ namespace NeonTea.Quakeball.Players {
|
||||
}
|
||||
if (Player != null) {
|
||||
if (Net.Singleton.Instance is Server) {
|
||||
((Server)Net.Singleton.Instance).SendHit(Player.NetId);
|
||||
Player.Hit();
|
||||
((Server)Net.Singleton.Instance).SendHit(NetId, Player.NetId);
|
||||
Player.Hit(NetId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -194,10 +194,14 @@ namespace NeonTea.Quakeball.Players {
|
||||
AudioSource.PlayOneShot(RaygunAudio);
|
||||
}
|
||||
|
||||
public void Hit() {
|
||||
public void Hit(ulong sourceUid) {
|
||||
if (Net.Singleton.Instance is Server) {
|
||||
((Server)Net.Singleton.Instance).HandlePlayerDeath(NetId);
|
||||
}
|
||||
bool IsLocal = true;
|
||||
if (Net.Singleton.Instance != null) {
|
||||
IsLocal = Net.Singleton.Instance.LocalPlayer.Id == sourceUid;
|
||||
}
|
||||
Debug.Log("I was hit! Aaagh!");
|
||||
Splatter.Play();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user