Add lasers

This commit is contained in:
Jens Pitkänen 2020-08-08 08:23:23 +03:00
parent 4b6bd0c66d
commit a028ca93c9
14 changed files with 5095 additions and 52 deletions

View File

@ -274,6 +274,10 @@ PrefabInstance:
propertyPath: m_Layer
value: 11
objectReference: {fileID: 0}
- target: {fileID: 2637233632139837434, guid: 0bffd92c46c257840806f5e957954800, type: 3}
propertyPath: m_LocalPosition.z
value: 0.093
objectReference: {fileID: 0}
- target: {fileID: 4833458671639168932, guid: 0bffd92c46c257840806f5e957954800, type: 3}
propertyPath: m_RootOrder
value: 3

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c5afe7f73c0751644af28475fa9657db
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5c99da0361d098646b319a35fcc80095
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -24,7 +24,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 379718841342258282}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.05, z: 0.55}
m_LocalPosition: {x: 0, y: 0.05, z: 0.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8204020546429986303}
@ -660,6 +660,7 @@ MonoBehaviour:
- {fileID: 4000144568201082722}
Lean: 0
Splatter: {fileID: 5204970423912589616}
LaserPrefab: {fileID: 8009551885746485900, guid: 5c99da0361d098646b319a35fcc80095, type: 3}
Pitch: 0
Yaw: 0
BodyYaw: 0

View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.17393494, g: 0.2174847, b: 0.299652, a: 1}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:

View File

@ -0,0 +1,109 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: ShootLaserTrail
m_Shader: {fileID: 4800000, guid: b7839dad95683814aa64166edc107ae2, type: 3}
m_ShaderKeywords: _EMISSION
m_LightmapFlags: 2
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: 2000
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BlendOp: 0
- _BumpScale: 1
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ColorMode: 0
- _Cull: 0
- _Cutoff: 0.5
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0.67660415, b: 2.1185474, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
--- !u!114 &6302497770631587681
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 2

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 160e3c962bcae9d419c514548edb51cc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bullet : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HitRegisterer : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 888d8dd2b883ca644a2ab2262d2a155e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,28 @@
using UnityEngine;
namespace NeonTea.Quakeball.Combat {
[RequireComponent(typeof(ParticleSystem))]
public class Laser : MonoBehaviour {
public Vector3 From;
public Vector3 To;
private ParticleSystem.Particle[] particles = new ParticleSystem.Particle[2];
private ParticleSystem ParticleSystem;
private bool Initialized = false;
private void Start() {
ParticleSystem = GetComponent<ParticleSystem>();
ParticleSystem.Play();
}
private void Update() {
ParticleSystem.GetParticles(particles);
if (ParticleSystem.particleCount > 0 && !Initialized) {
particles[1].position = To;
Initialized = true;
}
particles[0].position = From;
ParticleSystem.SetParticles(particles);
}
}
}

View File

@ -3,6 +3,7 @@ using NeonTea.Quakeball.Networking.Packets;
using NeonTea.Quakeball.Util;
using NeonTea.Quakeball.Networking;
using NeonTea.Quakeball.Networking.Instances;
using NeonTea.Quakeball.Combat;
namespace NeonTea.Quakeball.Players {
/// <summary>The central glue class for players (both local and remote).</summary>
@ -32,6 +33,7 @@ namespace NeonTea.Quakeball.Players {
[Header("Visuals")]
public DesyncLerper[] Lerpables;
public float Lean;
public GameObject LaserPrefab;
public ParticleSystem Splatter;
@ -148,14 +150,17 @@ namespace NeonTea.Quakeball.Players {
}
public void Shoot() {
Vector3 GunPoint = BulletSourcePoint.position;
Vector3 ShotDelta = CameraRoot.forward * 1000f;
Vector3 From = CameraRoot.position;
Vector3 Direction = CameraRoot.forward;
RaycastHit Hit;
if (Physics.Raycast(From, Direction, out Hit)) {
Vector3 To = Hit.point;
Vector3 GunPoint = BulletSourcePoint.position;
Vector3 Delta = To - GunPoint;
if (Physics.Raycast(GunPoint, Delta, out Hit, Delta.magnitude, BulletHitLayer)) {
ShotDelta = To - GunPoint;
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);
@ -168,6 +173,11 @@ namespace NeonTea.Quakeball.Players {
Debug.DrawLine(GunPoint, To, Color.yellow, 5f);
}
}
GameObject LaserEffect = Instantiate(LaserPrefab);
Laser Laser = LaserEffect.GetComponent<Laser>();
Laser.From = GunPoint;
Laser.To = GunPoint + ShotDelta;
}
public void Hit() {