they do not call me the ui designer

This commit is contained in:
reisenlol 2026-01-15 23:55:42 -08:00
parent daf3218043
commit 68af10bc4d
No known key found for this signature in database
14 changed files with 1677 additions and 125 deletions

View file

@ -28,7 +28,7 @@ RectTransform:
m_GameObject: {fileID: 423052272253214442}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.25, y: 1.25, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3164856206414981243}
@ -212,7 +212,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -0.5}
m_AnchoredPosition: {x: 0, y: -0.6}
m_SizeDelta: {x: 0.9, y: 0.15}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3388054835193516624
@ -262,7 +262,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 576146896620919861}
- component: {fileID: 3017941309338641158}
- component: {fileID: 6953866836340070426}
- component: {fileID: 5017380791142386142}
- component: {fileID: 7370141107480051474}
@ -283,67 +282,13 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.5, y: 3.5, z: 0}
m_LocalScale: {x: 0.8, y: 0.8, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3735594418940052040}
- {fileID: 6763493467664428652}
m_Father: {fileID: 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
BoxCollider2D:
m_ObjectHideFlags: 0
@ -382,7 +327,7 @@ BoxCollider2D:
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 1, y: 1}
oldSize: {x: 0.8125, y: 0.9625}
newSize: {x: 1, y: 1}
adaptiveTilingThreshold: 0.5
drawMode: 0
@ -437,7 +382,7 @@ MonoBehaviour:
canMove: 1
invincible: 0
spriteRenderers:
- {fileID: 3017941309338641158}
- {fileID: 400185309718877830}
damageColorChangeSpeed: 4
hasMoved: 0
hasAttacked: 0
@ -447,3 +392,90 @@ MonoBehaviour:
weaponInstances: []
currentWeapon: {fileID: 0}
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

View file

@ -1,3 +1,4 @@
using System;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
@ -21,10 +22,19 @@ public class ActionUIHandler : MonoBehaviour
#endregion
private PlayerEntity selectedEntity;
private RangedWeapon possibleRanged;
public bool opened;
[Header("Main UI")]
[SerializeField] private Vector3 offset;
[SerializeField] private GameObject actionUI;
[SerializeField] private TextMeshProUGUI actionText;
public bool opened;
[Header("Info UI")]
[SerializeField] private GameObject infoUI;
[SerializeField] private TextMeshProUGUI nameLabel;
[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")]
[SerializeField] private Button moveButton;
[SerializeField] private Button attackButton;
@ -37,13 +47,15 @@ public class ActionUIHandler : MonoBehaviour
[SerializeField] private float templateButtonHeight;
//500 if statements in this script lol
public void ShowUI(PlayerEntity target)
{
opened = true;
possibleRanged = null;
selectedEntity = target;
transform.position = Input.mousePosition + offset;
actionUI.SetActive(true);
actionText.gameObject.SetActive(true);
infoUI.SetActive(true);
UpdateUI();
}
@ -53,7 +65,7 @@ public class ActionUIHandler : MonoBehaviour
{
possibleRanged = isRanged;
}
if ((!isRanged || !isRanged.fired) && !selectedEntity.hasAttacked)
if (!isRanged || !isRanged.fired)
{
attackButton.gameObject.SetActive(true);
reloadButton.gameObject.SetActive(false);
@ -63,7 +75,7 @@ public class ActionUIHandler : MonoBehaviour
attackButton.gameObject.SetActive(false);
if (isRanged && isRanged.fired)
{
if (selectedEntity.hasMoved || selectedEntity.hasAttacked)
if (selectedEntity.actions < 2)
{
reloadButton.gameObject.SetActive(false);
}
@ -73,27 +85,37 @@ public class ActionUIHandler : MonoBehaviour
}
}
}
if (!selectedEntity.hasMoved || !selectedEntity.hasAttacked)
{
moveButton.gameObject.SetActive(true);
switchButton.gameObject.SetActive(true);
}
if (selectedEntity.hasAttacked && selectedEntity.hasMoved)
moveButton.gameObject.SetActive(true);
switchButton.gameObject.SetActive(true);
actionText.text = $"Remaining Actions: {selectedEntity.actions}";
UpdateInfo();
if (selectedEntity.actions == 0)
{
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()
{
opened = false;
actionUI.SetActive(false);
weaponUIPanel.gameObject.SetActive(false);
foreach (Transform uiObject in transform)
{
uiObject.gameObject.SetActive(false);
}
infoUI.SetActive(false);
}
public void ReloadGun()
{
possibleRanged.Reload();
selectedEntity.hasAttacked = true;
selectedEntity.actions -= 2;
HideUI();
}
@ -145,7 +167,7 @@ public class ActionUIHandler : MonoBehaviour
public void SelectWeapon(Weapon weaponSelected)
{
MoveAction();
selectedEntity.actions--;
selectedEntity.SwitchWeapon(weaponSelected);
HideWeaponList();
UpdateUI();
@ -155,15 +177,4 @@ public class ActionUIHandler : MonoBehaviour
{
weaponUIPanel.gameObject.SetActive(false);
}
private void MoveAction()
{
if (!selectedEntity.hasMoved)
{
selectedEntity.hasMoved = true;
}
else if (!selectedEntity.hasAttacked)
{
selectedEntity.hasAttacked = true;
}
}
}

View file

@ -0,0 +1,17 @@
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));
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: bc0f858f3c02d522db5e0934da8c5766

View file

@ -17,7 +17,8 @@ public class Entity : MonoBehaviour
public bool canMove = true;
public bool invincible;
[Header("Animation")]
[Header("Animation (assume sprites face right)")]
private bool isFacingRight;
[SerializeField] private SpriteRenderer[] spriteRenderers;
[SerializeField] private float damageColorChangeSpeed;
@ -61,6 +62,19 @@ public class Entity : MonoBehaviour
currentTile = pathToMove[currentTileList];
currentState = 0;
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;
}

View file

@ -19,7 +19,7 @@ public class MeleeWeapon : Weapon
if (Input.GetMouseButtonDown(0))
{
RaycastHit2D[] enemyList = Physics2D.BoxCastAll(transform.position, colliderSize, Vector3.Angle(transform.position, mouseWorldPos),
PlayerEntityMovement.instance.mouseWorldPos, 100f, entityLayer);
PlayerEntityMovement.instance.mouseWorldPos, 2, entityLayer);
foreach (RaycastHit2D enemy in enemyList)
{
if (!enemy.transform.CompareTag(tag) && enemy.transform.TryGetComponent(out Entity isEntity))
@ -28,7 +28,7 @@ public class MeleeWeapon : Weapon
}
}
isAiming = false;
thisEntity.hasAttacked = true;
thisEntity.actions--;
TurnHandler.instance.UpdateTurns();
ActionUIHandler.instance.UpdateUI();
debugColliderHitbox.gameObject.SetActive(false);

View file

@ -4,8 +4,8 @@ using UnityEngine;
public class PlayerEntity : Entity
{
[Header("Player Flags")]
public bool hasMoved = false;
public bool hasAttacked = false;
public int actions = 2;
public int maxActions = 2;
[Header("Weaponry")]
[SerializeField] private Weapon[] weapons;
[HideInInspector] public List<Weapon> weaponInstances = new();
@ -42,8 +42,7 @@ public class PlayerEntity : Entity
public void SkipTurn()
{
hasMoved = true;
hasAttacked = true;
actions = 0;
TurnHandler.instance.UpdateTurns();
}
public void Attack()
@ -68,7 +67,7 @@ public class PlayerEntity : Entity
private void OnMouseDown()
{
if ((!hasMoved || !hasAttacked) && !PlayerEntityMovement.instance.isMoving)
if (actions > 0 && !PlayerEntityMovement.instance.isMoving)
{
ActionUIHandler.instance.ShowUI(this);
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerEntityMovement : MonoBehaviour
{
@ -66,7 +67,14 @@ public class PlayerEntityMovement : MonoBehaviour
requestedTile = newTile;
foreach (TileObject tile in pathRequested)
{
tile.sprite.color = new Color(137, 137, 137, 255);
if (!currentMovableTiles.Contains(tile))
{
tile.sprite.color = new Color32(137, 137, 137, 255);
}
else
{
tile.sprite.color = Color.green;
}
}
PathfindToTarget();
}
@ -159,14 +167,7 @@ public class PlayerEntityMovement : MonoBehaviour
StartCoroutine(selectedEntity.MoveToLocation(pathRequested.ToArray()));
templateObject.SetActive(false);
UncolorGrid();
if (!selectedEntity.hasMoved)
{
selectedEntity.hasMoved = true;
}
else
{
selectedEntity.hasAttacked = true;
}
selectedEntity.actions--;
return true;
}

View file

@ -40,7 +40,7 @@ public class RangedWeapon : Weapon
CreateProjectile(mousePos);
fired = true;
isAiming = false;
thisEntity.hasAttacked = true;
thisEntity.actions--;
}
else if (Input.GetMouseButtonDown(1))
{

View file

@ -48,7 +48,7 @@ public class TurnHandler : MonoBehaviour
{
foreach (PlayerEntity player in playerEntities)
{
if (!player.hasMoved || !player.hasAttacked)
if (player.actions > 0)
{
return;
}
@ -82,8 +82,7 @@ public class TurnHandler : MonoBehaviour
currentGameState = GameState.PlayerTurn;
foreach (PlayerEntity player in playerEntities)
{
player.hasMoved = false;
player.hasAttacked = false;
player.actions = player.maxActions;
}
}
@ -96,8 +95,7 @@ public class TurnHandler : MonoBehaviour
{
foreach (PlayerEntity player in playerEntities)
{
player.hasMoved = true;
player.hasAttacked = true;
player.actions = 0;
}
UpdateTurns();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View file

@ -0,0 +1,156 @@
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:

View file

@ -16,7 +16,7 @@ TagManager:
- Entity
- Projectile
- WeaponHitbox
-
- CamBorders
-
-
-