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
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue