67 lines
2.3 KiB
C#
67 lines
2.3 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
|
|
public class MarisaAbilityHandler : MonoBehaviour
|
|
{
|
|
[SerializeField] private PlayerInput inputHandler;
|
|
[SerializeField] private Marisa thisPlayer;
|
|
[Header("Abilities")] //maybe have to make them public for when you're changing out abilities
|
|
[SerializeField] private PlayerAbility mainAttack;
|
|
[SerializeField] private PlayerAbility secondaryAttack;
|
|
[SerializeField] private PlayerAbility spellA;
|
|
[SerializeField] private PlayerAbility spellB;
|
|
|
|
[Header("Ability Instances")]
|
|
public PlayerAbility mainAttackInstance;
|
|
public PlayerAbility secondaryAttackInstance;
|
|
public PlayerAbility spellAInstance;
|
|
public PlayerAbility spellBInstance;
|
|
|
|
[Header("UI")]
|
|
public AbilityHotbarIcon mainIcon;
|
|
public AbilityHotbarIcon secondaryIcon;
|
|
public AbilityHotbarIcon spellAIcon;
|
|
public AbilityHotbarIcon spellBIcon;
|
|
//this is getting ridiculous
|
|
|
|
private void Awake()
|
|
{
|
|
mainAttackInstance = Instantiate(mainAttack, transform);
|
|
mainAttackInstance.thisPlayer = thisPlayer;
|
|
mainIcon.UpdateAbility(mainAttackInstance);
|
|
secondaryAttackInstance = Instantiate(secondaryAttack, transform);
|
|
secondaryAttackInstance.thisPlayer = thisPlayer;
|
|
secondaryIcon.UpdateAbility(secondaryAttackInstance);
|
|
spellAInstance = Instantiate(spellA, transform);
|
|
spellAInstance.thisPlayer = thisPlayer;
|
|
spellAIcon.UpdateAbility(spellAInstance);
|
|
spellBInstance = Instantiate(spellB, transform);
|
|
spellBInstance.thisPlayer = thisPlayer;
|
|
spellBIcon.UpdateAbility(spellBInstance);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (inputHandler.actions["MainAttack"].inProgress)
|
|
{
|
|
mainAttackInstance.TryAbility();
|
|
mainIcon.UpdateCooldown();
|
|
}
|
|
else if (inputHandler.actions["SecondaryAttack"].inProgress)
|
|
{
|
|
secondaryAttackInstance.TryAbility();
|
|
secondaryIcon.UpdateCooldown();
|
|
}
|
|
else if (inputHandler.actions["SpellA"].inProgress)
|
|
{
|
|
spellAInstance.TryAbility();
|
|
spellAIcon.UpdateCooldown();
|
|
}
|
|
else if (inputHandler.actions["SpellB"].inProgress)
|
|
{
|
|
spellBInstance.TryAbility();
|
|
spellBIcon.UpdateCooldown();
|
|
}
|
|
}
|
|
}
|