Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip try fixing lazur glitch #922

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Assets/Animation/Augments/Lazur/Cannon_CannonAction.anim
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,7 @@ AnimationClip:
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1.3333334
m_StopTime: 1.3166667
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
Expand Down Expand Up @@ -11057,7 +11057,7 @@ AnimationClip:
floatParameter: 0
intParameter: 0
messageOptions: 0
- time: 1.3333334
- time: 1.3
functionName: EndFiring
data:
objectReferenceParameter: {fileID: 0}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Augment/AugmentImplementations/Revolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected override void Reload(GunStats stats)

isReloadInProgress = true;
animator.SetTrigger("Reload");
gunController.onReload?.Invoke(stats);
// gunController.onReload?.Invoke(stats);
}

public void TriggerSteam()
Expand Down
9 changes: 9 additions & 0 deletions Assets/Scripts/Augment/GunController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ private void FixedUpdate()
}
if (ShouldFire())
{
isFiring = true;
FireGun();
}
// TODO REMOVE
else if (isFiring && triggerPressed) Debug.Log("GCGC OH NO FIRED WHILE FIRING!!!!");
}

/// <summary>
Expand All @@ -172,8 +175,11 @@ private void FixedUpdate()
/// <param name="fractionNormalized">Percentage of ammunition to be reloaded.</param>
public void Reload(float fractionNormalized)
{
Debug.Log("GCGC RELOAD CALLED");
int amount = Mathf.Max(1, Mathf.FloorToInt(stats.MagazineSize * fractionNormalized));
stats.Ammo = Mathf.Min(stats.Ammo + amount, stats.MagazineSize);
if (Player.identity.Body.id == "Stock")
isFiring = false;
onReload?.Invoke(stats);
}

Expand Down Expand Up @@ -215,6 +221,7 @@ private void RpcFire(Quaternion rotation)
}
catch (Exception e)
{
isFiring = false;
Debug.LogError("Failed to fire gun!");
Debug.LogError(e);
}
Expand Down Expand Up @@ -254,6 +261,7 @@ private void FireGun()

try
{
Debug.Log("GCGC FIRING!");
onFireStart?.Invoke(stats);
AimAtTarget();
// Tell server to fire
Expand Down Expand Up @@ -324,6 +332,7 @@ private void FireEnd()
{
stats.Ammo = Mathf.Clamp(stats.Ammo - 1, 0, stats.MagazineSize);
isFiring = false;
Debug.Log("GCGC FIRE END");
onFireEnd?.Invoke(stats);
}
}