void Start() { Buttons_List = GameObject.FindGameObjectsWithTag("Button"); foreach (GameObject Button in Buttons_List) { Button.AddComponent(typeof(AudioSource)); Button.GetComponent <AudioSource>().clip = ButtonSound; } StartCoroutine(PushButtons()); }
public ButtonBuilder Animation(Color idle, Color highlighted, Color clicked, Color?toggled = null, float transition = 0.333f) { button.RemoveComponentsOfType <UIColorAnimator>(); UIColorAnimator animator = new UIColorAnimator(button.Background); button.AddComponent(animator); animator.Configure(idle, highlighted, clicked, toggled, transition); return(this); }
public Entity Make(TiledObject obj, Layer layer, MapBuilder map) { var tile = (TiledTileObject)obj; // Origin point for tile object is in the bottom left corner, // but rotation point is in the center. var matrix = Matrix.CreateTranslation(new Vector3(Button.Size.X, 0, 0) / 2) * Matrix.CreateRotationZ(MathHelper.ToRadians(tile.Rotation)); var position = new Vector2(matrix.Translation.X, matrix.Translation.Y) + tile.Position; var button = new Button(position, tile.Rotation, layer); if (tile.Properties["link"] != "none") { button.AddComponent(new LinkComponent(tile.Properties["link"], true)); } return(button); }