Skip to content

Commit

Permalink
Merge pull request #19 from Toly65/inDev
Browse files Browse the repository at this point in the history
In dev
  • Loading branch information
Toly65 committed Oct 25, 2022
2 parents a4d533c + 0fc6355 commit c2cf619
Show file tree
Hide file tree
Showing 15 changed files with 104,151 additions and 12,094 deletions.
90,965 changes: 90,965 additions & 0 deletions - PREFABS -/Combat System.prefab

Large diffs are not rendered by default.

22,409 changes: 10,849 additions & 11,560 deletions - PREFABS -/FreeForAllMatchMaker.prefab

Large diffs are not rendered by default.

299 changes: 187 additions & 112 deletions - PREFABS -/Granade launcher example.prefab

Large diffs are not rendered by default.

1,137 changes: 1,137 additions & 0 deletions - PREFABS -/KillCounterScreen.prefab

Large diffs are not rendered by default.

144 changes: 133 additions & 11 deletions - PREFABS -/PoliceSMG.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,8 @@ GameObject:
- component: {fileID: 7714740809804545254}
- component: {fileID: 6850778608209698773}
- component: {fileID: 6563709354266371314}
- component: {fileID: 7977077679134464181}
- component: {fileID: 161473743082741654}
m_Layer: 13
m_Name: Scripts
m_TagString: Untagged
Expand Down Expand Up @@ -762,7 +764,6 @@ MonoBehaviour:
firePosition: {fileID: 6583597998584336898}
fireVelocity: 100
AmmoCount: 15
reloadTime: 3
BulletSpread: 1
automaticReload: 1
clips:
Expand All @@ -779,10 +780,13 @@ MonoBehaviour:
type: 3}
sparkable:
serializedVersion: 2
m_Bits: 1
m_Bits: 2049
players:
serializedVersion: 2
m_Bits: 1
barrels: []
fireAllBarrelsAtOnce: 0
ammoCountDependsOnBarrels: 0
bullet: {fileID: 0}
targetRigidbody: {fileID: 0}
forceFromBarrel: 0
Expand All @@ -794,11 +798,15 @@ MonoBehaviour:
audio: {fileID: 0}
GunAnimator: {fileID: 3399561053264204547}
CycleAnimation: {fileID: 7400000, guid: 7ce7df2a7595cd04bae55d24b50ea5cf, type: 2}
BaseCycleOffAnimation: 1
CycleTime: 0.2
ReloadAnimation: {fileID: 0}
reloadTime: 3
BaseReloadTimeOffAnimation: 0
ShellParticle: {fileID: 2727196873397172340}
gunShotParticle: {fileID: 0}
BaseCycleOffAnimation: 1
CycleTime: 0.2
magazineAnimator: {fileID: 0}
MagazineAnimatorVariable: AmmoPercentage
--- !u!114 &6563709354266371314
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -825,6 +833,120 @@ MonoBehaviour:
serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgEAAAAAAAAAAi8CAAAAAUkAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBJAG4AdAAzADIALAAgAG0AcwBjAG8AcgBsAGkAYgBdAF0ALAAgAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAAIAAAAGAgAAAAAAAAAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBCgAAAFMAeQBtAGIAbwBsAE4AYQBtAGUAAR8AAABfAF8AXwBVAGQAbwBuAFMAaABhAHIAcABCAGUAaABhAHYAaQBvAHUAcgBWAGUAcgBzAGkAbwBuAF8AXwBfACcBBAAAAHQAeQBwAGUAARYAAABTAHkAcwB0AGUAbQAuAEkAbgB0ADMAMgAsACAAbQBzAGMAbwByAGwAaQBiABcBBQAAAFYAYQBsAHUAZQACAAAABwUHBQcF
publicVariablesUnityEngineObjects: []
publicVariablesSerializationDataFormat: 0
--- !u!82 &7977077679134464181
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2087164853719282441}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 1
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &161473743082741654
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2087164853719282441}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -617992517, guid: 661092b4961be7145bfbe56e1e62337b, type: 3}
m_Name:
m_EditorClassIdentifier:
Gain: 10
Far: 40
Near: 2
VolumetricRadius: 0
EnableSpatialization: 1
UseAudioSourceVolumeCurve: 0
--- !u!1 &2166281585607391887
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1743,7 +1865,7 @@ MonoBehaviour:
ExactGrip: {fileID: 0}
allowManipulationWhenEquipped: 0
orientation: 2
AutoHold: 0
AutoHold: 1
InteractionText:
UseText: Use
useEventBroadcastType: 0
Expand Down Expand Up @@ -2169,15 +2291,15 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2174359a25780464382213afd9e59913, type: 3}
--- !u!4 &4759333826653333879 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7463646184435167883, guid: 2174359a25780464382213afd9e59913,
type: 3}
m_PrefabInstance: {fileID: 2709124422800317436}
m_PrefabAsset: {fileID: 0}
--- !u!198 &2727196873397172340 stripped
ParticleSystem:
m_CorrespondingSourceObject: {fileID: 18099423800058760, guid: 2174359a25780464382213afd9e59913,
type: 3}
m_PrefabInstance: {fileID: 2709124422800317436}
m_PrefabAsset: {fileID: 0}
--- !u!4 &4759333826653333879 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7463646184435167883, guid: 2174359a25780464382213afd9e59913,
type: 3}
m_PrefabInstance: {fileID: 2709124422800317436}
m_PrefabAsset: {fileID: 0}
270 changes: 155 additions & 115 deletions - PREFABS -/RocketJumper.prefab

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Scripts/BuffManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;

[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
[AddComponentMenu("")]
public class BuffManager : UdonSharpBehaviour
{
Expand Down
75 changes: 59 additions & 16 deletions Scripts/Gun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Gun : UdonSharpBehaviour
public Transform firePosition;
public float fireVelocity = 5f;
[UdonSynced] public int AmmoCount = 5;
public float reloadTime = 15f;

public float BulletSpread = 10f;
public bool automaticReload = true;
[Tooltip("gunshot, magpull, maginsert, gun cock")]
Expand All @@ -32,6 +32,11 @@ public class Gun : UdonSharpBehaviour
public GameObject terrainRaycastSpark;
public LayerMask sparkable;
public LayerMask players;
[Header("multi-barrel settings, if the script detects multiple barrels it will use them")]
public Transform[] barrels;
public bool fireAllBarrelsAtOnce;
public bool ammoCountDependsOnBarrels;
private int currentBarrel = 0;
[Header("Rigibody projectile, requires raycast to be off")]
public GameObject bullet;
[Header("physics stuff, only add if you're putting this on a vehicle")]
Expand All @@ -52,19 +57,25 @@ public class Gun : UdonSharpBehaviour
private bool isreloadingaudio = true;
private VRCPlayerApi localPlayer;
private bool DesktopUser;
// [UdonSynced]private VRCPlayerApi owner;

// [UdonSynced]private VRCPlayerApi owner;
[Header("animation settings")]
public Animator GunAnimator;
public AnimationClip CycleAnimation;
public bool BaseCycleOffAnimation;
public float CycleTime;
public AnimationClip ReloadAnimation;
public float reloadTime = 15f;
public bool BaseReloadTimeOffAnimation;
public ParticleSystem ShellParticle;
[Header("particles are visual only")]
public ParticleSystem gunShotParticle;
public Animator magazineAnimator;
public string MagazineAnimatorVariable = "AmmoPercentage";
[Header("particles are visual only")]


private float firedTime;
public bool BaseCycleOffAnimation;
public float CycleTime;

private int MagazineAnimatorVariableHash;

private string AnimName;
private bool Firing = false;
private bool Scoped;
Expand Down Expand Up @@ -123,7 +134,10 @@ private void Update()
private void Start()
{
localPlayer = Networking.LocalPlayer;

if (magazineAnimator)
{
MagazineAnimatorVariableHash = Animator.StringToHash(MagazineAnimatorVariable);
}
//audio = (AudioSource)gameObject.GetComponent(typeof(AudioSource));
if (!localPlayer.IsUserInVR())
{
Expand All @@ -134,17 +148,23 @@ private void Start()
DesktopUser = false;
}

MaxAmmo = AmmoCount;
Debug.Log("Ammo Left: " + AmmoCount);


Debug.Log("Ammo Left: " + AmmoCount);

if(ammoCountDependsOnBarrels)
{
AmmoCount = barrels.Length;
}
MaxAmmo = AmmoCount;

if (BaseCycleOffAnimation&&CycleAnimation)
{
CycleTime = CycleAnimation.length;
}

if (BaseReloadTimeOffAnimation && ReloadAnimation)
{
reloadTime = ReloadAnimation.length;
}
}
public void Pickup()
{
Expand Down Expand Up @@ -176,7 +196,7 @@ private void FixedUpdate()
}


if (AmmoCount <= 0 && AmmoCheck && localPlayer == Networking.GetOwner(gameObject)&&automaticReload)
if (AmmoCount <= 0 && AmmoCheck && automaticReload)
{
Reload();
AmmoCheck = false;
Expand Down Expand Up @@ -327,7 +347,20 @@ public void BulletRaycast()
}
public void Fire()
{

if(barrels.Length!=0)
{
firePosition.position = barrels[currentBarrel].position;
Debug.Log("fire position changed to new barrel " + currentBarrel);
//select the next available current barrel
if (currentBarrel < barrels.Length - 1)
{
currentBarrel++;
}
else
{
currentBarrel = 0;
}
}

if (Time.time - firedTime < CycleTime && !Automatic)
{
Expand All @@ -339,6 +372,10 @@ public void Fire()
{
AmmoCount++;
}
if(magazineAnimator)
{
magazineAnimator.SetFloat(MagazineAnimatorVariableHash, AmmoCount / MaxAmmo);
}
if (AmmoCount > 0)
{

Expand Down Expand Up @@ -395,9 +432,10 @@ public void Fire()
firePosition.position = localPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.Head).position;
firePosition.rotation = localPlayer.GetTrackingData(VRCPlayerApi.TrackingDataType.Head).rotation;
}

Quaternion temp = firePosition.localRotation;
firePosition.Rotate(Random.Range(-BulletSpread, BulletSpread), Random.Range(-BulletSpread, BulletSpread), Random.Range(-BulletSpread, BulletSpread));
BulletRaycast();

firePosition.localRotation = temp;

if (GunAnimator && CycleAnimation)
{
Expand Down Expand Up @@ -525,5 +563,10 @@ public void Reload()
currentTime = Time.time;
wantedTime = currentTime + reloadTime;
startTimer = true;
//send changes to network
if(localPlayer.IsOwner(gameObject))
{
RequestSerialization();
}
}
}
9 changes: 8 additions & 1 deletion Scripts/PlayerHealthManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ public void ModifyHealth(float Damage)
else
{
CurrentHealth += Damage;
//cap the health at max health
Mathf.Clamp(CurrentHealth, 0.0f, RespawnHealth);
if (CurrentHealth > RespawnHealth)
{
CurrentHealth = RespawnHealth;
}
}
}else
{
Expand All @@ -91,7 +97,7 @@ public void ModifyHealth(float Damage)



private void FixedUpdate()
private void Update()
{
//health stuff
if (CurrentHealth <= 0f && !Dead)
Expand Down Expand Up @@ -122,6 +128,7 @@ public void Die()
{
//this line is an issue
//Killtracker.addkill(hitBoxAssigner.hitboxArray[localPLayer.playerId].LastPlayerWhoDamagedID);
Debug.Log("killed by playerid " + hitBoxAssigner.getHitBoxByPlayerID(localPlayer.playerId).LastPlayerWhoDamagedID);
Killtracker.addkill(hitBoxAssigner.getHitBoxByPlayerID(localPlayer.playerId).LastPlayerWhoDamagedID);
}
}
Expand Down
Loading

0 comments on commit c2cf619

Please sign in to comment.