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

Enlarger Extension #751

Merged
merged 2 commits into from
Jul 10, 2024
Merged
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
28 changes: 17 additions & 11 deletions Assets/LazurController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void RpcFireProjectile(Vector3 output, Vector3 direction)
direction = direction,
maxDistance = MaxDistance,
initializationTime = Time.fixedTime,
size = stats.ProjectileSize
size = stats.ProjectileSize * stats.ProjectileScale
};
projectile.additionalProperties.Clear();

Expand All @@ -100,23 +100,26 @@ private void RpcFireProjectile(Vector3 output, Vector3 direction)

if (rayCasts.Length > 0)
{

Collider collider = rayCasts[0].collider;
var hit = rayCasts[0];
var collider = hit.collider;
lastCollider = collider;
HitboxController hitbox = collider.GetComponent<HitboxController>();

projectile.position = rayCasts[0].point;
OnRicochet?.Invoke(rayCasts[0], ref projectile);
if (hitbox != null)
OnHitboxCollision?.Invoke(hitbox, ref projectile);
OnColliderHit?.Invoke(rayCasts[0], ref projectile);
projectile.position += projectile.direction * hit.distance;

OnRicochet?.Invoke(hit, ref projectile);

if (collider.TryGetComponent<HitboxController>(out var hitbox))
if (!(hitbox.health.Player == player && projectile.distanceTraveled + hit.distance < GunController.InvulnerabilityDistance))
OnHitboxCollision?.Invoke(hitbox, ref projectile);

projectile.distanceTraveled += rayCasts[0].distance;
OnColliderHit?.Invoke(hit, ref projectile);

projectile.direction = Vector3.Reflect(projectile.direction, hit.normal);
projectile.distanceTraveled += hit.distance;
}
else
{
projectile.position = projectile.position + projectile.direction.normalized * (MaxDistance - projectile.distanceTraveled);
projectile.position += projectile.direction.normalized * (MaxDistance - projectile.distanceTraveled);
projectile.active = false;
}

Expand All @@ -136,12 +139,15 @@ private void RpcFireProjectile(Vector3 output, Vector3 direction)

protected override void OnInitialize(GunStats gunstats)
{
Vfx.SetFloat("Size", gunstats.ProjectileScale);
animator.OnInitialize(gunstats);
}

protected override void OnReload(GunStats stats)
{
animator.OnReload(stats);
}

public override void InitializeProjectile(GunStats stats, uint shotID)
{
currentShotID = shotID;
Expand Down
Binary file added Assets/Models/GunParts/enlarger.fbx
Binary file not shown.
108 changes: 108 additions & 0 deletions Assets/Models/GunParts/enlarger.fbx.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/Prefabs/Gamestate/StaticInfo.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ MonoBehaviour:
- {fileID: 11400000, guid: 75614ad08cd511f4fa856cd443040455, type: 2}
- {fileID: 11400000, guid: 6955edf1e31801642a2f47defb820d36, type: 2}
- {fileID: 11400000, guid: 87e98f42380f122a486cd5034ef1d278, type: 2}
- {fileID: 11400000, guid: 1e8a76909fc7b284dae3c37ebcf4d7ce, type: 2}
bodyAuction: {fileID: 11400000, guid: d9d421bb70476fb4889310ad4f1d310f, type: 2}
barrelAuction: {fileID: 11400000, guid: 6d47b14bed8c37e45af1c831948f3385, type: 2}
extensionAuction: {fileID: 11400000, guid: ad4a13bed7ceda243beb3334b23d48b0, type: 2}
Expand Down
6 changes: 5 additions & 1 deletion Assets/Prefabs/GunParts/CannonBarrel.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ MonoBehaviour:
addition: 0
multiplier: 0
exponential: 0.75
- name: ScreenShakeFactor
addition: 0.3
multiplier: 0
exponential: 1
outputs:
- {fileID: 1160446427348008624}
midpoint: {fileID: 6064389157985578044}
Expand Down Expand Up @@ -541,7 +545,7 @@ VFXRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8858774212536550383}
m_Enabled: 1
m_CastShadows: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
Expand Down
Loading