diff --git a/Assets/Prefabs/HealAbility.prefab b/Assets/Prefabs/HealAbility.prefab new file mode 100644 index 0000000..8dfcc0f --- /dev/null +++ b/Assets/Prefabs/HealAbility.prefab @@ -0,0 +1,51 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &801935050829970014 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7703980202025624524} + - component: {fileID: -6354618166949184850} + m_Layer: 0 + m_Name: HealAbility + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7703980202025624524 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 801935050829970014} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &-6354618166949184850 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 801935050829970014} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8ec3e66b2a18ee85c963a43c95b592d2, type: 3} + m_Name: + m_EditorClassIdentifier: + abilityName: Heal Ability + thisEntity: {fileID: 0} + healingAmount: 0 + suppliesMax: 0 + currentSupplies: 0 diff --git a/Assets/Prefabs/HealAbility.prefab.meta b/Assets/Prefabs/HealAbility.prefab.meta new file mode 100644 index 0000000..05b7610 --- /dev/null +++ b/Assets/Prefabs/HealAbility.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bb1fb3264b5949a168cc1eac7f7898d0 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/MochiMallet.prefab b/Assets/Prefabs/MochiMallet.prefab index 950ea84..cd4fd69 100644 --- a/Assets/Prefabs/MochiMallet.prefab +++ b/Assets/Prefabs/MochiMallet.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 249869374080430447} - component: {fileID: 7808092982301890633} - component: {fileID: 8261414852158774365} + - component: {fileID: 2098905524062327050} m_Layer: 9 m_Name: MochiMallet m_TagString: Untagged @@ -51,11 +52,10 @@ MonoBehaviour: thisEntity: {fileID: 0} damage: 35 pierce: 0 - entityLayer: - serializedVersion: 2 - m_Bits: 128 + rb: {fileID: 2098905524062327050} debugColliderHitbox: {fileID: 8695371850973158353} - colliderSize: {x: 2, y: 0.9} + colliderSize: {x: 0.9, y: 2} + enemiesInRange: [] --- !u!61 &8261414852158774365 BoxCollider2D: m_ObjectHideFlags: 0 @@ -100,8 +100,35 @@ BoxCollider2D: drawMode: 0 adaptiveTiling: 0 m_AutoTiling: 0 - m_Size: {x: 2, y: 0.9} + m_Size: {x: 0.9, y: 2} m_EdgeRadius: 0 +--- !u!50 &2098905524062327050 +Rigidbody2D: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8120255683806130734} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDamping: 0 + m_AngularDamping: 0.05 + m_GravityScale: 0 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 --- !u!1 &8695371850973158353 GameObject: m_ObjectHideFlags: 0 @@ -129,7 +156,7 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 1.5, y: 0, z: 0} - m_LocalScale: {x: 2, y: 0.9, z: 1} + m_LocalScale: {x: 0.9, y: 2, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 249869374080430447} diff --git a/Assets/Scenes/Prototype.unity b/Assets/Scenes/Prototype.unity index 0838051..e6536f9 100644 --- a/Assets/Scenes/Prototype.unity +++ b/Assets/Scenes/Prototype.unity @@ -4512,6 +4512,7 @@ RectTransform: - {fileID: 1741550582} - {fileID: 580779879} - {fileID: 1250801358} + - {fileID: 1686663538} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -4519,6 +4520,142 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} +--- !u!1 &1492494372 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1492494373} + - component: {fileID: 1492494375} + - component: {fileID: 1492494374} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1492494373 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1492494372} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1686663538} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 100, y: -25} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1492494374 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1492494372} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'Round: 1' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &1492494375 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1492494372} + m_CullTransparentMesh: 1 --- !u!1 &1516433669 GameObject: m_ObjectHideFlags: 0 @@ -4940,7 +5077,7 @@ GameObject: - component: {fileID: 1684414388} - component: {fileID: 1684414387} m_Layer: 5 - m_Name: OfficerButton + m_Name: AbilityButton m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -5012,7 +5149,7 @@ MonoBehaviour: m_Calls: - m_Target: {fileID: 1741550583} m_TargetAssemblyTypeName: ActionUIHandler, Assembly-CSharp - m_MethodName: ActivateOfficer + m_MethodName: ActivateClassAbility m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} @@ -5060,6 +5197,42 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1684414385} m_CullTransparentMesh: 1 +--- !u!1 &1686663537 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1686663538} + m_Layer: 5 + m_Name: GameUI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1686663538 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1686663537} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1492494373} + m_Father: {fileID: 1453849255} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1741550581 GameObject: m_ObjectHideFlags: 0 @@ -5129,7 +5302,8 @@ MonoBehaviour: attackButton: {fileID: 1904174745} reloadButton: {fileID: 1218150749} switchButton: {fileID: 437005975} - officerAbilityButton: {fileID: 1684414387} + classAbilityButton: {fileID: 1684414387} + classAbilityLabel: {fileID: 1027207201} weaponUIPanel: {fileID: 922303061} templateWeaponButton: {fileID: 1226097033} templateButtonHeight: 50 @@ -7101,6 +7275,10 @@ PrefabInstance: propertyPath: maxMovement value: 4 objectReference: {fileID: 0} + - target: {fileID: 7370141107480051474, guid: 0890a915b9432db98b28379f0c26c064, type: 3} + propertyPath: classAbility + value: + objectReference: {fileID: 2386380402288434018, guid: 399276321551d6338842b1dc4975d66f, type: 3} - target: {fileID: 7370141107480051474, guid: 0890a915b9432db98b28379f0c26c064, type: 3} propertyPath: currentWeapon value: diff --git a/Assets/Scripts/ActionUIHandler.cs b/Assets/Scripts/ActionUIHandler.cs index 23d67b8..4c81d15 100644 --- a/Assets/Scripts/ActionUIHandler.cs +++ b/Assets/Scripts/ActionUIHandler.cs @@ -42,7 +42,8 @@ public class ActionUIHandler : MonoBehaviour [SerializeField] private Button attackButton; [SerializeField] private Button reloadButton; [SerializeField] private Button switchButton; - [SerializeField] private Button officerAbilityButton; + [SerializeField] private Button classAbilityButton; + [SerializeField] private TextMeshProUGUI classAbilityLabel; [Header("Weapon Switcher")] [SerializeField] private RectTransform weaponUIPanel; @@ -89,10 +90,11 @@ public class ActionUIHandler : MonoBehaviour } } - officerAbilityButton.gameObject.SetActive(false); - if (selectedEntity.officerInstance) + classAbilityButton.gameObject.SetActive(false); + if (selectedEntity.abilityInstance) { - officerAbilityButton.gameObject.SetActive(true); + classAbilityButton.gameObject.SetActive(true); + classAbilityLabel.text = selectedEntity.abilityInstance.abilityName; } moveButton.gameObject.SetActive(true); switchButton.gameObject.SetActive(true); @@ -137,9 +139,9 @@ public class ActionUIHandler : MonoBehaviour HideUI(); } - public void ActivateOfficer() + public void ActivateClassAbility() { - selectedEntity.officerInstance.ActivateAbility(); + selectedEntity.abilityInstance.TryAbility(); } public void SkipTurn() { diff --git a/Assets/Scripts/ClassAbility.cs b/Assets/Scripts/ClassAbility.cs new file mode 100644 index 0000000..ca7d566 --- /dev/null +++ b/Assets/Scripts/ClassAbility.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +public class ClassAbility : MonoBehaviour +{ + public string abilityName; + public PlayerEntity thisEntity; + public virtual void TryAbility() + { + + } + + protected virtual void AbilityEffects() + { + + } +} diff --git a/Assets/Scripts/ClassAbility.cs.meta b/Assets/Scripts/ClassAbility.cs.meta new file mode 100644 index 0000000..3d50027 --- /dev/null +++ b/Assets/Scripts/ClassAbility.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: fc8d15189dbb82d06ab5b16e381ec83d \ No newline at end of file diff --git a/Assets/Scripts/ConstructAbility.cs b/Assets/Scripts/ConstructAbility.cs new file mode 100644 index 0000000..54b3415 --- /dev/null +++ b/Assets/Scripts/ConstructAbility.cs @@ -0,0 +1,15 @@ +using UnityEngine; + +public class ConstructAbility : ClassAbility +{ + [SerializeField] private Construction building; + public override void TryAbility() + { + AbilityEffects(); + } + + protected override void AbilityEffects() + { + Instantiate(building, transform.position, Quaternion.identity); + } +} diff --git a/Assets/Scripts/ConstructAbility.cs.meta b/Assets/Scripts/ConstructAbility.cs.meta new file mode 100644 index 0000000..db1062b --- /dev/null +++ b/Assets/Scripts/ConstructAbility.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 093bb0b035a9e08d6bc85b8b5b110027 \ No newline at end of file diff --git a/Assets/Scripts/Construction.cs b/Assets/Scripts/Construction.cs new file mode 100644 index 0000000..d1b10a3 --- /dev/null +++ b/Assets/Scripts/Construction.cs @@ -0,0 +1,5 @@ +using UnityEngine; + +public class Construction : Entity +{ +} diff --git a/Assets/Scripts/Construction.cs.meta b/Assets/Scripts/Construction.cs.meta new file mode 100644 index 0000000..6b9fbf3 --- /dev/null +++ b/Assets/Scripts/Construction.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6ae998986ae9a0893a2de369d0a943e6 \ No newline at end of file diff --git a/Assets/Scripts/HealAbility.cs b/Assets/Scripts/HealAbility.cs new file mode 100644 index 0000000..d589af3 --- /dev/null +++ b/Assets/Scripts/HealAbility.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +public class HealAbility : ClassAbility +{ + private PlayerEntity thisPlayer; + [SerializeField] private float healingAmount; + [SerializeField] private int suppliesMax; + public int currentSupplies; + + public override void TryAbility() + { + if (currentSupplies > 0) + { + currentSupplies--; + AbilityEffects(); + } + } + + protected override void AbilityEffects() + { + HealPlayer(); + } + + public void HealPlayer() + { + PlayerEntity closestPlayer = thisPlayer.GetAdjacentPlayers(); + if (closestPlayer) + { + closestPlayer.Heal(healingAmount); //insane code, i know. + } + } +} diff --git a/Assets/Scripts/HealAbility.cs.meta b/Assets/Scripts/HealAbility.cs.meta new file mode 100644 index 0000000..0d2fa4a --- /dev/null +++ b/Assets/Scripts/HealAbility.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8ec3e66b2a18ee85c963a43c95b592d2 \ No newline at end of file diff --git a/Assets/Scripts/MeleeWeapon.cs b/Assets/Scripts/MeleeWeapon.cs index 60efe29..20de2ee 100644 --- a/Assets/Scripts/MeleeWeapon.cs +++ b/Assets/Scripts/MeleeWeapon.cs @@ -5,9 +5,10 @@ using UnityEngine; public class MeleeWeapon : Weapon { - public LayerMask entityLayer; + [SerializeField] private Rigidbody2D rb; [SerializeField] private GameObject debugColliderHitbox; [SerializeField] private Vector2 colliderSize; + [SerializeField] private List enemiesInRange = new(); private void Update() { @@ -15,17 +16,14 @@ public class MeleeWeapon : Weapon { Vector2 mouseWorldPos = PlayerEntityMovement.instance.mouseWorldPos; //using this so i don't have to paste in and recalculate the variable on something i already have lol debugColliderHitbox.gameObject.SetActive(true); - transform.Lookat2D(mouseWorldPos); + Vector2 direction = mouseWorldPos - (Vector2)transform.position; + float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; //did you know i sucked at trig? because i don't understand this lol ; + rb.rotation = angle; if (Input.GetMouseButtonDown(0)) { - RaycastHit2D[] enemyList = Physics2D.BoxCastAll(transform.position, colliderSize, Vector3.Angle(transform.position, mouseWorldPos), - PlayerEntityMovement.instance.mouseWorldPos, 2, entityLayer); - foreach (RaycastHit2D enemy in enemyList) + foreach (Enemy enemy in enemiesInRange) { - if (!enemy.transform.CompareTag(tag) && enemy.transform.TryGetComponent(out Entity isEntity)) - { - isEntity.TakeDamage(damage, thisEntity); - } + enemy.TakeDamage(damage, thisEntity); } isAiming = false; thisEntity.actions--; @@ -47,4 +45,20 @@ public class MeleeWeapon : Weapon { isAiming = true; } + + private void OnTriggerEnter2D(Collider2D other) + { + if (!other.CompareTag(tag) && other.TryGetComponent(out Enemy isEnemy)) + { + enemiesInRange.Add(isEnemy); + } + } + + private void OnTriggerExit2D(Collider2D other) + { + if (!other.CompareTag(tag) && other.TryGetComponent(out Enemy isEnemy) && enemiesInRange.Contains(isEnemy)) + { + enemiesInRange.Remove(isEnemy); + } + } } diff --git a/Assets/Scripts/OfficerAbilities.cs b/Assets/Scripts/OfficerAbilities.cs index 700fcc9..4178f72 100644 --- a/Assets/Scripts/OfficerAbilities.cs +++ b/Assets/Scripts/OfficerAbilities.cs @@ -1,9 +1,8 @@ using System; using UnityEngine; -public class OfficerAbilities : MonoBehaviour +public class OfficerAbilities : ClassAbility { - public PlayerEntity thisEntity; [Header("Kills")] [SerializeField] private int killQuota; private int currentKills; @@ -36,7 +35,7 @@ public class OfficerAbilities : MonoBehaviour } } - public void ActivateAbility() + public override void TryAbility() { if (currentKills >= killQuota) { @@ -46,11 +45,6 @@ public class OfficerAbilities : MonoBehaviour } } - protected virtual void AbilityEffects() - { - - } - protected virtual void DeactivateAbility() { diff --git a/Assets/Scripts/PlayerEntity.cs b/Assets/Scripts/PlayerEntity.cs index ab7c09a..0c84c0d 100644 --- a/Assets/Scripts/PlayerEntity.cs +++ b/Assets/Scripts/PlayerEntity.cs @@ -12,9 +12,9 @@ public class PlayerEntity : Entity [SerializeField] private Weapon[] weapons; [HideInInspector] public List weaponInstances = new(); public Weapon currentWeapon; - [Header("OfficerAbilities")] - [SerializeField] private OfficerAbilities officerAbility; - [HideInInspector] public OfficerAbilities officerInstance; + [Header("Class Abilities")] + [SerializeField] private ClassAbility classAbility; + [HideInInspector] public ClassAbility abilityInstance; [Header("UI")] [SerializeField] private Transform hpBar; public GameObject debugDoneObject; @@ -30,8 +30,8 @@ public class PlayerEntity : Entity if (selectedClass == PlayerClass.Officer) { - officerInstance = Instantiate(officerAbility, transform); - officerInstance.thisEntity = this; + abilityInstance = Instantiate(classAbility, transform); + abilityInstance.thisEntity = this; } currentWeapon = weaponInstances[0]; } @@ -84,4 +84,16 @@ public class PlayerEntity : Entity ActionUIHandler.instance.ShowUI(this); } } + + public PlayerEntity GetAdjacentPlayers() + { + foreach (TileObject neighbor in currentTile.neighbors) + { + if (neighbor.hasUnit && neighbor.hasUnit is PlayerEntity) + { + return neighbor.hasUnit as PlayerEntity; //i'll uh, make it return a list later this is just a quick way. + } + } + return null; + } }