summaryrefslogtreecommitdiff
path: root/Thronefall_1_57/Thronefall/Thronefall/WeaponEquipper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Thronefall_1_57/Thronefall/Thronefall/WeaponEquipper.cs')
-rw-r--r--Thronefall_1_57/Thronefall/Thronefall/WeaponEquipper.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/Thronefall_1_57/Thronefall/Thronefall/WeaponEquipper.cs b/Thronefall_1_57/Thronefall/Thronefall/WeaponEquipper.cs
new file mode 100644
index 0000000..cbaff00
--- /dev/null
+++ b/Thronefall_1_57/Thronefall/Thronefall/WeaponEquipper.cs
@@ -0,0 +1,37 @@
+using UnityEngine;
+
+public class WeaponEquipper : MonoBehaviour
+{
+ public Equippable requiredWeapon;
+
+ public ManualAttack activeWeapon;
+
+ public ManualAttack passiveWeapon;
+
+ public GameObject visuals;
+
+ public PlayerAttackTargetFacer facer;
+
+ private void Start()
+ {
+ if (!PerkManager.IsEquipped(requiredWeapon))
+ {
+ Object.Destroy(base.gameObject);
+ return;
+ }
+ GetComponentInParent<PlayerInteraction>().EquipWeapon(activeWeapon, passiveWeapon);
+ GetComponentInParent<PlayerUpgradeManager>();
+ GetComponentInParent<PlayerAttack>().AssignManualAttack(activeWeapon);
+ base.gameObject.AddComponent<PlayerWeaponVisuals>().Init(visuals, passiveWeapon);
+ facer.AssignAttack(passiveWeapon);
+ Object.Destroy(this);
+ if (PerkManager.instance.LightMaterialsEquipped)
+ {
+ RoyalForgeUpgrade.AutoAttackMulti(PerkManager.instance.lightMaterialsCooldownMulti);
+ }
+ if (PerkManager.instance.SpellScrollActive)
+ {
+ RoyalForgeUpgrade.ManualAttackMulti(PerkManager.instance.spellScrollActiveCooldownMulti);
+ }
+ }
+}