my HEAD hurts and the SFX is TOO LOUD
This commit is contained in:
parent
a3321d361c
commit
d4ebf0ca61
41 changed files with 1465 additions and 123 deletions
|
|
@ -7,27 +7,14 @@ public class AbilityHotbarIcon : MonoBehaviour, IPointerEnterHandler, IPointerEx
|
|||
{
|
||||
public Transform cooldownBar;
|
||||
[SerializeField] private TextMeshProUGUI text;
|
||||
private bool onCooldown;
|
||||
private PlayerAbility thisAbility;
|
||||
[SerializeField] private FloatingAbilityInfo infoUI;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (onCooldown)
|
||||
if (thisAbility.currentCooldown > 0f || cooldownBar.localScale.x < 1f)
|
||||
{
|
||||
cooldownBar.localScale = new Vector3(Math.Clamp(1 - thisAbility.currentCooldown/thisAbility.cooldown, 0, 1), 1, 1);
|
||||
if (thisAbility.currentCooldown <= 0)
|
||||
{
|
||||
onCooldown = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateCooldown()
|
||||
{
|
||||
if (thisAbility.currentCooldown > 0)
|
||||
{
|
||||
onCooldown = true;
|
||||
cooldownBar.localScale = new Vector3(Math.Clamp(1f - thisAbility.currentCooldown/thisAbility.cooldown, 0f, 1f), 1f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,10 +15,19 @@ public class Laser : PlayerAbility
|
|||
private BeamCollider beamObjectInstance;
|
||||
public float turnSpeed;
|
||||
public float offset;
|
||||
[SerializeField] private AudioClip beamSFX;
|
||||
[SerializeField] private float beamVolume = 1;
|
||||
|
||||
[Header("Weapon Properties")]
|
||||
[HideInInspector] public List<Entity> enemyList = new();
|
||||
public float damageDebounceTime;
|
||||
protected float currentDebounce;
|
||||
[Header("Charge")]
|
||||
public float chargeTime;
|
||||
protected float currentCharge;
|
||||
[Header("Effects")]
|
||||
[SerializeField] private CameraShake camShakeScript; //optional
|
||||
|
||||
private void Start()
|
||||
{
|
||||
CreateBeam();
|
||||
|
|
@ -30,13 +39,30 @@ public class Laser : PlayerAbility
|
|||
currentDuration = duration;
|
||||
currentCooldown = cooldown;
|
||||
currentDebounce = damageDebounceTime;
|
||||
beamObjectInstance.gameObject.SetActive(true);
|
||||
transform.Lookat2D(thisPlayer.mouseWorldPos);
|
||||
currentCharge = chargeTime;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if (currentCharge >= 0 && currentDuration > 0)
|
||||
{
|
||||
currentCharge -= Time.deltaTime;
|
||||
if (currentCharge < 0)
|
||||
{
|
||||
AbilityManager.instance.player.thisPlayer.entityAS.PlayOneShot(beamSFX, beamVolume);
|
||||
beamObjectInstance.gameObject.SetActive(true);
|
||||
transform.Lookat2D(thisPlayer.mouseWorldPos);
|
||||
if (camShakeScript)
|
||||
{
|
||||
camShakeScript.ShakeCamera(currentDuration);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (currentDuration > 0)
|
||||
{
|
||||
Vector3 direction = (thisPlayer.mouseWorldPos - (Vector2)transform.position).normalized;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ public class PlayerAbility : MonoBehaviour
|
|||
public int baseProjectileCount;
|
||||
public int projectileCount;
|
||||
public Dictionary<AbilityUpgrade, int> attachedUpgrades = new();
|
||||
[Header("SFX")]
|
||||
[SerializeField] private AudioClip useAbilitySFX;
|
||||
[SerializeField] private float volume = 1;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
|
@ -34,6 +37,7 @@ public class PlayerAbility : MonoBehaviour
|
|||
if (currentCooldown <= 0 && canCooldown)
|
||||
{
|
||||
currentCooldown = cooldown;
|
||||
AbilityManager.instance.player.thisPlayer.entityAS.PlayOneShot(useAbilitySFX, volume);
|
||||
AbilityEffects();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
24
Assets/Scripts/CameraShake.cs
Normal file
24
Assets/Scripts/CameraShake.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using Unity.Cinemachine;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraShake : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private CinemachineImpulseSource impulseSource;
|
||||
[SerializeField] private float cameraShakeForce;
|
||||
private float currentDuration;
|
||||
|
||||
public void ShakeCamera(float duration)
|
||||
{
|
||||
currentDuration = duration;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (currentDuration > 0)
|
||||
{
|
||||
currentDuration -= Time.deltaTime;
|
||||
impulseSource.DefaultVelocity = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), 0f);
|
||||
impulseSource.GenerateImpulse(cameraShakeForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/CameraShake.cs.meta
Normal file
2
Assets/Scripts/CameraShake.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1451ffc8332d519f59ce36448e28604a
|
||||
|
|
@ -118,6 +118,7 @@ public class Enemy : Entity
|
|||
protected override void OnKillEffects()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
OnKill?.Invoke();
|
||||
foreach (UpgradeDrop drop in possibleDrops)
|
||||
{
|
||||
DropUpgrade(drop);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ public class EnemySpawner : MonoBehaviour
|
|||
public List<Transform> spawnPoints;
|
||||
public float spawnRate;
|
||||
[SerializeField] private float currentSpawnTime;
|
||||
[Header("Boss")]
|
||||
[Header("Boss")]
|
||||
private bool bossSpawned = false;
|
||||
public Enemy bossEnemy;
|
||||
private Enemy bossEnemyInstance;
|
||||
public Transform bossSpawnPoint;
|
||||
|
|
@ -54,14 +55,14 @@ public class EnemySpawner : MonoBehaviour
|
|||
SpawnEnemy(enemiesToSpawn[Random.Range(0, enemiesToSpawn.Length)], spawnPoints[Random.Range(0, spawnPoints.Count)].position);
|
||||
}
|
||||
}
|
||||
else if (!canSpawn && bossEnemy.health < 0)
|
||||
else if (bossSpawned && !bossEnemyInstance)
|
||||
{
|
||||
if (Input.GetKey(KeyCode.E))
|
||||
{
|
||||
LevelSwitcher.instance.LoadShop();
|
||||
}
|
||||
}
|
||||
enemyLevel = (int)(Time.time / levelUpIntervals); //figure out the time.time thing because that's not gonna work here
|
||||
enemyLevel = (int)(Time.time / levelUpIntervals) + 1; //figure out the time.time thing because that's not gonna work here
|
||||
}
|
||||
|
||||
public Enemy SpawnEnemy(Enemy enemy, Vector3 location)
|
||||
|
|
@ -79,6 +80,7 @@ public class EnemySpawner : MonoBehaviour
|
|||
canSpawn = false;
|
||||
Enemy.OnDamaged += UpdateBossHealthBar; //this kinda sucks but it technically works??
|
||||
bossNameText.text = bossEnemyInstance.entityName;
|
||||
bossSpawned = true;
|
||||
}
|
||||
|
||||
private void UpdateBossHealthBar()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ public class Entity : MonoBehaviour
|
|||
[Header("Identification")]
|
||||
public string entityName;
|
||||
public SpriteRenderer sprite;
|
||||
public AudioSource entityAS;
|
||||
[Header("Flags")]
|
||||
public bool stalled;
|
||||
public bool invincible;
|
||||
|
|
@ -20,6 +21,10 @@ public class Entity : MonoBehaviour
|
|||
protected Vector2 moveDirection;
|
||||
public float speed;
|
||||
public float speedMultiplier = 1f;
|
||||
[Header("FX")]
|
||||
[SerializeField] private EntityDeathSFX deathObject;
|
||||
[SerializeField] private AudioClip deathSound;
|
||||
[SerializeField] private float deathVolume = 1;
|
||||
|
||||
protected void FlipSprite(Vector2 lookDirection)
|
||||
{
|
||||
|
|
@ -47,6 +52,8 @@ public class Entity : MonoBehaviour
|
|||
health -= damage;
|
||||
if (health < 0)
|
||||
{
|
||||
EntityDeathSFX newSFX = Instantiate(deathObject, transform.position, transform.rotation);
|
||||
newSFX.PlaySFX(deathSound, deathVolume);
|
||||
OnKillEffects();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20
Assets/Scripts/Entities/EntityDeathSFX.cs
Normal file
20
Assets/Scripts/Entities/EntityDeathSFX.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class EntityDeathSFX : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AudioSource AS;
|
||||
|
||||
public void PlaySFX(AudioClip audioToPlay, float volume)
|
||||
{
|
||||
AS.PlayOneShot(audioToPlay, volume);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!AS.isPlaying)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Entities/EntityDeathSFX.cs.meta
Normal file
2
Assets/Scripts/Entities/EntityDeathSFX.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ffa63eeffdadeda86b3db6f9f6b15cde
|
||||
|
|
@ -6,7 +6,7 @@ using UnityEngine.InputSystem;
|
|||
public class MarisaAbilityHandler : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private PlayerInput inputHandler;
|
||||
[SerializeField] private Marisa thisPlayer;
|
||||
public Marisa thisPlayer;
|
||||
|
||||
[Header("Abilities")] //maybe have to make them public for when you're changing out abilities
|
||||
public List<PlayerAbility> abilities = new();
|
||||
|
|
@ -18,17 +18,11 @@ public class MarisaAbilityHandler : MonoBehaviour
|
|||
public AbilityHotbarIcon[] hotbarIcons;
|
||||
//this is getting ridiculous
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
SetupAbilities();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
hotbarIcons = FindObjectsByType<AbilityHotbarIcon>(FindObjectsSortMode.InstanceID);
|
||||
if (AbilitySceneTransfer.instance.savedAbilities.Count > 0)
|
||||
if (hotbarIcons[0] != null) //bad
|
||||
{
|
||||
LevelSwitcher.instance.SetupScene();
|
||||
SetupAbilities();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,22 +51,18 @@ public class MarisaAbilityHandler : MonoBehaviour
|
|||
if (inputHandler.actions["MainAttack"].inProgress)
|
||||
{
|
||||
abilityInstances[0].TryAbility();
|
||||
hotbarIcons[0].UpdateCooldown();
|
||||
}
|
||||
else if (inputHandler.actions["SecondaryAttack"].inProgress)
|
||||
{
|
||||
abilityInstances[1].TryAbility();
|
||||
hotbarIcons[1].UpdateCooldown();
|
||||
}
|
||||
else if (inputHandler.actions["SpellA"].inProgress)
|
||||
{
|
||||
abilityInstances[2].TryAbility();
|
||||
hotbarIcons[2].UpdateCooldown();
|
||||
}
|
||||
else if (inputHandler.actions["SpellB"].inProgress)
|
||||
{
|
||||
abilityInstances[3].TryAbility();
|
||||
hotbarIcons[3].UpdateCooldown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ShopManager : MonoBehaviour
|
||||
{
|
||||
|
|
@ -20,12 +22,26 @@ public class ShopManager : MonoBehaviour
|
|||
|
||||
#endregion
|
||||
public List<AbilityUpgrade> buyableUpgrades;
|
||||
[SerializeField] private int maxBuyables;
|
||||
public int currency; //uh. we need to figure out this one lol
|
||||
public GameObject shopUIObject;
|
||||
[SerializeField] private Marisa player;
|
||||
[Header("UI")]
|
||||
public Transform upgradeListUI;
|
||||
public Button templateUpgradeButton;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
GenerateUpgradeList();
|
||||
}
|
||||
|
||||
public void GenerateUpgradeList()
|
||||
{
|
||||
|
||||
foreach (AbilityUpgrade upgrade in buyableUpgrades)
|
||||
{
|
||||
Button newButton = Instantiate(templateUpgradeButton, upgradeListUI);
|
||||
newButton.onClick.AddListener(() => BuyUpgrade(upgrade));
|
||||
}
|
||||
}
|
||||
|
||||
public void BuyUpgrade(AbilityUpgrade abilityToBuy)
|
||||
|
|
@ -55,4 +71,27 @@ public class ShopManager : MonoBehaviour
|
|||
shopUIObject.SetActive(false);
|
||||
player.stalled = false;
|
||||
}
|
||||
|
||||
public void UpgradesMenu()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SellMenu()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void TalkMenu()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ClearInventoryUI()
|
||||
{
|
||||
foreach (Transform child in upgradeListUI)
|
||||
{
|
||||
Destroy(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
23
Assets/Scripts/UILoader.cs
Normal file
23
Assets/Scripts/UILoader.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class UILoader : MonoBehaviour
|
||||
{
|
||||
private MarisaAbilityHandler marisa;
|
||||
[SerializeField] private AbilityHotbarIcon[] hotbarIcons;
|
||||
private void Awake()
|
||||
{
|
||||
marisa = FindFirstObjectByType<MarisaAbilityHandler>();
|
||||
marisa.hotbarIcons = hotbarIcons;
|
||||
if (AbilitySceneTransfer.instance.savedAbilities.Count > 0)
|
||||
{
|
||||
LevelSwitcher.instance.SetupScene();
|
||||
}
|
||||
marisa.SetupAbilities();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UILoader.cs.meta
Normal file
2
Assets/Scripts/UILoader.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c72ac6493c39161ddb1a803266ecd7ea
|
||||
Loading…
Add table
Add a link
Reference in a new issue