-
Notifications
You must be signed in to change notification settings - Fork 0
/
Spell.cs
55 lines (45 loc) · 1.36 KB
/
Spell.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
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public enum SpellType {
Fire,
Water,
Nature,
Arcane,
Holy,
Shadow
}
public class Spell : MonoBehaviour {
public static Spell instance { get; private set; }
[System.Serializable]
public class Effects
{
public SpellType type;
public GameObject normal;
public GameObject super;
public GameObject hit;
}
public Effects[] effects = new Effects[System.Enum.GetValues(typeof(SpellType)).Length];
public List<SpellType> active = new List<SpellType>();
public void Cast(int type) {
// a square was formed
if (Game.isSuper) {
GameObject effect = CFX_SpawnSystem.GetNextObject(effects[type].super);
} else { // normal spell
GameObject effect = CFX_SpawnSystem.GetNextObject(effects[type].normal);
}
}
public void Hit(int type) {
GameObject effect = CFX_SpawnSystem.GetNextObject(effects[type].hit);
// effect.transform.position = Enemy.instance.transform.position;
}
void Awake() {
// singleton
instance = this;
// add currently active spell types
active.Add(SpellType.Fire);
active.Add(SpellType.Water);
active.Add(SpellType.Nature);
// active.Add(SpellType.Arcane);
}
}