-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDaggerElementalMerge.cs
42 lines (38 loc) · 1.36 KB
/
DaggerElementalMerge.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThunderRoad;
using UnityEngine;
namespace DaggerBending {
class DaggerElementalMerge : SpellMergeData {
public DaggerController controller;
public float lastImbueTime = 0;
public float imbueDelay = 0.1f;
public bool active;
public SpellCaster daggerCaster;
public SpellCaster otherCaster;
public override void Load(Mana mana) {
base.Load(mana);
controller = Player.currentCreature.mana.gameObject.GetComponent<DaggerController>();
}
public override void Merge(bool active) {
base.Merge(active);
this.active = active;
if (active) {
daggerCaster = (mana.casterLeft.spellInstance is SpellDagger) ? mana.casterLeft : mana.casterRight;
otherCaster = daggerCaster.ragdollHand.otherHand.caster;
}
}
public override void Update() {
base.Update();
if (Time.time - lastImbueTime > imbueDelay) {
if (otherCaster && otherCaster.spellInstance is SpellCastCharge spell) {
controller.ImbueRandomDagger(spell, mana.mergePoint);
lastImbueTime = Time.time;
}
}
}
}
}