yeah i think that's commit worthy
This commit is contained in:
parent
49cf2f2bb9
commit
fada3af715
16 changed files with 658 additions and 29 deletions
|
|
@ -32,6 +32,7 @@ public class ActionUIHandler : MonoBehaviour
|
|||
[SerializeField] private TextMeshProUGUI nameLabel;
|
||||
[SerializeField] private TextMeshProUGUI classLabel;
|
||||
[SerializeField] private Image unitPortrait;
|
||||
[SerializeField] private TextMeshProUGUI weaponLabel;
|
||||
[SerializeField] private TextMeshProUGUI attackLabel;
|
||||
[SerializeField] private TextMeshProUGUI speedLabel;
|
||||
[SerializeField] private Transform healthBar;
|
||||
|
|
@ -41,6 +42,7 @@ public class ActionUIHandler : MonoBehaviour
|
|||
[SerializeField] private Button attackButton;
|
||||
[SerializeField] private Button reloadButton;
|
||||
[SerializeField] private Button switchButton;
|
||||
[SerializeField] private Button officerAbilityButton;
|
||||
|
||||
[Header("Weapon Switcher")]
|
||||
[SerializeField] private RectTransform weaponUIPanel;
|
||||
|
|
@ -54,6 +56,7 @@ public class ActionUIHandler : MonoBehaviour
|
|||
opened = true;
|
||||
possibleRanged = null;
|
||||
selectedEntity = target;
|
||||
|
||||
actionUI.SetActive(true);
|
||||
actionText.gameObject.SetActive(true);
|
||||
infoUI.SetActive(true);
|
||||
|
|
@ -74,17 +77,22 @@ public class ActionUIHandler : MonoBehaviour
|
|||
else
|
||||
{
|
||||
attackButton.gameObject.SetActive(false);
|
||||
if (isRanged && isRanged.fired)
|
||||
if (isRanged && isRanged.fired && selectedEntity.actions >= isRanged.reloadActionUsage)
|
||||
{
|
||||
if (selectedEntity.actions < 2)
|
||||
{
|
||||
reloadButton.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
reloadButton.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reloadButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
officerAbilityButton.gameObject.SetActive(false);
|
||||
if (selectedEntity.officerInstance)
|
||||
{
|
||||
officerAbilityButton.gameObject.SetActive(true);
|
||||
}
|
||||
moveButton.gameObject.SetActive(true);
|
||||
switchButton.gameObject.SetActive(true);
|
||||
|
|
@ -99,6 +107,8 @@ public class ActionUIHandler : MonoBehaviour
|
|||
public void UpdateInfo()
|
||||
{
|
||||
healthBar.localScale = new Vector3(selectedEntity.health / selectedEntity.maxHealth,1,1);
|
||||
classLabel.text = selectedEntity.selectedClass.ToString();
|
||||
weaponLabel.text = $"Weapon: {selectedEntity.currentWeapon.weaponName}";
|
||||
healthText.text = $"{selectedEntity.health}/{selectedEntity.maxHealth}";
|
||||
attackLabel.text = $"Attack: {selectedEntity.currentWeapon.damage}";
|
||||
speedLabel.text = $"Speed: {selectedEntity.maxMovement}";
|
||||
|
|
@ -117,7 +127,7 @@ public class ActionUIHandler : MonoBehaviour
|
|||
{
|
||||
possibleRanged.Reload();
|
||||
UpdateActions(possibleRanged.reloadActionUsage);
|
||||
HideUI();
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
public void Attack()
|
||||
|
|
@ -127,6 +137,10 @@ public class ActionUIHandler : MonoBehaviour
|
|||
HideUI();
|
||||
}
|
||||
|
||||
public void ActivateOfficer()
|
||||
{
|
||||
selectedEntity.officerInstance.ActivateAbility();
|
||||
}
|
||||
public void SkipTurn()
|
||||
{
|
||||
selectedEntity.SkipTurn();
|
||||
|
|
|
|||
|
|
@ -3,12 +3,17 @@ using UnityEngine;
|
|||
|
||||
public class OfficerAbilities : MonoBehaviour
|
||||
{
|
||||
public PlayerEntity thisEntity;
|
||||
[Header("Kills")]
|
||||
[SerializeField] private int killQuota;
|
||||
private int currentKills;
|
||||
public PlayerEntity thisEntity;
|
||||
[Header("Length")]
|
||||
[SerializeField] private int abilityLength;
|
||||
[SerializeField] private int roundsRemaining;
|
||||
private void Start()
|
||||
{
|
||||
Enemy.OnKill += UpdateKillQuota;
|
||||
TurnHandler.waveUpdate += UpdateRounds;
|
||||
}
|
||||
|
||||
private void UpdateKillQuota(Entity entity)
|
||||
|
|
@ -19,8 +24,34 @@ public class OfficerAbilities : MonoBehaviour
|
|||
currentKills = Mathf.Clamp(currentKills, 0, killQuota);
|
||||
}
|
||||
}
|
||||
private void UpdateRounds()
|
||||
{
|
||||
if (roundsRemaining > 0)
|
||||
{
|
||||
roundsRemaining--;
|
||||
if (roundsRemaining <= 0)
|
||||
{
|
||||
DeactivateAbility();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ActivateAbility()
|
||||
{
|
||||
if (currentKills >= killQuota)
|
||||
{
|
||||
currentKills = 0;
|
||||
roundsRemaining = abilityLength;
|
||||
AbilityEffects();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void AbilityEffects()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void DeactivateAbility()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
26
Assets/Scripts/OfficerReload.cs
Normal file
26
Assets/Scripts/OfficerReload.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class OfficerReload : OfficerAbilities
|
||||
{
|
||||
protected override void AbilityEffects()
|
||||
{
|
||||
foreach (PlayerEntity player in TurnHandler.instance.playerEntities)
|
||||
{
|
||||
if (player.currentWeapon.TryGetComponent(out RangedWeapon isRanged) && isRanged)
|
||||
{
|
||||
isRanged.reloadActionUsage = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DeactivateAbility()
|
||||
{
|
||||
foreach (PlayerEntity player in TurnHandler.instance.playerEntities)
|
||||
{
|
||||
if (player.currentWeapon.TryGetComponent(out RangedWeapon isRanged) && isRanged)
|
||||
{
|
||||
isRanged.reloadActionUsage = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/OfficerReload.cs.meta
Normal file
2
Assets/Scripts/OfficerReload.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0704cc1c95eb8482f875e76ed2431f51
|
||||
|
|
@ -57,6 +57,7 @@ public class RangedWeapon : Weapon
|
|||
Projectile newProjectile = Instantiate(projectile, transform.position, Quaternion.identity);
|
||||
newProjectile.RotateToTarget(target);
|
||||
newProjectile.damage = damage;
|
||||
newProjectile.pierceAmount = pierce;
|
||||
newProjectile.tag = tag;
|
||||
newProjectile.fromEntity = thisEntity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public class TurnHandler : MonoBehaviour
|
|||
[SerializeField] private int amountToSpawn;
|
||||
[SerializeField] private float exponentIncrease;
|
||||
private int currentWave = 1;
|
||||
public static event Action waveUpdate;
|
||||
|
||||
private void SortEnemies()
|
||||
{
|
||||
|
|
@ -85,6 +86,7 @@ public class TurnHandler : MonoBehaviour
|
|||
private void EndRound()
|
||||
{
|
||||
EnvironmentTurn();
|
||||
waveUpdate?.Invoke();
|
||||
currentEnemy = 0;
|
||||
currentGameState = GameState.PlayerTurn;
|
||||
foreach (PlayerEntity player in playerEntities)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ public class Weapon : MonoBehaviour
|
|||
|
||||
[Header("Stats")]
|
||||
public float damage;
|
||||
public int pierce;
|
||||
|
||||
public virtual void TryAttack()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue