-
Notifications
You must be signed in to change notification settings - Fork 0
/
FiniteIncantatum.cs
99 lines (74 loc) · 2.98 KB
/
FiniteIncantatum.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using ThunderRoad;
using static ThunderRoad.ItemMagicAreaProjectile;
namespace WandSpellss
{
class FiniteIncantatum : MonoBehaviour
{
public static SpellType spellType = SpellType.Raycast;
Item item;
void Start() {
item = GetComponent<Item>();
CastRay();
}
new void CastRay() {
if (Physics.Raycast(item.flyDirRef.transform.position, item.flyDirRef.transform.forward, out RaycastHit hit, float.MaxValue, Physics.DefaultRaycastLayers, QueryTriggerInteraction.Ignore)) {
if (hit.collider.GetComponentInParent<Creature>() is Creature creature && creature == Player.currentCreature)
{
foreach (Type spell in Loader.local.spellsOnPlayer)
{
Destroy(item.GetComponent(spell));
}
}
else if(hit.collider.GetComponent<Item>() is Item spellItem){
foreach (Type spellType in Loader.local.finiteSpells) {
if(spellItem.GetComponent(spellType) != null) Destroy(spellItem.gameObject);
break;
}
}
else if (hit.collider.GetComponentInChildren<Item>() is Item spellItem2)
{
foreach (Type spellType in Loader.local.finiteSpells)
{
if (spellItem2.GetComponent(spellType) != null) Destroy(spellItem2.gameObject);
break;
}
}
else if (hit.collider.GetComponentInParent<Item>() is Item spellItem3)
{
foreach (Type spellType in Loader.local.finiteSpells)
{
if (spellItem3.GetComponent(spellType) != null) Destroy(spellItem3.gameObject);
break;
}
}
}
}
}
public class FiniteIncantatumHandler : Spell
{
public static SpellType spellType = SpellType.Raycast;
public override Spell AddGameObject(GameObject gameObject)
{
throw new NotImplementedException();
}
public override void SpawnSpell(Type type, string name, Item wand, float spellSpeed)
{
throw new NotImplementedException();
}
public override void UpdateSpell(Type type, string name, Item wand)
{
if (wand.gameObject.GetComponent(type)) UnityEngine.Object.Destroy(wand.gameObject.GetComponent(type));
wand.gameObject.AddComponent(type);
}
public override void UpdateSpell(Type type, string name, Item wand, String itemType)
{
throw new NotImplementedException();
}
}
}