From 2a6749a46179f1707761f720b7e570f3c3365054 Mon Sep 17 00:00:00 2001 From: Tore Bergebakken Date: Mon, 23 Oct 2023 22:20:24 +0200 Subject: [PATCH] Add hacking extension --- ...tension.prefab => HackingExtension.prefab} | 17 +++++++- ...efab.meta => HackingExtension.prefab.meta} | 0 Assets/Prefabs/Input/Player.prefab | 37 +++++++++++++----- Assets/Scenes/Menu.unity | 8 ++++ ...Extension.asset => HackingExtension.asset} | 8 ++-- ...asset.meta => HackingExtension.asset.meta} | 0 Assets/Scripts/Auction/BiddingPlayer.cs | 2 - .../AugmentImplementations/Solar/SolarBody.cs | 3 +- .../BulletModifiers/HackingModifier.cs | 39 +++++++++++++++++++ .../BulletModifiers/HackingModifier.cs.meta | 11 ++++++ 10 files changed, 106 insertions(+), 19 deletions(-) rename Assets/Prefabs/GunParts/{InkExtension.prefab => HackingExtension.prefab} (92%) rename Assets/Prefabs/GunParts/{InkExtension.prefab.meta => HackingExtension.prefab.meta} (100%) rename Assets/ScriptableObjects/Items/{InkExtension.asset => HackingExtension.asset} (76%) rename Assets/ScriptableObjects/Items/{InkExtension.asset.meta => HackingExtension.asset.meta} (100%) create mode 100644 Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs create mode 100644 Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs.meta diff --git a/Assets/Prefabs/GunParts/InkExtension.prefab b/Assets/Prefabs/GunParts/HackingExtension.prefab similarity index 92% rename from Assets/Prefabs/GunParts/InkExtension.prefab rename to Assets/Prefabs/GunParts/HackingExtension.prefab index 32590fcad..4fc7ba736 100644 --- a/Assets/Prefabs/GunParts/InkExtension.prefab +++ b/Assets/Prefabs/GunParts/HackingExtension.prefab @@ -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 @@ -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 diff --git a/Assets/Prefabs/GunParts/InkExtension.prefab.meta b/Assets/Prefabs/GunParts/HackingExtension.prefab.meta similarity index 100% rename from Assets/Prefabs/GunParts/InkExtension.prefab.meta rename to Assets/Prefabs/GunParts/HackingExtension.prefab.meta diff --git a/Assets/Prefabs/Input/Player.prefab b/Assets/Prefabs/Input/Player.prefab index 717ac7f86..1292ffd80 100644 --- a/Assets/Prefabs/Input/Player.prefab +++ b/Assets/Prefabs/Input/Player.prefab @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/Assets/Scenes/Menu.unity b/Assets/Scenes/Menu.unity index ccd61d9b8..a224f01a8 100644 --- a/Assets/Scenes/Menu.unity +++ b/Assets/Scenes/Menu.unity @@ -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 diff --git a/Assets/ScriptableObjects/Items/InkExtension.asset b/Assets/ScriptableObjects/Items/HackingExtension.asset similarity index 76% rename from Assets/ScriptableObjects/Items/InkExtension.asset rename to Assets/ScriptableObjects/Items/HackingExtension.asset index fdbdd6818..cf3b73d4f 100644 --- a/Assets/ScriptableObjects/Items/InkExtension.asset +++ b/Assets/ScriptableObjects/Items/HackingExtension.asset @@ -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} diff --git a/Assets/ScriptableObjects/Items/InkExtension.asset.meta b/Assets/ScriptableObjects/Items/HackingExtension.asset.meta similarity index 100% rename from Assets/ScriptableObjects/Items/InkExtension.asset.meta rename to Assets/ScriptableObjects/Items/HackingExtension.asset.meta diff --git a/Assets/Scripts/Auction/BiddingPlayer.cs b/Assets/Scripts/Auction/BiddingPlayer.cs index ecfa121bb..64cbdfdeb 100644 --- a/Assets/Scripts/Auction/BiddingPlayer.cs +++ b/Assets/Scripts/Auction/BiddingPlayer.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.InputSystem; diff --git a/Assets/Scripts/Augment/AugmentImplementations/Solar/SolarBody.cs b/Assets/Scripts/Augment/AugmentImplementations/Solar/SolarBody.cs index ce4e1c289..6e2e68b3f 100644 --- a/Assets/Scripts/Augment/AugmentImplementations/Solar/SolarBody.cs +++ b/Assets/Scripts/Augment/AugmentImplementations/Solar/SolarBody.cs @@ -1,5 +1,4 @@ using System.Collections; -using System.Linq; using UnityEngine; public class SolarBody : GunBody @@ -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); } diff --git a/Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs b/Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs new file mode 100644 index 000000000..0547dc5d6 --- /dev/null +++ b/Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs @@ -0,0 +1,39 @@ +using UnityEngine; + +/// +/// Modifier that hacks the affected player and fills their screen with spam. +/// +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(out var hitboxController)) + return; + Debug.Log("Popup?"); + if (!hitboxController.health.TryGetComponent(out var spammer)) + return; + Debug.Log("Popup?"); + spammer.Spam(Mathf.FloorToInt(state.damage / damageToSpamAmount)); + } +} diff --git a/Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs.meta b/Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs.meta new file mode 100644 index 000000000..23c7e37a7 --- /dev/null +++ b/Assets/Scripts/Augment/BulletModifiers/HackingModifier.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 476bddadba13e994f820fd40b0cdd267 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: