void Update() { if (Input.GetKeyDown(KeyCode.A)) { ShowControls sc = ShowControls.CreateDocked(new ControlItem("An example of showing controls for a single key", KeyCode.Space)); sc.destroyWhenDone = true; sc.Show(); } if (Input.GetKeyDown(KeyCode.S)) { ShowControls sc = ShowControls.CreateDocked(new ControlItem("An example of showing a mouse click", MouseButton.LeftClick)); sc.destroyWhenDone = true; sc.Show(); } if (Input.GetKeyDown(KeyCode.D)) { ShowControls sc = ShowControls.CreateDocked(new ControlItem("An example of showing click & drag", MouseDirection.Both, MouseButton.RightClick)); sc.destroyWhenDone = true; sc.Show(); } if (Input.GetKeyDown(KeyCode.F)) { ShowControls sc = ShowControls.CreateDocked(new[] { new ControlItem("An example of a mouse click with a modifier key", KeyCode.LeftControl, MouseButton.LeftClick), new ControlItem("Also an example of showing multiple keys AND mouse button AND direction, and showing multiple controls at once", new[] { KeyCode.LeftShift, KeyCode.LeftControl }, MouseDirection.Horizontal, MouseButton.RightClick) }); sc.destroyWhenDone = true; sc.Show(); } }
void AddPowerup(string powerup) { // create a new docked ShowControls, and also add the control // to the fullscreen list. switch (powerup) { case "Jump": hasJump = true; fullscreen.controls.Add(new ControlItem(jumpFull, KeyCode.Space)); /* create the "jump" dock. We don't need to keep track of the * ShowControls it returns, as it will take care of itself * when the duration runs out. Create it, & immediately show it. */ ShowControls.CreateDocked(new ControlItem(jumpPopup, KeyCode.Space)).Show(); break; case "Die": hasDie = true; fullscreen.controls.Add(new ControlItem(dieFull, MouseButton.LeftClick)); /* Create the "die" dock. We don't show it immediately because * we want to adjust the duration before showing. */ dieDock = ShowControls.CreateDocked(new ControlItem(diePopup, MouseButton.LeftClick)); dieDock.showDuration = -1; dieDock.Show(); break; } }
void Start() { /* fsBlender is the fullscreen blender controls, which we show with Tab */ fsBlender = ShowControls.CreateFullscreen(new[] { new ControlItem(descOrbit, MouseDirection.Both, MouseButton.MiddleClick), new ControlItem(descPan, KeyCode.LeftShift, MouseDirection.Both, MouseButton.MiddleClick), new ControlItem(descZoom, MouseButton.ScrollWheel), new ControlItem(descFocus, KeyCode.KeypadPeriod), new ControlItem(descPlay, new[] { KeyCode.LeftAlt, KeyCode.A }), new ControlItem(descFs, new[] { KeyCode.LeftShift, KeyCode.Space }) }); fsBlender.fullscreenTitle = "Handy Blender Controls"; fsBlender.fullscreenClearKey = blenderKey; /* fsUnity is the fullscreen unity controls, which we show with Z */ fsUnity = ShowControls.CreateFullscreen(new[] { new ControlItem(descOrbit, KeyCode.LeftAlt, MouseDirection.Both, MouseButton.LeftClick), new ControlItem(descPan, KeyCode.LeftAlt, MouseDirection.Both, MouseButton.MiddleClick), new ControlItem(descZoom, KeyCode.LeftAlt, MouseDirection.Horizontal, MouseButton.RightClick), new ControlItem(descFocus, KeyCode.F), new ControlItem(descPlay, new[] { KeyCode.LeftControl, KeyCode.P }), new ControlItem(descFs, KeyCode.Space) }); fsUnity.fullscreenTitle = "Common controls for Unity"; fsUnity.fullscreenClearKey = unityKey; /* fsTop is the top docked controls that always display, unless either * fullscreen display is showing. */ fsTop = ShowControls.CreateDocked(new[] { new ControlItem("Show Blender controls", fsBlender.fullscreenClearKey), new ControlItem("Show Unity controls", fsUnity.fullscreenClearKey), new ControlItem("Create indefinite bottom dock", bottomPermKey), new ControlItem("Create temporary bottom dock", bottomTempKey) }); fsTop.showDuration = -1; fsTop.size = ShowControlSize.Small; fsTop.slideSpeed = -1; fsTop.Show(); /* the bottom controls are created now, but aren't displayed until * we press the proper key */ bottomPerm = ShowControls.CreateDocked(new[] { new ControlItem(descBottomPerm, bottomPermKey) }); bottomPerm.position = ShowControlPosition.Bottom; bottomPerm.hideLeftRightOnModifierKeys = false; bottomPerm.showDuration = -1; }
public void Start() { birdTargets = FindObjectsOfType <BirdTarget>(); uiTime.text = timeTotal.ToString(".0"); // web player doesn't need the exit button if (Application.platform == RuntimePlatform.WebGLPlayer) { GameObject.Destroy(exitButton); } controls = ShowControls.CreateDocked(new ControlItem[] { new ControlItem("Use arrow keys to walk left and right", new KeyCode[] { KeyCode.LeftArrow, KeyCode.RightArrow }), new ControlItem("Press space to jump", KeyCode.Space) }); controls.position = ShowControlPosition.Bottom; controls.showDuration = -1; controls.Show(); }
void Update() { if (Input.GetKeyDown(fsBlender.fullscreenClearKey)) { fsUnity.Hide(); fsBlender.Toggle(); } if (Input.GetKeyDown(fsUnity.fullscreenClearKey)) { fsBlender.Hide(); fsUnity.Toggle(); } if (!fsBlender.IsShown && !fsUnity.IsShown) { fsTop.Show(); /* if we're pressing the key for the temp ShowControls and * it doesn't already exist, instantiate it. When it's done, * it'll automatically Destroy itself and we'll be able to * make it again. */ if (Input.GetKeyDown(bottomTempKey) && bottomTmp == null) { bottomTmp = ShowControls.CreateDocked(new[] { new ControlItem(descBottomTemp, bottomTempKey) }); bottomTmp.offsetX = Screen.width / 2; bottomTmp.showDuration = 5; bottomTmp.position = ShowControlPosition.Bottom; bottomTmp.destroyWhenDone = true; bottomTmp.Show(); } if (Input.GetKeyDown(bottomPermKey)) { bottomPerm.Toggle(); } } else { fsTop.Hide(); } }
void Start() { startPoint = transform.position; cc = GetComponent <CharacterController>(); /* Create the fullscreen ShowControls with a control, * but don't show it yet. */ fullscreen = ShowControls.CreateFullscreen(new ControlItem(moveFull, CustomDisplay.wasd)); fullscreen.fullscreenMessageLeft = "Mash "; fullscreen.fullscreenClearKey = KeyCode.Tab; fullscreen.fullscreenMessageRight = "to keep rockin'"; // make a ShowControls at the bottom to show movement & // the controls screen. It stays around forever. bottomDock = ShowControls.CreateDocked(new[] { new ControlItem(movePopup, CustomDisplay.wasd), new ControlItem(menuPopup, KeyCode.Tab) }); bottomDock.size = ShowControlSize.Small; bottomDock.showDuration = -1; bottomDock.slideSpeed = -1; bottomDock.position = ShowControlPosition.Bottom; bottomDock.Show(); }