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 2a6749a
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 19 deletions.
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
8 changes: 8 additions & 0 deletions Assets/Scenes/Menu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,14 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3717336014748129540, guid: 0e2ad36662a02c3488301a5286b27635, type: 3}
propertyPath: bodies.Array.data[2]
value:
objectReference: {fileID: 11400000, guid: 5f5eb8c73a83cc7dc923d1db915050e0, type: 2}
- target: {fileID: 3717336014748129540, guid: 0e2ad36662a02c3488301a5286b27635, type: 3}
propertyPath: extensions.Array.data[2]
value:
objectReference: {fileID: 11400000, guid: 5f5eb8c73a83cc7dc923d1db915050e0, type: 2}
- target: {fileID: 8579357797008554893, guid: 0e2ad36662a02c3488301a5286b27635, type: 3}
propertyPath: m_Name
value: StaticInfo
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
39 changes: 39 additions & 0 deletions Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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)
{
Debug.Log("Hitbox?");
if (!collider.TryGetComponent<HitboxController>(out var hitboxController))
return;
Debug.Log("Popup?");
if (!hitboxController.health.TryGetComponent<PopupSpammer>(out var spammer))
return;
Debug.Log("Popup?");
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 2a6749a

Please sign in to comment.