void Update() { if (Application.isPlaying) { RequestRepaint(); if (nodeEditorPanel != null && previousSelectedGameObject != null) { nodeEditorPanel.Update(currentConstellation.Constellation); } var selectedGameObjects = Selection.gameObjects; if (selectedGameObjects.Length == 0 || selectedGameObjects[0] == previousSelectedGameObject) { return; } var selectedConstellation = selectedGameObjects[0].GetComponent <ConstellationBehaviour> () as ConstellationBehaviour; if (selectedConstellation != null) { currentConstellation = selectedConstellation; previousSelectedGameObject = selectedGameObjects[0]; Open(AssetDatabase.GetAssetPath(selectedConstellation.ConstellationData)); } } }
public override void OnInspectorGUI() { ConstellationBehaviour = (ConstellationBehaviour)target; if (ConstellationBehaviour == null) { return; } if (ConstellationBehaviour.ConstellationData != null) { source = ConstellationBehaviour.ConstellationData; } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Script", GUILayout.MaxWidth(100)); source = EditorGUILayout.ObjectField(source, typeof(ConstellationScript), true); ConstellationBehaviour.ConstellationData = source as ConstellationScript; NodeData[] nodes = null; if (ConstellationBehaviour.ConstellationData != null) { nodes = ConstellationBehaviour.ConstellationData.GetNodes(); ConstellationBehaviour.UpdateAttributes(nodes); } EditorGUILayout.EndHorizontal(); if (ConstellationBehaviour.Attributes == null) { return; } for (var i = 0; i < ConstellationBehaviour.Attributes.Count; i++) { var attribute = ConstellationBehaviour.Attributes[i]; if (attribute.AttributeType == BehaviourAttribute.Type.Value) { UpdateValueAttribute(attribute, i); } else if (attribute.AttributeType == BehaviourAttribute.Type.Word) { attribute.Variable.Set(EditorGUILayout.TextField(ConstellationBehaviour.Attributes[i].Name, ConstellationBehaviour.Attributes[i].Variable.GetString())); } else if (attribute.AttributeType == BehaviourAttribute.Type.UnityObject) { #pragma warning disable 0618 attribute.UnityObject = (EditorGUILayout.ObjectField(ConstellationBehaviour.Attributes[i].Name, attribute.UnityObject, typeof(Object))); #pragma warning restore 0618 } } }
public void InitiliaseLevelUI(LevelManager _lmScript) { lmScript = _lmScript; cbScript = _lmScript.transform.GetChild(0).GetComponent<ConstellationBehaviour>(); int _starCount = 0; foreach(Image star in stars) { Text _pointsNeeded = star.transform.parent.GetChild(1).GetComponent<Text>(); _pointsNeeded.text = (lmScript.scoreTiers[_starCount] * 100).ToString(); _starCount++; } overlayImage.enabled = true; levelTitleText.text = _lmScript.levelName; levelStartUI.Play("MainButtonIn"); }
void InitialValues() { uiScript = GameObject.Find("UIManager").GetComponent<UIManager>(); uiScript.InitiliaseLevelUI(this.GetComponent<LevelManager>()); cbScript = transform.GetChild(0).GetComponent<ConstellationBehaviour>(); foreach(GameObject star in stars) { star.GetComponent<StarBaseClass>().FreezePosition(); if(star.tag == "SequenceStar") { numOfSequenceStars += 1; } } starHolders = GameObject.FindGameObjectsWithTag("StarHolder"); }
void InitialValues() { uiScript = GameObject.Find("UIManager").GetComponent <UIManager>(); uiScript.InitiliaseLevelUI(this.GetComponent <LevelManager>()); cbScript = transform.GetChild(0).GetComponent <ConstellationBehaviour>(); foreach (GameObject star in stars) { star.GetComponent <StarBaseClass>().FreezePosition(); if (star.tag == "SequenceStar") { numOfSequenceStars += 1; } } starHolders = GameObject.FindGameObjectsWithTag("StarHolder"); }
public void InitiliaseLevelUI(LevelManager _lmScript) { lmScript = _lmScript; cbScript = _lmScript.transform.GetChild(0).GetComponent <ConstellationBehaviour>(); int _starCount = 0; foreach (Image star in stars) { Text _pointsNeeded = star.transform.parent.GetChild(1).GetComponent <Text>(); _pointsNeeded.text = (lmScript.scoreTiers[_starCount] * 100).ToString(); _starCount++; } overlayImage.enabled = true; levelTitleText.text = _lmScript.levelName; levelStartUI.Play("MainButtonIn"); }