-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sectumsempra.cs
65 lines (54 loc) · 2.13 KB
/
Sectumsempra.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThunderRoad;
using UnityEngine;
namespace WandSpellss
{
class Sectumsempra : MonoBehaviour
{
public static SpellType spellType = SpellType.Shoot;
}
public class SectumsempraHandler : Spell
{
public static SpellType spellType = SpellType.Shoot;
private float sectumPower = 100f;
public override Spell AddGameObject(GameObject gameObject)
{
throw new NotImplementedException();
}
public override void SpawnSpell(Type type, string name, Item wand, float spellSpeed)
{
try
{
Catalog.GetData<ItemData>(name + "Object")?.SpawnAsync(projectile =>
{
projectile.gameObject.AddComponent(type);
projectile.transform.position = wand.flyDirRef.transform.position;
projectile.IgnoreObjectCollision(wand);
projectile.IgnoreRagdollCollision(Player.currentCreature.ragdoll);
projectile.Throw();
projectile.physicBody.rigidBody.useGravity = false;
projectile.physicBody.rigidBody.drag = 0.0f;
foreach (AudioSource c in wand.GetComponentsInChildren<AudioSource>())
{
if (c.name == name) c.Play();
}
projectile.GetComponent<Rigidbody>().AddForce(wand.flyDirRef.forward * sectumPower, ForceMode.Impulse);
projectile.gameObject.AddComponent<SpellDespawn>();
});
}
catch (NullReferenceException e) { Debug.Log(e.Message);}
}
public override void UpdateSpell(Type type, string name, Item wand)
{
throw new NotImplementedException();
}
public override void UpdateSpell(Type type, string name, Item wand, String itemType)
{
throw new NotImplementedException();
}
}
}