Skip to content

Instantly share code, notes, and snippets.

@gotwig
Created July 7, 2015 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gotwig/af6b5e0af86a98bc7fe8 to your computer and use it in GitHub Desktop.
Save gotwig/af6b5e0af86a98bc7fe8 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Collections.Generic;
public class logicWindow : MonoBehaviour {
public GameObject cloneBasis;
public Sprite deductionTexture;
List<LogicFraDia.logicFragment> logicFragments;
List<LogicFraDia.logicDeduction> logicDeductions;
List<GameObject> ClonedObjects;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
foreach (GameObject x in ClonedObjects){
Destroy (x);
}
logicFragments = LogicFraDia.instance.returnFragments (true);
logicDeductions = LogicFraDia.instance.returnDeductions (true);
foreach (LogicFraDia.logicFragment x in logicFragments) {
GameObject clonedObject = Instantiate(cloneBasis, cloneBasis.transform.position, cloneBasis.transform.rotation) as GameObject;
ClonedObjects.Add (clonedObject);
clonedObject.transform.SetParent(gameObject.transform);
clonedObject.transform.localScale = cloneBasis.transform.localScale;
clonedObject.transform.Find("Background").transform.Find("Label").GetComponent<Text>().text = x.name;
}
foreach (LogicFraDia.logicDeduction x in logicDeductions) {
GameObject clonedObject = Instantiate(cloneBasis, cloneBasis.transform.position, cloneBasis.transform.rotation) as GameObject;
ClonedObjects.Add (clonedObject);
clonedObject.transform.SetParent(gameObject.transform);
clonedObject.transform.localScale = cloneBasis.transform.localScale;
clonedObject.transform.Find("Background").transform.Find("type").GetComponent<Image>().sprite = deductionTexture;
clonedObject.transform.Find("Background").transform.Find("Label").GetComponent<Text>().text = x.name;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment