blob: 78c92dd3b939333fd2cb477aba36f766c043ed0c (
plain)
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
|
using System;
using UnityEngine;
public class AttackLevel : MonoBehaviour
{
public int attackLevel = 1;
public float levelScaleM = 0.7f;
public Action<int> LevelUpAction;
private void Start()
{
SpawnedAttack componentInParent = GetComponentInParent<SpawnedAttack>();
if ((bool)componentInParent)
{
attackLevel = componentInParent.attackLevel;
}
bool flag = false;
AttackLevel[] componentsInChildren = base.transform.root.GetComponentsInChildren<AttackLevel>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
if (!(componentsInChildren[i] == this) && componentsInChildren[i].gameObject.name == base.gameObject.name)
{
componentsInChildren[i].LevelUp();
flag = true;
}
}
if (flag)
{
UnityEngine.Object.Destroy(base.gameObject);
}
}
public float LevelScale()
{
return 1f + ((float)attackLevel - 1f) * levelScaleM;
}
public int LevelsUp()
{
return attackLevel - 1;
}
public void LevelUp()
{
attackLevel++;
if (LevelUpAction != null)
{
LevelUpAction(attackLevel);
}
}
}
|