Skip to content

Commit

Permalink
Add hacking extension
Browse files Browse the repository at this point in the history
  • Loading branch information
toberge committed Oct 24, 2023
1 parent c2fa4e4 commit 692bec7
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Assets/Prefabs/Gamestate/StaticInfo.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ MonoBehaviour:
extensions:
- {fileID: 11400000, guid: a0f539379f7384445bc1535317457198, type: 2}
- {fileID: 11400000, guid: bb334224a9209984b98cc009f333ca9d, type: 2}
- {fileID: 11400000, guid: bb334224a9209984b98cc009f333ca9d, type: 2}
- {fileID: 11400000, guid: 5f5eb8c73a83cc7dc923d1db915050e0, 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
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ GameObject:
m_Component:
- component: {fileID: 4827614959384518682}
- component: {fileID: 4827614959384518683}
- component: {fileID: 643204947169274698}
m_Layer: 0
m_Name: InkExtension
m_Name: HackingExtension
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -113,6 +114,20 @@ MonoBehaviour:
outputs:
- {fileID: 4827614958556121207}
model: {fileID: 2248296421995411996}
--- !u!114 &643204947169274698
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4827614959384518680}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 476bddadba13e994f820fd40b0cdd267, type: 3}
m_Name:
m_EditorClassIdentifier:
damageToSpamAmount: 4
priority: 4
--- !u!1 &5507040867358044611
GameObject:
m_ObjectHideFlags: 0
Expand Down
37 changes: 27 additions & 10 deletions Assets/Prefabs/Input/Player.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ GameObject:
- component: {fileID: 6717855691676836013}
- component: {fileID: 3252978923923797766}
- component: {fileID: 7607358150439154286}
- component: {fileID: 8083311792859455116}
m_Layer: 0
m_Name: Player
m_TagString: Untagged
Expand Down Expand Up @@ -337,6 +338,24 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &8083311792859455116
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 71015680234268067}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 054f8241b622aff439e7b31758f43d23, type: 3}
m_Name:
m_EditorClassIdentifier:
popups:
- {fileID: 2749458525383876187, guid: 6e375834f9190b44b85120879f9bbee1, type: 3}
spamTarget: {fileID: 3484089900029681523}
hud: {fileID: 3570743071879246586}
minSpamDelay: 0.1
maxSpamDelay: 0.3
--- !u!1 &345906872987025452
GameObject:
m_ObjectHideFlags: 0
Expand All @@ -346,9 +365,9 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 3484089900029681523}
- component: {fileID: 4146737323431763604}
- component: {fileID: 5813241806607806329}
m_Layer: 5
m_Name: Spam
m_Name: SpamTarget
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand All @@ -374,20 +393,18 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4146737323431763604
MonoBehaviour:
--- !u!210 &5813241806607806329
SortingGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 345906872987025452}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 054f8241b622aff439e7b31758f43d23, type: 3}
m_Name:
m_EditorClassIdentifier:
popups:
- {fileID: 2749458525383876187, guid: 6e375834f9190b44b85120879f9bbee1, type: 3}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_SortAtRoot: 0
--- !u!1 &650044701630506088
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d766409d2bfa0674da668e696cd73b7b, type: 3}
m_Name: InkExtension
m_Name: HackingExtension
m_EditorClassIdentifier:
displayName: Ink
secretName: splatting
displayDescription: Sprays ink on your opponents' cameras, obscuring their vision
displayName: Hacking
secretName: gated
displayDescription: Floods your opponent's screen with spam
augmentType: 2
augment: {fileID: 4827614959384518680, guid: 1a0c1f3c438462b23a58128d5f3b7b5d, type: 3}
2 changes: 0 additions & 2 deletions Assets/Scripts/Auction/BiddingPlayer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections;
using System.Linq;
using UnityEngine;

public class SolarBody : GunBody
Expand Down Expand Up @@ -72,7 +71,7 @@ private void SetEmissionStrength(float strength)
void FixedUpdate()
{
float orientationOverlap = Vector3.Dot(rayCastOrigin.transform.up, globalLightDirection.eulerAngles);
if ((!Physics.Raycast(rayCastOrigin.position, globalLightDirection.eulerAngles, maxObscuringCheckDistance, obscuringLayers.value)) && orientationOverlap > 0)
if (!Physics.Raycast(rayCastOrigin.position, globalLightDirection.eulerAngles, maxObscuringCheckDistance, obscuringLayers.value) && orientationOverlap > 0)
{
Reload(gunController.stats);
}
Expand Down
36 changes: 36 additions & 0 deletions Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using UnityEngine;

/// <summary>
/// Modifier that hacks the affected player and fills their screen with spam.
/// </summary>
public class HackingModifier : MonoBehaviour, ProjectileModifier
{
[SerializeField] private float damageToSpamAmount = 4;

[SerializeField]
private Priority priority = Priority.ARBITRARY;

public Priority GetPriority()
{
return priority;
}

public void Attach(ProjectileController projectile)
{
projectile.OnColliderHit += Hack;
}

public void Detach(ProjectileController projectile)
{
projectile.OnColliderHit -= Hack;
}

private void Hack(Collider collider, ref ProjectileState state)
{
if (!collider.TryGetComponent<HitboxController>(out var hitboxController))
return;
if (!hitboxController.health.TryGetComponent<PopupSpammer>(out var spammer))
return;
spammer.Spam(Mathf.FloorToInt(state.damage / damageToSpamAmount));
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs.meta

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

0 comments on commit 692bec7

Please sign in to comment.