void Start() { target = new GameObject(); targetInfo = new GameplayObjectInfo(); children = new List<GameObject>(); foreach (Transform obj in transform) children.Add(obj.gameObject); }
// Update is called once per frame void Update() { target = StaticInformation.playersTarget; if (StaticInformation.playersLock != null) target = StaticInformation.playersLock; targetInfo = target.GetComponent<GameplayObjectInfo>(); if (targetInfo) { GetComponent<Image>().fillAmount = targetInfo.currentShield / targetInfo.maxShield; } else GetComponent<Image>().fillAmount = 0.0f; }
void Update() { target = StaticInformation.playersTarget; if (StaticInformation.playersLock != null) target = StaticInformation.playersLock; targetInfo = target.GetComponent<GameplayObjectInfo>(); if (!targetInfo) foreach (GameObject obj in children) obj.SetActive(false); else foreach (GameObject obj in children) obj.SetActive(true); /// LOL I like when dumb ideas work... }
// Update is called once per frame void Update() { target = StaticInformation.playersTarget; if (StaticInformation.playersLock != null) target = StaticInformation.playersLock; targetInfo = target.GetComponent<GameplayObjectInfo>(); if (targetInfo) { GetComponent<Text>().text = targetInfo.name; //Debug.Log("True"); } else GetComponent<Text>().text = " "; }
// Use this for initialization void Start() { // Find a better way than tag whoreing dumpEnemyWaypoints = GameObject.FindGameObjectWithTag("EnemyWaypoints"); target = GameObject.FindGameObjectWithTag("Target"); dumpSpawn = GameObject.FindGameObjectWithTag("EnemySpawner"); info = GetComponent<GameplayObjectInfo>(); waypoint = new GameObject(); enemyWaypoits = new List<GameObject>(); foreach (Transform obj in dumpEnemyWaypoints.transform) enemyWaypoits.Add(obj.gameObject); spawnLocations = new List<GameObject>(); foreach (Transform obj in dumpSpawn.transform) spawnLocations.Add(obj.gameObject); int rand = Random.Range(0, 3); transform.position = spawnLocations[rand].transform.position; int idx = Random.Range(0, enemyWaypoits.Count - 1); waypoint = enemyWaypoits[idx]; }
// Use this for initialization void Start() { target = new GameObject(); targetInfo = new GameplayObjectInfo(); }