entity changes, classes
This commit is contained in:
parent
bda2b88796
commit
8bd4aedcf9
20 changed files with 1917 additions and 27 deletions
|
|
@ -176,6 +176,9 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
rb: {fileID: -1738584089269128998}
|
||||
environmentLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 8
|
||||
damage: 100
|
||||
speed: 10
|
||||
pierceAmount: 4
|
||||
|
|
|
|||
|
|
@ -253,6 +253,93 @@ MonoBehaviour:
|
|||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &6197559026114623176
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4232284735484366426}
|
||||
- component: {fileID: 5847741010615947309}
|
||||
m_Layer: 0
|
||||
m_Name: DoneMovingBox
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
--- !u!4 &4232284735484366426
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6197559026114623176}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.4, y: -0.4, z: 0}
|
||||
m_LocalScale: {x: 0.2, y: 0.2, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 576146896620919861}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &5847741010615947309
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6197559026114623176}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 2
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
|
||||
m_Color: {r: 1, g: 0, b: 0, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &8094053231633710175
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -287,6 +374,7 @@ Transform:
|
|||
m_Children:
|
||||
- {fileID: 3735594418940052040}
|
||||
- {fileID: 6763493467664428652}
|
||||
- {fileID: 4232284735484366426}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &6953866836340070426
|
||||
|
|
@ -384,14 +472,15 @@ MonoBehaviour:
|
|||
spriteRenderers:
|
||||
- {fileID: 400185309718877830}
|
||||
damageColorChangeSpeed: 4
|
||||
hasMoved: 0
|
||||
hasAttacked: 0
|
||||
actions: 2
|
||||
maxActions: 2
|
||||
weapons:
|
||||
- {fileID: 5015834028617221606, guid: a822f12b0129533629ae07e7075e0b33, type: 3}
|
||||
- {fileID: 7808092982301890633, guid: b8051aa5988c369b1a760ce62ebcbedd, type: 3}
|
||||
weaponInstances: []
|
||||
currentWeapon: {fileID: 0}
|
||||
hpBar: {fileID: 3104995061699689292}
|
||||
debugDoneObject: {fileID: 6197559026114623176}
|
||||
--- !u!1 &9154813544046831137
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
254
Assets/Prefabs/TargettingMarker.prefab
Normal file
254
Assets/Prefabs/TargettingMarker.prefab
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &871716312970530213
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4575421858506827990}
|
||||
m_Layer: 0
|
||||
m_Name: Sprite
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4575421858506827990
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 871716312970530213}
|
||||
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:
|
||||
- {fileID: 9220347974016072010}
|
||||
- {fileID: 9001124522811824881}
|
||||
m_Father: {fileID: 55738416662657485}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &6008524365457076716
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 9220347974016072010}
|
||||
- component: {fileID: 5122152190451979544}
|
||||
m_Layer: 0
|
||||
m_Name: Square
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &9220347974016072010
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6008524365457076716}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0.38268343, w: 0.92387956}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.05, y: 0.4, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4575421858506827990}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 45}
|
||||
--- !u!212 &5122152190451979544
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6008524365457076716}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &7320665329736432398
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 9001124522811824881}
|
||||
- component: {fileID: 7291118990411802871}
|
||||
m_Layer: 0
|
||||
m_Name: Square (1)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &9001124522811824881
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7320665329736432398}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: -0.38268343, w: 0.92387956}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.05, y: 0.4, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4575421858506827990}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -45}
|
||||
--- !u!212 &7291118990411802871
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7320665329736432398}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &8931569353794959949
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 55738416662657485}
|
||||
- component: {fileID: 2324753733267484559}
|
||||
m_Layer: 0
|
||||
m_Name: TargettingMarker
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &55738416662657485
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8931569353794959949}
|
||||
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:
|
||||
- {fileID: 4575421858506827990}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2324753733267484559
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8931569353794959949}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 548df8df9b2f95534b76729bc92e7bc9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
7
Assets/Prefabs/TargettingMarker.prefab.meta
Normal file
7
Assets/Prefabs/TargettingMarker.prefab.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0a40ab2d4353ab3f3b06472fea00eec3
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -22,6 +22,7 @@ public class ActionUIHandler : MonoBehaviour
|
|||
#endregion
|
||||
private PlayerEntity selectedEntity;
|
||||
private RangedWeapon possibleRanged;
|
||||
public GameObject cursorObject;
|
||||
[Header("Main UI")]
|
||||
[SerializeField] private GameObject actionUI;
|
||||
[SerializeField] private TextMeshProUGUI actionText;
|
||||
|
|
@ -115,13 +116,14 @@ public class ActionUIHandler : MonoBehaviour
|
|||
public void ReloadGun()
|
||||
{
|
||||
possibleRanged.Reload();
|
||||
selectedEntity.actions -= 2;
|
||||
UpdateActions(possibleRanged.reloadActionUsage);
|
||||
HideUI();
|
||||
}
|
||||
|
||||
public void Attack()
|
||||
{
|
||||
selectedEntity.Attack();
|
||||
cursorObject.SetActive(true);
|
||||
HideUI();
|
||||
}
|
||||
|
||||
|
|
@ -167,12 +169,21 @@ public class ActionUIHandler : MonoBehaviour
|
|||
|
||||
public void SelectWeapon(Weapon weaponSelected)
|
||||
{
|
||||
selectedEntity.actions--;
|
||||
UpdateActions(1);
|
||||
selectedEntity.SwitchWeapon(weaponSelected);
|
||||
HideWeaponList();
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
public void UpdateActions(int amount)
|
||||
{
|
||||
selectedEntity.actions -= amount;
|
||||
if (selectedEntity.actions == 0)
|
||||
{
|
||||
selectedEntity.debugDoneObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void HideWeaponList()
|
||||
{
|
||||
weaponUIPanel.gameObject.SetActive(false);
|
||||
|
|
|
|||
11
Assets/Scripts/AttachToCursor.cs
Normal file
11
Assets/Scripts/AttachToCursor.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class AttachToCursor : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Camera cam;
|
||||
private void Update()
|
||||
{
|
||||
transform.position = cam.ScreenToWorldPoint(Input.mousePosition) + new Vector3(0, 0, cam.nearClipPlane);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/AttachToCursor.cs.meta
Normal file
2
Assets/Scripts/AttachToCursor.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 548df8df9b2f95534b76729bc92e7bc9
|
||||
|
|
@ -1,10 +1,17 @@
|
|||
using System;
|
||||
using Unity.Cinemachine;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraController : MonoBehaviour
|
||||
{
|
||||
public float panSpeed;
|
||||
public bool canMoveCamera = true;
|
||||
[SerializeField] private CinemachineCamera cineCam;
|
||||
[Header("Zoom")]
|
||||
[SerializeField] private float zoomSpeed;
|
||||
[SerializeField] private float camMaxSize;
|
||||
[SerializeField] private float camMinSize;
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
|
|
@ -13,5 +20,12 @@ public class CameraController : MonoBehaviour
|
|||
Vector2 moveDirection = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
|
||||
transform.Translate(moveDirection * (panSpeed * Time.deltaTime));
|
||||
}
|
||||
|
||||
if (Input.mouseScrollDelta.y != 0)
|
||||
{
|
||||
float scroll = Mathf.Clamp(cineCam.Lens.OrthographicSize - (Input.mouseScrollDelta.y * zoomSpeed),
|
||||
camMinSize, camMaxSize);
|
||||
cineCam.Lens.OrthographicSize = scroll;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
using System;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class Enemy : Entity
|
||||
{
|
||||
public static event Action<Entity> OnKill;
|
||||
[Header("Enemy Stats")]
|
||||
public int turnSpeed;
|
||||
public float minimumAttackRange;
|
||||
|
|
@ -19,7 +23,7 @@ public class Enemy : Entity
|
|||
closestPlayer = FindClosestPlayer();
|
||||
if (Vector3.Distance(transform.position, closestPlayer.transform.position) > minimumAttackRange)
|
||||
{
|
||||
EnemyMovement.instance.PathfindToTarget(closestPlayer.currentTile.neighbors[Random.Range(0, closestPlayer.currentTile.neighbors.Count)], this);
|
||||
EnemyMovement.instance.PathfindToTarget(GridManager.instance.FindClosestEmptyTile(closestPlayer.currentTile.neighbors[Random.Range(0, closestPlayer.currentTile.neighbors.Count)]), this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -46,13 +50,14 @@ public class Enemy : Entity
|
|||
}
|
||||
return currentClosestPlayer;
|
||||
}
|
||||
protected override void OnKillEffects()
|
||||
protected override void OnKillEffects(Entity attacker)
|
||||
{
|
||||
TurnHandler.instance.enemyEntities.Remove(this);
|
||||
OnKill?.Invoke(attacker);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
public void Attack(PlayerEntity target)
|
||||
{
|
||||
target.TakeDamage(damage);
|
||||
target.TakeDamage(damage, this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ public class Entity : MonoBehaviour
|
|||
[SerializeField] private SpriteRenderer[] spriteRenderers;
|
||||
[SerializeField] private float damageColorChangeSpeed;
|
||||
|
||||
public virtual void TakeDamage(float damage)
|
||||
public virtual void TakeDamage(float damage, Entity attacker)
|
||||
{
|
||||
health -= damage;
|
||||
StartCoroutine(DamageAnimation());
|
||||
if (health <= 0)
|
||||
{
|
||||
OnKillEffects();
|
||||
OnKillEffects(attacker);
|
||||
}
|
||||
Debug.Log($"{name} took {damage} damage");
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ public class Entity : MonoBehaviour
|
|||
health = Mathf.Clamp(health, 0, maxHealth);
|
||||
}
|
||||
|
||||
protected virtual void OnKillEffects()
|
||||
protected virtual void OnKillEffects(Entity attacker)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class MeleeWeapon : Weapon
|
|||
{
|
||||
if (!enemy.transform.CompareTag(tag) && enemy.transform.TryGetComponent(out Entity isEntity))
|
||||
{
|
||||
isEntity.TakeDamage(damage);
|
||||
isEntity.TakeDamage(damage, thisEntity);
|
||||
}
|
||||
}
|
||||
isAiming = false;
|
||||
|
|
@ -32,11 +32,13 @@ public class MeleeWeapon : Weapon
|
|||
TurnHandler.instance.UpdateTurns();
|
||||
ActionUIHandler.instance.UpdateUI();
|
||||
debugColliderHitbox.gameObject.SetActive(false);
|
||||
ActionUIHandler.instance.cursorObject.SetActive(false);
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(1))
|
||||
{
|
||||
isAiming = false;
|
||||
debugColliderHitbox.gameObject.SetActive(false);
|
||||
ActionUIHandler.instance.cursorObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
27
Assets/Scripts/OfficerAbilities.cs
Normal file
27
Assets/Scripts/OfficerAbilities.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class OfficerAbilities : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private int killQuota;
|
||||
private int currentKills;
|
||||
public PlayerEntity thisEntity;
|
||||
private void Start()
|
||||
{
|
||||
Enemy.OnKill += UpdateKillQuota;
|
||||
}
|
||||
|
||||
private void UpdateKillQuota(Entity entity)
|
||||
{
|
||||
if (entity == thisEntity)
|
||||
{
|
||||
currentKills++;
|
||||
currentKills = Mathf.Clamp(currentKills, 0, killQuota);
|
||||
}
|
||||
}
|
||||
|
||||
public void ActivateAbility()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/OfficerAbilities.cs.meta
Normal file
2
Assets/Scripts/OfficerAbilities.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8bacba559d8b7025084e6a3b89c44a08
|
||||
|
|
@ -6,12 +6,18 @@ public class PlayerEntity : Entity
|
|||
[Header("Player Flags")]
|
||||
public int actions = 2;
|
||||
public int maxActions = 2;
|
||||
public enum PlayerClass {Ranker, Caster, Officer, Engineer, Medic}
|
||||
public PlayerClass selectedClass = PlayerClass.Ranker;
|
||||
[Header("Weaponry")]
|
||||
[SerializeField] private Weapon[] weapons;
|
||||
[HideInInspector] public List<Weapon> weaponInstances = new();
|
||||
public Weapon currentWeapon;
|
||||
[Header("OfficerAbilities")]
|
||||
[SerializeField] private OfficerAbilities officerAbility;
|
||||
[HideInInspector] public OfficerAbilities officerInstance;
|
||||
[Header("UI")]
|
||||
[SerializeField] private Transform hpBar;
|
||||
public GameObject debugDoneObject;
|
||||
void Start()
|
||||
{
|
||||
foreach (Weapon weapon in weapons)
|
||||
|
|
@ -21,6 +27,12 @@ public class PlayerEntity : Entity
|
|||
newWeapon.tag = tag;
|
||||
weaponInstances.Add(newWeapon);
|
||||
}
|
||||
|
||||
if (selectedClass == PlayerClass.Officer)
|
||||
{
|
||||
officerInstance = Instantiate(officerAbility, transform);
|
||||
officerInstance.thisEntity = this;
|
||||
}
|
||||
currentWeapon = weaponInstances[0];
|
||||
}
|
||||
|
||||
|
|
@ -30,9 +42,9 @@ public class PlayerEntity : Entity
|
|||
|
||||
}
|
||||
|
||||
public override void TakeDamage(float amount)
|
||||
public override void TakeDamage(float amount, Entity attacker)
|
||||
{
|
||||
base.TakeDamage(amount);
|
||||
base.TakeDamage(amount, attacker);
|
||||
UpdateHealthUI();
|
||||
}
|
||||
public void UpdateHealthUI()
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class PlayerEntityMovement : MonoBehaviour
|
|||
Deselect();
|
||||
}
|
||||
TileObject newTile = GridManager.instance.GetTileFromWorldPos(mouseGridPos);
|
||||
if (requestedTile != newTile)
|
||||
if (requestedTile != newTile && !newTile.blocked)
|
||||
{
|
||||
requestedTile = newTile;
|
||||
foreach (TileObject tile in pathRequested)
|
||||
|
|
@ -167,7 +167,7 @@ public class PlayerEntityMovement : MonoBehaviour
|
|||
StartCoroutine(selectedEntity.MoveToLocation(pathRequested.ToArray()));
|
||||
templateObject.SetActive(false);
|
||||
UncolorGrid();
|
||||
selectedEntity.actions--;
|
||||
ActionUIHandler.instance.UpdateActions(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ using UnityEngine;
|
|||
public class Projectile : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Rigidbody2D rb;
|
||||
[SerializeField] private LayerMask environmentLayer;
|
||||
public PlayerEntity fromEntity;
|
||||
[Header("Stats")]
|
||||
public float damage;
|
||||
public float speed;
|
||||
|
|
@ -31,13 +33,17 @@ public class Projectile : MonoBehaviour
|
|||
{
|
||||
if (!collision.CompareTag(tag) && collision.TryGetComponent(out Entity isEntity))
|
||||
{
|
||||
isEntity.TakeDamage(damage);
|
||||
isEntity.TakeDamage(damage, fromEntity);
|
||||
currentPierce++;
|
||||
if (currentPierce > pierceAmount)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
else if (collision.gameObject.layer == 3)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ public class RangedWeapon : Weapon
|
|||
private Camera cam;
|
||||
private Vector3 mousePos;
|
||||
[Header("Ranged Weapon Specifics")]
|
||||
public int reloadActionUsage;
|
||||
public bool fired;
|
||||
[SerializeField] private Projectile projectile;
|
||||
private void Start()
|
||||
|
|
@ -40,11 +41,13 @@ public class RangedWeapon : Weapon
|
|||
CreateProjectile(mousePos);
|
||||
fired = true;
|
||||
isAiming = false;
|
||||
thisEntity.actions--;
|
||||
ActionUIHandler.instance.UpdateActions(1);
|
||||
ActionUIHandler.instance.cursorObject.SetActive(false);
|
||||
}
|
||||
else if (Input.GetMouseButtonDown(1))
|
||||
{
|
||||
isAiming = false;
|
||||
ActionUIHandler.instance.cursorObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -53,6 +56,8 @@ public class RangedWeapon : Weapon
|
|||
{
|
||||
Projectile newProjectile = Instantiate(projectile, transform.position, Quaternion.identity);
|
||||
newProjectile.RotateToTarget(target);
|
||||
newProjectile.damage = damage;
|
||||
newProjectile.tag = tag;
|
||||
newProjectile.fromEntity = thisEntity;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,13 @@ public class TurnHandler : MonoBehaviour
|
|||
[Header("Spawning")]
|
||||
[SerializeField] private int enemySpawnAmount;
|
||||
|
||||
[Header("Endless Mechanics")]
|
||||
[SerializeField] private bool isEndless = false;
|
||||
[SerializeField] private int baseSpawnAmount;
|
||||
[SerializeField] private int amountToSpawn;
|
||||
[SerializeField] private float exponentIncrease;
|
||||
private int currentWave = 1;
|
||||
|
||||
private void SortEnemies()
|
||||
{
|
||||
enemyEntities = enemyEntities.OrderBy(o=>o.turnSpeed).ToList();
|
||||
|
|
@ -83,12 +90,18 @@ public class TurnHandler : MonoBehaviour
|
|||
foreach (PlayerEntity player in playerEntities)
|
||||
{
|
||||
player.actions = player.maxActions;
|
||||
player.debugDoneObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void EnvironmentTurn()
|
||||
{
|
||||
if (isEndless && enemyEntities.Count == 0)
|
||||
{
|
||||
amountToSpawn = Mathf.FloorToInt(baseSpawnAmount * Mathf.Pow(currentWave, exponentIncrease));
|
||||
EnemySpawner.instance.SpawnEnemy(enemySpawnAmount);
|
||||
currentWave++;
|
||||
}
|
||||
}
|
||||
|
||||
public void SkipAll()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ TagManager:
|
|||
- Projectile
|
||||
- WeaponHitbox
|
||||
- CamBorders
|
||||
-
|
||||
- EnviroCover
|
||||
-
|
||||
-
|
||||
-
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue