blob: 149f4c8a1b28372690c498461045454c6471cf63 (
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
|
using System;
using UnityEngine;
public class DotAligner : MonoBehaviour
{
public float Width = 2f;
public bool Even;
public void Start()
{
int num = 0;
for (int i = 0; i < base.transform.childCount; i++)
{
if (base.transform.GetChild(i).gameObject.activeSelf)
{
num++;
}
}
float num2;
float num3;
if (this.Even)
{
num2 = -this.Width * (float)(num - 1) / 2f;
num3 = this.Width;
}
else
{
num2 = -this.Width / 2f;
num3 = this.Width / (float)(num - 1);
}
int num4 = 0;
for (int j = 0; j < base.transform.childCount; j++)
{
Transform child = base.transform.GetChild(j);
if (child.gameObject.activeSelf)
{
child.transform.localPosition = new Vector3(num2 + (float)num4 * num3, 0f, 0f);
num4++;
}
}
}
}
|