Compare commits
No commits in common. "3747c8e15814f3dbef893baf3ddc741b4da0aa84" and "4e909ae5775bca8a2d59394724e326a4aae3edbb" have entirely different histories.
3747c8e158
...
4e909ae577
14 changed files with 126 additions and 1678 deletions
|
|
@ -28,7 +28,7 @@ RectTransform:
|
||||||
m_GameObject: {fileID: 423052272253214442}
|
m_GameObject: {fileID: 423052272253214442}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1.25, y: 1.25, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3164856206414981243}
|
- {fileID: 3164856206414981243}
|
||||||
|
|
@ -212,7 +212,7 @@ RectTransform:
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: -0.6}
|
m_AnchoredPosition: {x: 0, y: -0.5}
|
||||||
m_SizeDelta: {x: 0.9, y: 0.15}
|
m_SizeDelta: {x: 0.9, y: 0.15}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!222 &3388054835193516624
|
--- !u!222 &3388054835193516624
|
||||||
|
|
@ -262,6 +262,7 @@ GameObject:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 576146896620919861}
|
- component: {fileID: 576146896620919861}
|
||||||
|
- component: {fileID: 3017941309338641158}
|
||||||
- component: {fileID: 6953866836340070426}
|
- component: {fileID: 6953866836340070426}
|
||||||
- component: {fileID: 5017380791142386142}
|
- component: {fileID: 5017380791142386142}
|
||||||
- component: {fileID: 7370141107480051474}
|
- component: {fileID: 7370141107480051474}
|
||||||
|
|
@ -282,13 +283,67 @@ Transform:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 2.5, y: 3.5, z: 0}
|
m_LocalPosition: {x: 2.5, y: 3.5, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 0.8, y: 0.8, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3735594418940052040}
|
|
||||||
- {fileID: 6763493467664428652}
|
- {fileID: 6763493467664428652}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!212 &3017941309338641158
|
||||||
|
SpriteRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8094053231633710175}
|
||||||
|
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: 0.5424528, g: 0.9869612, 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!61 &6953866836340070426
|
--- !u!61 &6953866836340070426
|
||||||
BoxCollider2D:
|
BoxCollider2D:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -327,7 +382,7 @@ BoxCollider2D:
|
||||||
m_SpriteTilingProperty:
|
m_SpriteTilingProperty:
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
pivot: {x: 0.5, y: 0.5}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
oldSize: {x: 0.8125, y: 0.9625}
|
oldSize: {x: 1, y: 1}
|
||||||
newSize: {x: 1, y: 1}
|
newSize: {x: 1, y: 1}
|
||||||
adaptiveTilingThreshold: 0.5
|
adaptiveTilingThreshold: 0.5
|
||||||
drawMode: 0
|
drawMode: 0
|
||||||
|
|
@ -382,7 +437,7 @@ MonoBehaviour:
|
||||||
canMove: 1
|
canMove: 1
|
||||||
invincible: 0
|
invincible: 0
|
||||||
spriteRenderers:
|
spriteRenderers:
|
||||||
- {fileID: 400185309718877830}
|
- {fileID: 3017941309338641158}
|
||||||
damageColorChangeSpeed: 4
|
damageColorChangeSpeed: 4
|
||||||
hasMoved: 0
|
hasMoved: 0
|
||||||
hasAttacked: 0
|
hasAttacked: 0
|
||||||
|
|
@ -392,90 +447,3 @@ MonoBehaviour:
|
||||||
weaponInstances: []
|
weaponInstances: []
|
||||||
currentWeapon: {fileID: 0}
|
currentWeapon: {fileID: 0}
|
||||||
hpBar: {fileID: 3104995061699689292}
|
hpBar: {fileID: 3104995061699689292}
|
||||||
--- !u!1 &9154813544046831137
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 3735594418940052040}
|
|
||||||
- component: {fileID: 400185309718877830}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Sprite
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &3735594418940052040
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 9154813544046831137}
|
|
||||||
serializedVersion: 2
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: -0.01745245, w: 0.99984777}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 576146896620919861}
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -2}
|
|
||||||
--- !u!212 &400185309718877830
|
|
||||||
SpriteRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 9154813544046831137}
|
|
||||||
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: -7425528324702340497, guid: 2e81e15c3990a443d883186c228cacb9, 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
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,3 @@
|
||||||
using System;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
@ -22,19 +21,10 @@ public class ActionUIHandler : MonoBehaviour
|
||||||
#endregion
|
#endregion
|
||||||
private PlayerEntity selectedEntity;
|
private PlayerEntity selectedEntity;
|
||||||
private RangedWeapon possibleRanged;
|
private RangedWeapon possibleRanged;
|
||||||
[Header("Main UI")]
|
|
||||||
[SerializeField] private GameObject actionUI;
|
|
||||||
[SerializeField] private TextMeshProUGUI actionText;
|
|
||||||
public bool opened;
|
public bool opened;
|
||||||
[Header("Info UI")]
|
[Header("Main UI")]
|
||||||
[SerializeField] private GameObject infoUI;
|
[SerializeField] private Vector3 offset;
|
||||||
[SerializeField] private TextMeshProUGUI nameLabel;
|
[SerializeField] private GameObject actionUI;
|
||||||
[SerializeField] private TextMeshProUGUI classLabel;
|
|
||||||
[SerializeField] private Image unitPortrait;
|
|
||||||
[SerializeField] private TextMeshProUGUI attackLabel;
|
|
||||||
[SerializeField] private TextMeshProUGUI speedLabel;
|
|
||||||
[SerializeField] private Transform healthBar;
|
|
||||||
[SerializeField] private TextMeshProUGUI healthText;
|
|
||||||
[Header("Action Buttons")]
|
[Header("Action Buttons")]
|
||||||
[SerializeField] private Button moveButton;
|
[SerializeField] private Button moveButton;
|
||||||
[SerializeField] private Button attackButton;
|
[SerializeField] private Button attackButton;
|
||||||
|
|
@ -47,15 +37,13 @@ public class ActionUIHandler : MonoBehaviour
|
||||||
[SerializeField] private float templateButtonHeight;
|
[SerializeField] private float templateButtonHeight;
|
||||||
|
|
||||||
//500 if statements in this script lol
|
//500 if statements in this script lol
|
||||||
|
|
||||||
public void ShowUI(PlayerEntity target)
|
public void ShowUI(PlayerEntity target)
|
||||||
{
|
{
|
||||||
opened = true;
|
opened = true;
|
||||||
possibleRanged = null;
|
possibleRanged = null;
|
||||||
selectedEntity = target;
|
selectedEntity = target;
|
||||||
|
transform.position = Input.mousePosition + offset;
|
||||||
actionUI.SetActive(true);
|
actionUI.SetActive(true);
|
||||||
actionText.gameObject.SetActive(true);
|
|
||||||
infoUI.SetActive(true);
|
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,7 +53,7 @@ public class ActionUIHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
possibleRanged = isRanged;
|
possibleRanged = isRanged;
|
||||||
}
|
}
|
||||||
if (!isRanged || !isRanged.fired)
|
if ((!isRanged || !isRanged.fired) && !selectedEntity.hasAttacked)
|
||||||
{
|
{
|
||||||
attackButton.gameObject.SetActive(true);
|
attackButton.gameObject.SetActive(true);
|
||||||
reloadButton.gameObject.SetActive(false);
|
reloadButton.gameObject.SetActive(false);
|
||||||
|
|
@ -75,7 +63,7 @@ public class ActionUIHandler : MonoBehaviour
|
||||||
attackButton.gameObject.SetActive(false);
|
attackButton.gameObject.SetActive(false);
|
||||||
if (isRanged && isRanged.fired)
|
if (isRanged && isRanged.fired)
|
||||||
{
|
{
|
||||||
if (selectedEntity.actions < 2)
|
if (selectedEntity.hasMoved || selectedEntity.hasAttacked)
|
||||||
{
|
{
|
||||||
reloadButton.gameObject.SetActive(false);
|
reloadButton.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
@ -85,37 +73,27 @@ public class ActionUIHandler : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
moveButton.gameObject.SetActive(true);
|
if (!selectedEntity.hasMoved || !selectedEntity.hasAttacked)
|
||||||
switchButton.gameObject.SetActive(true);
|
{
|
||||||
actionText.text = $"Remaining Actions: {selectedEntity.actions}";
|
moveButton.gameObject.SetActive(true);
|
||||||
UpdateInfo();
|
switchButton.gameObject.SetActive(true);
|
||||||
if (selectedEntity.actions == 0)
|
}
|
||||||
|
if (selectedEntity.hasAttacked && selectedEntity.hasMoved)
|
||||||
{
|
{
|
||||||
HideUI();
|
HideUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateInfo()
|
|
||||||
{
|
|
||||||
healthBar.localScale = new Vector3(selectedEntity.health / selectedEntity.maxHealth,1,1);
|
|
||||||
healthText.text = $"{selectedEntity.health}/{selectedEntity.maxHealth}";
|
|
||||||
attackLabel.text = $"Attack: {selectedEntity.currentWeapon.damage}";
|
|
||||||
speedLabel.text = $"Speed: {selectedEntity.maxMovement}";
|
|
||||||
}
|
|
||||||
public void HideUI()
|
public void HideUI()
|
||||||
{
|
{
|
||||||
opened = false;
|
opened = false;
|
||||||
foreach (Transform uiObject in transform)
|
actionUI.SetActive(false);
|
||||||
{
|
weaponUIPanel.gameObject.SetActive(false);
|
||||||
uiObject.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
infoUI.SetActive(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadGun()
|
public void ReloadGun()
|
||||||
{
|
{
|
||||||
possibleRanged.Reload();
|
possibleRanged.Reload();
|
||||||
selectedEntity.actions -= 2;
|
selectedEntity.hasAttacked = true;
|
||||||
HideUI();
|
HideUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,7 +145,7 @@ public class ActionUIHandler : MonoBehaviour
|
||||||
|
|
||||||
public void SelectWeapon(Weapon weaponSelected)
|
public void SelectWeapon(Weapon weaponSelected)
|
||||||
{
|
{
|
||||||
selectedEntity.actions--;
|
MoveAction();
|
||||||
selectedEntity.SwitchWeapon(weaponSelected);
|
selectedEntity.SwitchWeapon(weaponSelected);
|
||||||
HideWeaponList();
|
HideWeaponList();
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
|
|
@ -177,4 +155,15 @@ public class ActionUIHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
weaponUIPanel.gameObject.SetActive(false);
|
weaponUIPanel.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
private void MoveAction()
|
||||||
|
{
|
||||||
|
if (!selectedEntity.hasMoved)
|
||||||
|
{
|
||||||
|
selectedEntity.hasMoved = true;
|
||||||
|
}
|
||||||
|
else if (!selectedEntity.hasAttacked)
|
||||||
|
{
|
||||||
|
selectedEntity.hasAttacked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
using System;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class CameraController : MonoBehaviour
|
|
||||||
{
|
|
||||||
public float panSpeed;
|
|
||||||
public bool canMoveCamera = true;
|
|
||||||
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
if (canMoveCamera)
|
|
||||||
{
|
|
||||||
Vector2 moveDirection = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
|
|
||||||
transform.Translate(moveDirection * (panSpeed * Time.deltaTime));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: bc0f858f3c02d522db5e0934da8c5766
|
|
||||||
|
|
@ -17,8 +17,7 @@ public class Entity : MonoBehaviour
|
||||||
public bool canMove = true;
|
public bool canMove = true;
|
||||||
public bool invincible;
|
public bool invincible;
|
||||||
|
|
||||||
[Header("Animation (assume sprites face right)")]
|
[Header("Animation")]
|
||||||
private bool isFacingRight;
|
|
||||||
[SerializeField] private SpriteRenderer[] spriteRenderers;
|
[SerializeField] private SpriteRenderer[] spriteRenderers;
|
||||||
[SerializeField] private float damageColorChangeSpeed;
|
[SerializeField] private float damageColorChangeSpeed;
|
||||||
|
|
||||||
|
|
@ -62,19 +61,6 @@ public class Entity : MonoBehaviour
|
||||||
currentTile = pathToMove[currentTileList];
|
currentTile = pathToMove[currentTileList];
|
||||||
currentState = 0;
|
currentState = 0;
|
||||||
currentTileList++;
|
currentTileList++;
|
||||||
if (currentTileList < pathToMove.Length)
|
|
||||||
{
|
|
||||||
float dotProduct = Vector3.Dot((pathToMove[currentTileList].transform.position - currentTile.transform.position), Vector3.right);
|
|
||||||
if (dotProduct < 0 && !isFacingRight || dotProduct > 0 && isFacingRight)
|
|
||||||
{
|
|
||||||
isFacingRight = !isFacingRight;
|
|
||||||
foreach (SpriteRenderer spriteRenderer in spriteRenderers)
|
|
||||||
{
|
|
||||||
spriteRenderer.gameObject.transform.eulerAngles = new Vector3(0, 0, -spriteRenderer.gameObject.transform.eulerAngles.z);
|
|
||||||
spriteRenderer.flipX = !spriteRenderer.flipX; //quite the jank rotation code
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public class MeleeWeapon : Weapon
|
||||||
if (Input.GetMouseButtonDown(0))
|
if (Input.GetMouseButtonDown(0))
|
||||||
{
|
{
|
||||||
RaycastHit2D[] enemyList = Physics2D.BoxCastAll(transform.position, colliderSize, Vector3.Angle(transform.position, mouseWorldPos),
|
RaycastHit2D[] enemyList = Physics2D.BoxCastAll(transform.position, colliderSize, Vector3.Angle(transform.position, mouseWorldPos),
|
||||||
PlayerEntityMovement.instance.mouseWorldPos, 2, entityLayer);
|
PlayerEntityMovement.instance.mouseWorldPos, 100f, entityLayer);
|
||||||
foreach (RaycastHit2D enemy in enemyList)
|
foreach (RaycastHit2D enemy in enemyList)
|
||||||
{
|
{
|
||||||
if (!enemy.transform.CompareTag(tag) && enemy.transform.TryGetComponent(out Entity isEntity))
|
if (!enemy.transform.CompareTag(tag) && enemy.transform.TryGetComponent(out Entity isEntity))
|
||||||
|
|
@ -28,7 +28,7 @@ public class MeleeWeapon : Weapon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
isAiming = false;
|
isAiming = false;
|
||||||
thisEntity.actions--;
|
thisEntity.hasAttacked = true;
|
||||||
TurnHandler.instance.UpdateTurns();
|
TurnHandler.instance.UpdateTurns();
|
||||||
ActionUIHandler.instance.UpdateUI();
|
ActionUIHandler.instance.UpdateUI();
|
||||||
debugColliderHitbox.gameObject.SetActive(false);
|
debugColliderHitbox.gameObject.SetActive(false);
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ using UnityEngine;
|
||||||
|
|
||||||
public class PlayerEntity : Entity
|
public class PlayerEntity : Entity
|
||||||
{
|
{
|
||||||
[Header("Player Flags")]
|
[Header("Player Flags")]
|
||||||
public int actions = 2;
|
public bool hasMoved = false;
|
||||||
public int maxActions = 2;
|
public bool hasAttacked = false;
|
||||||
[Header("Weaponry")]
|
[Header("Weaponry")]
|
||||||
[SerializeField] private Weapon[] weapons;
|
[SerializeField] private Weapon[] weapons;
|
||||||
[HideInInspector] public List<Weapon> weaponInstances = new();
|
[HideInInspector] public List<Weapon> weaponInstances = new();
|
||||||
|
|
@ -42,7 +42,8 @@ public class PlayerEntity : Entity
|
||||||
|
|
||||||
public void SkipTurn()
|
public void SkipTurn()
|
||||||
{
|
{
|
||||||
actions = 0;
|
hasMoved = true;
|
||||||
|
hasAttacked = true;
|
||||||
TurnHandler.instance.UpdateTurns();
|
TurnHandler.instance.UpdateTurns();
|
||||||
}
|
}
|
||||||
public void Attack()
|
public void Attack()
|
||||||
|
|
@ -67,7 +68,7 @@ public class PlayerEntity : Entity
|
||||||
|
|
||||||
private void OnMouseDown()
|
private void OnMouseDown()
|
||||||
{
|
{
|
||||||
if (actions > 0 && !PlayerEntityMovement.instance.isMoving)
|
if ((!hasMoved || !hasAttacked) && !PlayerEntityMovement.instance.isMoving)
|
||||||
{
|
{
|
||||||
ActionUIHandler.instance.ShowUI(this);
|
ActionUIHandler.instance.ShowUI(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
|
||||||
|
|
||||||
public class PlayerEntityMovement : MonoBehaviour
|
public class PlayerEntityMovement : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
@ -67,14 +66,7 @@ public class PlayerEntityMovement : MonoBehaviour
|
||||||
requestedTile = newTile;
|
requestedTile = newTile;
|
||||||
foreach (TileObject tile in pathRequested)
|
foreach (TileObject tile in pathRequested)
|
||||||
{
|
{
|
||||||
if (!currentMovableTiles.Contains(tile))
|
tile.sprite.color = new Color(137, 137, 137, 255);
|
||||||
{
|
|
||||||
tile.sprite.color = new Color32(137, 137, 137, 255);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tile.sprite.color = Color.green;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PathfindToTarget();
|
PathfindToTarget();
|
||||||
}
|
}
|
||||||
|
|
@ -167,7 +159,14 @@ public class PlayerEntityMovement : MonoBehaviour
|
||||||
StartCoroutine(selectedEntity.MoveToLocation(pathRequested.ToArray()));
|
StartCoroutine(selectedEntity.MoveToLocation(pathRequested.ToArray()));
|
||||||
templateObject.SetActive(false);
|
templateObject.SetActive(false);
|
||||||
UncolorGrid();
|
UncolorGrid();
|
||||||
selectedEntity.actions--;
|
if (!selectedEntity.hasMoved)
|
||||||
|
{
|
||||||
|
selectedEntity.hasMoved = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selectedEntity.hasAttacked = true;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class RangedWeapon : Weapon
|
||||||
CreateProjectile(mousePos);
|
CreateProjectile(mousePos);
|
||||||
fired = true;
|
fired = true;
|
||||||
isAiming = false;
|
isAiming = false;
|
||||||
thisEntity.actions--;
|
thisEntity.hasAttacked = true;
|
||||||
}
|
}
|
||||||
else if (Input.GetMouseButtonDown(1))
|
else if (Input.GetMouseButtonDown(1))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public class TurnHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
foreach (PlayerEntity player in playerEntities)
|
foreach (PlayerEntity player in playerEntities)
|
||||||
{
|
{
|
||||||
if (player.actions > 0)
|
if (!player.hasMoved || !player.hasAttacked)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +82,8 @@ public class TurnHandler : MonoBehaviour
|
||||||
currentGameState = GameState.PlayerTurn;
|
currentGameState = GameState.PlayerTurn;
|
||||||
foreach (PlayerEntity player in playerEntities)
|
foreach (PlayerEntity player in playerEntities)
|
||||||
{
|
{
|
||||||
player.actions = player.maxActions;
|
player.hasMoved = false;
|
||||||
|
player.hasAttacked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,7 +96,8 @@ public class TurnHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
foreach (PlayerEntity player in playerEntities)
|
foreach (PlayerEntity player in playerEntities)
|
||||||
{
|
{
|
||||||
player.actions = 0;
|
player.hasMoved = true;
|
||||||
|
player.hasAttacked = true;
|
||||||
}
|
}
|
||||||
UpdateTurns();
|
UpdateTurns();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.7 KiB |
|
|
@ -1,156 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 2e81e15c3990a443d883186c228cacb9
|
|
||||||
TextureImporter:
|
|
||||||
internalIDToNameTable:
|
|
||||||
- first:
|
|
||||||
213: -7425528324702340497
|
|
||||||
second: gunuuysprite_0
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 13
|
|
||||||
mipmaps:
|
|
||||||
mipMapMode: 0
|
|
||||||
enableMipMap: 0
|
|
||||||
sRGBTexture: 1
|
|
||||||
linearTexture: 0
|
|
||||||
fadeOut: 0
|
|
||||||
borderMipMap: 0
|
|
||||||
mipMapsPreserveCoverage: 0
|
|
||||||
alphaTestReferenceValue: 0.5
|
|
||||||
mipMapFadeDistanceStart: 1
|
|
||||||
mipMapFadeDistanceEnd: 3
|
|
||||||
bumpmap:
|
|
||||||
convertToNormalMap: 0
|
|
||||||
externalNormalMap: 0
|
|
||||||
heightScale: 0.25
|
|
||||||
normalMapFilter: 0
|
|
||||||
flipGreenChannel: 0
|
|
||||||
isReadable: 0
|
|
||||||
streamingMipmaps: 0
|
|
||||||
streamingMipmapsPriority: 0
|
|
||||||
vTOnly: 0
|
|
||||||
ignoreMipmapLimit: 0
|
|
||||||
grayScaleToAlpha: 0
|
|
||||||
generateCubemap: 6
|
|
||||||
cubemapConvolution: 0
|
|
||||||
seamlessCubemap: 0
|
|
||||||
textureFormat: 1
|
|
||||||
maxTextureSize: 2048
|
|
||||||
textureSettings:
|
|
||||||
serializedVersion: 2
|
|
||||||
filterMode: 0
|
|
||||||
aniso: 1
|
|
||||||
mipBias: 0
|
|
||||||
wrapU: 1
|
|
||||||
wrapV: 1
|
|
||||||
wrapW: 1
|
|
||||||
nPOTScale: 0
|
|
||||||
lightmap: 0
|
|
||||||
compressionQuality: 50
|
|
||||||
spriteMode: 2
|
|
||||||
spriteExtrude: 1
|
|
||||||
spriteMeshType: 1
|
|
||||||
alignment: 0
|
|
||||||
spritePivot: {x: 0.5, y: 0.5}
|
|
||||||
spritePixelsToUnits: 240
|
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
|
||||||
alphaUsage: 1
|
|
||||||
alphaIsTransparency: 1
|
|
||||||
spriteTessellationDetail: -1
|
|
||||||
textureType: 8
|
|
||||||
textureShape: 1
|
|
||||||
singleChannelComponent: 0
|
|
||||||
flipbookRows: 1
|
|
||||||
flipbookColumns: 1
|
|
||||||
maxTextureSizeSet: 0
|
|
||||||
compressionQualitySet: 0
|
|
||||||
textureFormatSet: 0
|
|
||||||
ignorePngGamma: 0
|
|
||||||
applyGammaDecoding: 0
|
|
||||||
swizzle: 50462976
|
|
||||||
cookieLightType: 0
|
|
||||||
platformSettings:
|
|
||||||
- serializedVersion: 4
|
|
||||||
buildTarget: DefaultTexturePlatform
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 4
|
|
||||||
buildTarget: Standalone
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
- serializedVersion: 4
|
|
||||||
buildTarget: WebGL
|
|
||||||
maxTextureSize: 2048
|
|
||||||
resizeAlgorithm: 0
|
|
||||||
textureFormat: -1
|
|
||||||
textureCompression: 1
|
|
||||||
compressionQuality: 50
|
|
||||||
crunchedCompression: 0
|
|
||||||
allowsAlphaSplitting: 0
|
|
||||||
overridden: 0
|
|
||||||
ignorePlatformSupport: 0
|
|
||||||
androidETC2FallbackOverride: 0
|
|
||||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
|
||||||
spriteSheet:
|
|
||||||
serializedVersion: 2
|
|
||||||
sprites:
|
|
||||||
- serializedVersion: 2
|
|
||||||
name: gunuuysprite_0
|
|
||||||
rect:
|
|
||||||
serializedVersion: 2
|
|
||||||
x: 15
|
|
||||||
y: 4
|
|
||||||
width: 195
|
|
||||||
height: 231
|
|
||||||
alignment: 0
|
|
||||||
pivot: {x: 0, y: 0}
|
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
|
||||||
customData:
|
|
||||||
outline: []
|
|
||||||
physicsShape: []
|
|
||||||
tessellationDetail: -1
|
|
||||||
bones: []
|
|
||||||
spriteID: f6af380b45933f890800000000000000
|
|
||||||
internalID: -7425528324702340497
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
outline: []
|
|
||||||
customData:
|
|
||||||
physicsShape: []
|
|
||||||
bones: []
|
|
||||||
spriteID:
|
|
||||||
internalID: 0
|
|
||||||
vertices: []
|
|
||||||
indices:
|
|
||||||
edges: []
|
|
||||||
weights: []
|
|
||||||
secondaryTextures: []
|
|
||||||
spriteCustomMetadata:
|
|
||||||
entries: []
|
|
||||||
nameFileIdTable:
|
|
||||||
gunuuysprite_0: -7425528324702340497
|
|
||||||
mipmapLimitGroupName:
|
|
||||||
pSDRemoveMatte: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
|
|
@ -16,7 +16,7 @@ TagManager:
|
||||||
- Entity
|
- Entity
|
||||||
- Projectile
|
- Projectile
|
||||||
- WeaponHitbox
|
- WeaponHitbox
|
||||||
- CamBorders
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue