public void MechanicsButtonPress() { MovementImage.GetComponent <MeshRenderer>().enabled = true; MovementImage.GetComponent <MovieScript>().PlayMovie(); ControlsImage.SetActive(false); ModesText.SetActive(false); ShootingImage.GetComponent <MeshRenderer>().enabled = false; ShieldImage.GetComponent <MeshRenderer>().enabled = false; MeleeImage.GetComponent <MeshRenderer>().enabled = false; FlagImage.GetComponent <MeshRenderer>().enabled = false; TeamAImage.GetComponent <MeshRenderer>().enabled = false; MovementButton.SetActive(true); ShootingButton.SetActive(true); ShieldButton.SetActive(true); MeleeButton.SetActive(true); FlagButton.SetActive(true); TeamAButton.SetActive(true); MovementText.SetActive(true); ModesText.SetActive(false); ShootingText.SetActive(false); ShieldText.SetActive(false); MeleeText.SetActive(false); FlagText.SetActive(false); TeamAText.SetActive(false); }
// Sets all buttons to false and defaults to controls screen. void Start() { ControlsImage.SetActive(false); MovementImage.GetComponent <MeshRenderer>().enabled = false; ShootingImage.GetComponent <MeshRenderer>().enabled = false; ShieldImage.GetComponent <MeshRenderer>().enabled = false; MeleeImage.GetComponent <MeshRenderer>().enabled = false; FlagImage.GetComponent <MeshRenderer>().enabled = false; TeamAImage.GetComponent <MeshRenderer>().enabled = false; MovementButton.SetActive(false); ShootingButton.SetActive(false); ShieldButton.SetActive(false); MeleeButton.SetActive(false); FlagButton.SetActive(false); TeamAButton.SetActive(false); ModesText.SetActive(false); MovementText.SetActive(false); ShootingText.SetActive(false); ShieldText.SetActive(false); MeleeText.SetActive(false); FlagText.SetActive(false); TeamAText.SetActive(false); ControlsButtonPress(); }
public void AddButtons() { for (int i = 0; i < ItemList.Count; i++) { Item item = ItemList[i]; GameObject newButton = buttonObjectPool.GetObject(); newButton.transform.SetParent(contentPanel); MovementButton button = newButton.GetComponent <MovementButton>(); button.Setup(item, this); } }
private void load(ProjectEditor editor) { Masking = true; CornerRadius = 15; Height = 400; Width = 500; Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.Black, Alpha = 0.3f, }, images = new FillFlowContainer <ImageChangerButton> { Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Horizontal = 50 }, Spacing = new Vector2(100), }, arrowsContainer = new Container <MovementButton> { RelativeSizeAxes = Axes.Both, Alpha = 0, Children = new[] { leftMovementButton = new MovementButton(true) { Action = () => imagesIndex.Value--, }, rightMovementButton = new MovementButton(false) { Action = () => imagesIndex.Value++, }, }, }, }; currentEditing.BindTo(editor.CurrentEditingElement); imagesIndex.BindValueChanged(val => move(val.NewValue)); currentEditing.BindValueChanged(loadElement, true); }
void Update() { #if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WEBGL if (Input.GetKeyDown("up") && currentMoveButton == MovementButton.none) { currentMoveButton = MovementButton.up; SetFacingDirection(Direction.North); StartMoving(); } else if (Input.GetKeyDown("down") && currentMoveButton == MovementButton.none) { currentMoveButton = MovementButton.down; SetFacingDirection(Direction.South); StartMoving(); } else if (Input.GetKeyDown("left") && currentMoveButton == MovementButton.none) { currentMoveButton = MovementButton.left; SetFacingDirection(Direction.West); StartMoving(); } else if (Input.GetKeyDown("right") && currentMoveButton == MovementButton.none) { currentMoveButton = MovementButton.right; SetFacingDirection(Direction.East); StartMoving(); } else if (Input.GetKeyUp("right") || Input.GetKeyUp("left") || Input.GetKeyUp("down") || Input.GetKeyUp("up")) { StopMoving(); currentMoveButton = MovementButton.none; } if (isMoving) { Move(); } #else #endif }
private void load(ProjectEditor editor) { Masking = true; CornerRadius = 15; Height = 450; Width = 500; Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.Black, Alpha = 0.3f, }, new GridContainer { RelativeSizeAxes = Axes.Both, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(), }, Content = new[] { new Drawable[] { stateButtonContainer = new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, RowDimensions = new [] { new Dimension(GridSizeMode.AutoSize), }, Content = new[] { new Drawable[] { imagesButton = new StateButton { Text = @"Imagenes", Action = () => { stateContainer.MoveToX(0, 100, Easing.Out); previewButton.Selected = false; }, }, previewButton = new StateButton { Text = @"Vista Previa", Action = () => { stateContainer.MoveToX(-1, 100, Easing.Out); imagesButton.Selected = false; }, }, }, }, }, }, new Drawable[] { stateContainer = new GridContainer { RelativePositionAxes = Axes.X, RelativeSizeAxes = Axes.Both, Width = 2, Content = new[] { new Drawable[] { new Container { Masking = true, CornerRadius = 15, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Masking = true, Child = images = new FillFlowContainer <ElementImageChangerButton> { Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Padding = new MarginPadding { Horizontal = 50 }, Spacing = new Vector2(100), }, }, arrowsContainer = new Container <MovementButton> { RelativeSizeAxes = Axes.Both, Alpha = 0, Children = new[] { leftMovementButton = new MovementButton(true) { Action = () => imagesIndex.Value--, }, rightMovementButton = new MovementButton(false) { Action = () => imagesIndex.Value++, }, }, }, }, }, preview = new ElementPreviewContainer { Masking = true, RelativeSizeAxes = Axes.Both, }, }, }, }, }, }, }, }; imagesIndex.BindValueChanged(val => { images.MoveToX(-val.NewValue, 250, Easing.OutQuint); leftMovementButton.Enabled.Value = val.NewValue != 0; rightMovementButton.Enabled.Value = val.NewValue != currentEditing.Value.Images.Count - 1; }); imagesButton.Action?.Invoke(); currentEditing.BindTo(editor.CurrentEditingElement); currentEditing.BindValueChanged(loadElement, true); }
public void registerButton(MovementButton button){ buttons.Add (button); }