public override void OnInspectorGUI() { BattleTextRenderer text = target as BattleTextRenderer; if (text != null) { EditorGUILayout.LabelField("Animation Settings", EditorStyles.boldLabel); text.IsAnimated = EditorGUILayout.Toggle("Is Animated", text.IsAnimated); /* * if (text.IsAnimated) * { * text.AnimateInWorld = EditorGUILayout.Toggle("Animate In World", text.AnimateInWorld); * } */ EditorGUILayout.LabelField("Font Settings", EditorStyles.boldLabel); text.FontDefinition = (TextAsset)EditorGUILayout.ObjectField("Font Definition", text.FontDefinition, typeof(TextAsset), false); text.FontMaterial = (Material)EditorGUILayout.ObjectField("Font Material", text.FontMaterial, typeof(Material), false); text.FontDefinitionType = (BattleTextFont.DefinitionType)EditorGUILayout.EnumPopup("Font Definition Type", text.FontDefinitionType); text.GlyphSpacing = EditorGUILayout.FloatField("Glyph Spacing", text.GlyphSpacing); if (!text.IsAnimated) { text.GlyphSize = EditorGUILayout.FloatField("Glyph Size", text.GlyphSize); } if (!text.IsAnimated) { EditorGUILayout.LabelField("Orentation Settings", EditorStyles.boldLabel); text.LookAtMainCamera = EditorGUILayout.Toggle("Look at Main Camera", text.LookAtMainCamera); text.LockXRotation = EditorGUILayout.Toggle("Lock X Rotation", text.LockXRotation); } if (!text.IsAnimated) { EditorGUILayout.LabelField("Display Settings", EditorStyles.boldLabel); text.InitialText = EditorGUILayout.TextField("Default Text", text.InitialText); text.Color = EditorGUILayout.ColorField("Default Color", text.Color); text.Visible = EditorGUILayout.Toggle("Visible", text.Visible); } if (GUI.changed) { if (!Application.isPlaying) { EditorUtility.SetDirty(text); } } } }
void InitStack() { if (!stack) { GameObject stackGo = new GameObject("TextLabel"); stackGo.layer = row.Layer; stackGo.transform.parent = transform; stackGo.transform.localPosition = row.StackFontPosition + new Vector3(0, 0, -0.1f); stack = stackGo.AddComponent <BattleTextRenderer>(); stack.GlyphSize = row.StackFontSize; stack.Init(); } }
void InitLabel() { if (!label) { GameObject labelGo = new GameObject("TextLabel"); labelGo.layer = row.Layer; labelGo.transform.parent = transform; labelGo.transform.localPosition = row.LabelFontPosition + new Vector3(0, 0, -0.1f); label = labelGo.AddComponent <BattleTextRenderer>(); label.GlyphSize = row.LabelFontSize; label.Init(); } }
void InitStack() { if (!stack) { GameObject stackGo = new GameObject("TextLabel"); stackGo.layer = row.Layer; stackGo.transform.parent = transform; stackGo.transform.localPosition = row.StackFontPosition + new Vector3(0, 0, -0.1f); stack = stackGo.AddComponent<BattleTextRenderer>(); stack.GlyphSize = row.StackFontSize; stack.Init(); } }
void InitLabel() { if (!label) { GameObject labelGo = new GameObject("TextLabel"); labelGo.layer = row.Layer; labelGo.transform.parent = transform; labelGo.transform.localPosition = row.LabelFontPosition + new Vector3(0, 0, -0.1f); label = labelGo.AddComponent<BattleTextRenderer>(); label.GlyphSize = row.LabelFontSize; label.Init(); } }
static GameObject SpawnText( string text, GameObject prefab, BattleTextAnimation animation, Transform target, Vector3 targetWorldOffset, Vector2 screenPosition, Color color) { GameObject instance = (GameObject)GameObject.Instantiate(prefab); BattleTextRenderer renderer = instance.GetComponent <BattleTextRenderer>(); BattleTextAnimator animator = instance.AddComponent <BattleTextAnimator>(); if (!renderer.IsAnimated) { Debug.LogError(string.Format("[BattleTextAnimator] BattleTextRenderer script on '{0}' does not have 'Is Animated' set", prefab.name)); // Disable object instance.SetActiveRecursively(false); // Destroy it GameObject.Destroy(instance); return(null); } // Renderer settings renderer.InitialText = text; renderer.Color = color; renderer.FadeDelay = animation.FadeDelay; renderer.LockXRotation = false; renderer.LookAtMainCamera = animation.AnimateInWorld; // Animator settings animator.positions = animation.ClonePosition(); animator.Target = target; animator.Animation = animation; animator.WorldOffset = targetWorldOffset; animator.ScreenPosition = screenPosition; animator.RandomOffset = new Vector3( UnityEngine.Random.Range(-animation.RandomOffset.x, animation.RandomOffset.x), UnityEngine.Random.Range(-animation.RandomOffset.y, animation.RandomOffset.y), UnityEngine.Random.Range(-animation.RandomOffset.z, animation.RandomOffset.z) ); if (animation.HasRandomPosition) { for (int i = 0; i < animator.positions.Length; ++i) { if (animator.positions[i].Random) { Vector3 a = animator.positions[i].Amount; animator.positions[i].Amount.x = Random.Range(-a.x, a.x); animator.positions[i].Amount.y = Random.Range(-a.y, a.y); animator.positions[i].Amount.z = Random.Range(-a.z, a.z); } } } return(instance); }
void Start() { startTime = sizeAnimationStart = Time.time; textRenderer = GetComponent <BattleTextRenderer>(); }
void Start() { startTime = sizeAnimationStart = Time.time; textRenderer = GetComponent<BattleTextRenderer>(); }