-
Notifications
You must be signed in to change notification settings - Fork 0
/
Geminiocs.cs
102 lines (87 loc) · 3.78 KB
/
Geminiocs.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
100
101
102
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using ThunderRoad;
namespace WandSpellss
{
class Geminio : MonoBehaviour
{
Item item;
internal GameObject parentLocal;
internal bool cantEvanesco;
GameObject duplicate;
System.Random random;
ItemData copyData;
public static SpellType spellType = SpellType.Raycast;
public void Start()
{
item = GetComponent<Item>();
random = new System.Random();
CastRay();
}
internal void CastRay()
{
RaycastHit hit;
Transform parent;
if (Physics.Raycast(item.flyDirRef.transform.position, item.flyDirRef.transform.forward, out hit, float.MaxValue, Physics.DefaultRaycastLayers, QueryTriggerInteraction.Ignore))
{
parent = hit.collider.gameObject.transform.parent;
parentLocal = parent.gameObject;
if (parentLocal.GetComponent<Item>() is Item item)
{
copyData = item.data;
copyData.SpawnAsync(copy => {
double range = -0.1 - -0.5;
double sample = random.NextDouble();
double scaled = (sample * range);
copy.transform.position = new Vector3(parent.gameObject.transform.position.x + (float)scaled, parent.gameObject.transform.position.y + (float)scaled, parent.gameObject.transform.position.z);
});
}
else if (parentLocal.GetComponentInParent<Item>() is Item item2)
{
copyData = item2.data;
copyData.SpawnAsync(copy => {
double range = -0.1 - -0.5;
double sample = random.NextDouble();
double scaled = (sample * range);
copy.transform.position = new Vector3(parent.gameObject.transform.position.x + (float)scaled, parent.gameObject.transform.position.y + (float)scaled, parent.gameObject.transform.position.z);
});
}
else if (parentLocal.GetComponentInChildren<Item>() is Item item3)
{
copyData = item3.data;
copyData.SpawnAsync(copy => {
double range = -0.1 - -0.5;
double sample = random.NextDouble();
double scaled = (sample * range);
copy.transform.position = new Vector3(parent.gameObject.transform.position.x + (float)scaled, parent.gameObject.transform.position.y + (float)scaled, parent.gameObject.transform.position.z);
});
}
}
}
}
public class GeminioHandler : 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();
}
}
}