Galaxy Generator

This commit is contained in:
mkadou
2023-06-05 15:34:37 +02:00
parent ec4cda81e9
commit 3db8cc2930
195 changed files with 47018 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class SolarSystemManager : MonoBehaviour
{
public GameObject[] objectsToDeactivate;
public GameObject[] objectsToActivate;
public float Industry;
public float Wealth;
public float Science;
public float Food;
public float MilitaryPower;
public float Population;
public float ActualFood;
public Text[] texts; // Array der Text-Objekte
private float[] Array = new float[7];
// Start is called before the first frame update
void Start()
{
for (int i = 0; i < objectsToDeactivate.Length; i++)
{
objectsToDeactivate[i].SetActive(false); // deactivate the game object
}
for (int i = 0; i < objectsToActivate.Length; i++)
{
objectsToActivate[i].SetActive(true); // activate the game object
}
Array[0]= Industry;
Array[1]= Wealth;
Array[2]= Science;
Array[3]= Food;
Array[4]= MilitaryPower;
Array[5]= Population;
Array[6]= ActualFood;
}
public void SetPositionCenter()
{
transform.position = new Vector3(604.75f, 252.75f, 0f);
}
void Update()
{
Array[0] += Industry;
Array[1] = Wealth;
Array[2] = Science;
Array[3] = Food;
Array[4] = MilitaryPower;
Array[5] = Population;
Array[6] = ActualFood;
for (int i = 0; i < 7; i++)
{
float temp = Array[i];
if (temp / 1000000 >= 1)
{
temp /= 1000000;
texts[i].text = ((int)temp).ToString() + " M";
}
else if (temp / 1000 >= 1)
{
temp /= 1000;
texts[i].text = ((int)temp).ToString() + " K";
}
else
{
texts[i].text = Array[i].ToString();
}
}
}
}