public static SpriteGlobal CriarBotaoDebugar(Transform parent, Vector3 localPosition, System.Action ClickFunc) { SpriteGlobal worldSprite = new SpriteGlobal(parent, localPosition, new Vector3(10, 10), Recursos.i.spriteBranco, Color.green, sortingOrderDefault); worldSprite.AddButton(ClickFunc, null, null); return(worldSprite); }
public static SpriteGlobal CriarBotaoDebugar(Transform parent, Vector3 localPosition, string text, System.Action ClickFunc, int fontSize = 30, float paddingX = 5, float paddingY = 5) { GameObject gameObject = new GameObject("DebugButton"); gameObject.transform.parent = parent; gameObject.transform.localPosition = localPosition; TextMesh textMesh = ClasseUtilidade.CreateWorldText(text, gameObject.transform, Vector3.zero, fontSize, Color.white, TextAnchor.MiddleCenter, TextAlignment.Center, 20000); Bounds rendererBounds = textMesh.GetComponent <MeshRenderer>().bounds; Color color = ClasseUtilidade.GetColorFromString("00BA00FF"); if (color.r >= 1f) { color.r = .9f; } if (color.g >= 1f) { color.g = .9f; } if (color.b >= 1f) { color.b = .9f; } Color colorOver = color * 1.1f; // button over color lighter SpriteGlobal worldSprite = new SpriteGlobal(gameObject.transform, Vector3.zero, rendererBounds.size + new Vector3(paddingX, paddingY), Recursos.i.spriteBranco, color, sortingOrderDefault); worldSprite.AddButton(ClickFunc, () => worldSprite.SetColor(colorOver), () => worldSprite.SetColor(color)); return(worldSprite); }
public static SpriteGlobal CriarBotaoDebugar(Vector3 posicao, System.Action funcaoClick) { SpriteGlobal worldSprite = new SpriteGlobal(null, posicao, new Vector3(10, 10), Recursos.i.spriteBranco, Color.green, sortingOrderDefault); worldSprite.AddButton(funcaoClick, null, null); return(worldSprite); }