protected virtual void Update() { if (currentPage != null) { foreach (string key in currentPage.cancelButtons) { if (VirtualInput.GetButtonDown(key)) { currentPage.Finish(); break; } } } if (currentPage == null && Pages.Count > 0) { currentPage = Pages[Pages.Count - 1] as Page; currentPage.OnPageFocus(); } else if (currentPage != null && Pages.Count > 0 && Pages[Pages.Count - 1] != currentPage) { currentPage.OnPageBlur(); currentPage = Pages[Pages.Count - 1] as Page; currentPage.OnPageFocus(); } if (currentPage != null) { currentPage.OnPageUpdate(); } }
// Update is called once per frame void Update() { VirtualInput.SaveLastButton(); VirtualInput.isDirectKeyDown = false; VirtualInput.dir = Vector2.zero; if (Input.GetKey(up)) { VirtualInput.isDirectKeyDown = true; VirtualInput.dir += new Vector2(0, 1); } if (Input.GetKey(down)) { VirtualInput.isDirectKeyDown = true; VirtualInput.dir += new Vector2(0, -1); } if (Input.GetKey(left)) { VirtualInput.dir += new Vector2(1, 0); VirtualInput.isDirectKeyDown = true; } if (Input.GetKey(right)) { VirtualInput.dir += new Vector2(-1, 0); VirtualInput.isDirectKeyDown = true; } VirtualInput.buttons[0] = Input.GetKey(button0); VirtualInput.buttons[1] = Input.GetKey(button1); VirtualInput.buttons[2] = Input.GetKey(button2); VirtualInput.buttons[3] = Input.GetKey(button3); VirtualInput.buttons[9] = Input.GetKey(jump); }
private void OnTriggerStay(Collider other) { if (message2 != "" && other.gameObject == player && VirtualInput.GetButtonDown(changeMessageButton)) { manager.SetMessage(message2); } }
IEnumerator PlayWeaponPose(int pose) { int nowpose = owner.posMng.mActiveAction.Idx; List <VirtualInput> skill = VirtualInput.CalcSkillInput(pose); for (int i = 0; i < skill.Count; i++) { //受击中断招式 if (owner.posMng.mActiveAction.Idx != nowpose) { yield break; } if (skill[i].type == 1) { owner.controller.Input.OnKeyDown(skill[i].key, true); } else if (skill[i].type == 0) { owner.controller.Input.OnKeyUp(skill[i].key); } yield return(0); } PlayWeaponPoseCorout = null; }
void Update() { // Store the input axes. h = VirtualInput.GetAxis("Horizontal"); v = VirtualInput.GetAxis("Vertical"); // Set the input axes on the Animator Controller. anim.SetFloat(hFloat, h, 0.1f, Time.deltaTime); anim.SetFloat(vFloat, v, 0.1f, Time.deltaTime); // Toggle sprint by input. sprint = VirtualInput.GetButton(sprintButton); // Set the correct camera FOV for sprint mode. if (IsSprinting()) { changedFOV = true; camScript.SetFOV(sprintFOV); } else if (changedFOV) { camScript.ResetFOV(); changedFOV = false; } }
private void BackgroundActivationDispatch() { Boolean previouslyPressed = false; for (;;) { if ((VirtualInput.GetAsyncKeyState(FireContinuousKey) & 0x8000) == 0x8000) { if (previouslyPressed == false) { StringBuilder sb = new StringBuilder(256); IntPtr window = GetForegroundWindow(); GetWindowText(window, sb, sb.Capacity); if (sb.ToString().Equals("WARFRAME", StringComparison.CurrentCultureIgnoreCase)) { previouslyPressed = true; ToggleActivation(); } } } else { if (previouslyPressed == true) { previouslyPressed = false; } } Thread.Sleep(25); } }
/// <summary> /// <see cref="PuzzleSceneSet"/> の新しいインスタンスを生成します。 /// </summary> public PuzzleSceneSet() { input = new VirtualInput(); puzzle = new PuzzleBody(); NextScene = Startup; }
// Update is used to set features regardless the active behaviour. void Update() { // Activate/deactivate aim by input. if (VirtualInput.GetAxisRaw(aimButton) != 0 && !aim) { StartCoroutine(ToggleAimOn()); } else if (aim && VirtualInput.GetAxisRaw(aimButton) == 0) { StartCoroutine(ToggleAimOff()); } // No sprinting while aiming. canSprint = !aim; // Toggle camera aim position left or right. if (aim && VirtualInput.GetButtonDown(shoulderButton)) { aimCamOffset.x = aimCamOffset.x * (-1); aimPivotOffset.x = aimPivotOffset.x * (-1); } // Set aim boolean on the Animator Controller. behaviourManager.GetAnim.SetBool(aimBool, aim); }
void Start() { button = GetComponent <GUITexture>(); button.color = inactiveColor; VirtualInput.AddButton(buttonName); }
protected override Vector3 GetPosition(Camera camera, CameraController attachment, float deltaTime) { Vector2 r = Vector2.zero; object R; if (attachment.Temp.TryGetValue("r", out R) && R is Vector2 tmp) { r = tmp; } r.x += deltaTime * VirtualInput.GetAxis(axesConfig.horizontalAxis) * axesConfig.horizontalScale; r.y += deltaTime * VirtualInput.GetAxis(axesConfig.verticalAxis) * axesConfig.verticalScale; if (r.y > verticalAngleLimit) { r.y = verticalAngleLimit; } if (r.y < -verticalAngleLimit) { r.y = -verticalAngleLimit; } attachment.Temp["r"] = r; Vector3 dir = Vector3.forward; dir = Quaternion.Euler(Vector3.up * r.x) * dir; Vector3 axis = Quaternion.Euler(0, -90, 0) * dir; dir = Quaternion.AngleAxis(r.y, axis) * dir; return(attachment.transform.position + dir * distance); }
void Start() { vInput = GameObject.FindGameObjectWithTag("GameController").GetComponent <VirtualInput> (); music = GameObject.FindGameObjectWithTag("Music").GetComponent <AudioSource> (); Load(); }
/// <summary> /// 产生所有坦克(包括玩家和AI)、设置镜头所有追踪目标、小地图初始化 /// </summary> private void SetupGame() { myTank = CreateMasterTank(); allPlayerManager.SetupInstance(); AllPlayerManager.Instance.CreatePlayerGameObjects(new GameObject("Tanks").transform, myTank); tankList.Add(myTank); myTank.Init(wayPoints); for (int i = 1; i < AllPlayerManager.Instance.Count; i++) { tankList.Add(AllPlayerManager.Instance[i].GetComponent <TankManager>()); tankList[i].Init(wayPoints); //if (AllPlayerManager.Instance[i] == AllPlayerManager.Instance.MyPlayer) // myTank = tankList[i]; } MainCameraRig.Instance.Setup(myTank.transform, AllPlayerManager.Instance.GetAllPlayerTransform()); if (myTank != null) { minimap.SetTarget(myTank.transform); minimap.SetMinimapActive(true); if (VirtualInput.GetButton("Attack") != null) { ((ChargeButtonInput)VirtualInput.GetButton("Attack")).Setup(myTank.tankAttack, myTank.tankAttack.coolDownTime, myTank.tankAttack.minLaunchForce, myTank.tankAttack.maxLaunchForce, myTank.tankAttack.ChargeRate); } } }
public void AssignVirtualInput(VirtualInput virtualInput) { aliveController.vi = virtualInput; deadController.vi = virtualInput; ControllerAssigned = true; }
void Start() { button = this.GetComponent <Image>(); releaseColor = button.color; VirtualInput.AddButton(inputName, this); }
static CrossPlatformInput () { #if MOBILE_INPUT virtualInput = new MobileInput (); #else virtualInput = new StandaloneInput(); #endif }
static CrossPlatformInput() { #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 virtualInput = new MobileInput (); #elif UNITY_STANDALONE || UNITY_WEBPLAYER virtualInput = new StandaloneInput(); #endif }
// Update is used to set features regardless the active behaviour. void Update() { // Get jump input. if (!jump && VirtualInput.GetButtonDown(jumpButton) && behaviourManager.IsCurrentBehaviour(this.behaviourCode) && !behaviourManager.IsOverriding()) { jump = true; } }
public override float GetValue() { if (axisName != null && axisName.Value != null && axisName.Value.Trim().Length > 0) { value = VirtualInput.GetAxis(axisName.Value); } return(base.GetValue()); }
/// <summary> /// Restore snake for uninitialized position /// </summary> public void Clear() { inputDirection = Direction.Undefined; currentDirection = Direction.Undefined; gameField.ClearByID(actorID); nodeCoordinates.Clear(); VirtualInput.VisualizationInput(Direction.Undefined); }
static CrossPlatformInput() { #if MOBILE_INPUT virtualInput = new MobileInput(); #else virtualInput = new StandaloneInput(); #endif }
static CrossPlatformInput() { #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 virtualInput = new MobileInput(); #elif UNITY_STANDALONE || UNITY_WEBPLAYER virtualInput = new StandaloneInput(); #endif }
// Start is always called after any Awake functions. void Start() { // Set up the references. button = this.GetComponent <Image>(); releaseColor = button.color; // Subscribe this virtual button on the virtual Input manager. VirtualInput.AddButton(inputName, this); }
void Start() { VirtualInput.AddAxis(horizontalAxisName); VirtualInput.AddAxis(verticalAxisName); joystickSize = guiTexture.pixelInset.width - guiTexture.pixelInset.left; HideJoystick(); }
static CrossPlatformInputManager() { mobileInput = new MobileInput(); standaloneInput = new StandaloneInput(); #if MOBILE_INPUT activeInput = mobileInput; #else activeInput = standaloneInput; #endif }
static CrossPlatformInputManager() { s_TouchInput = new MobileInput(); s_HardwareInput = new StandaloneInput(); #if MOBILE_INPUT activeInput = s_TouchInput; #else activeInput = s_HardwareInput; #endif }
void Start() { planets = holoMap.GetComponentsInChildren <LevelPlanet>(); for (int i = 0; i < planets.Length; i++) { planets[i].SetMeshState(maxLevelReached >= i ? enablePlanet : disablePlanet); } vInput = InputManager.GetVirtualInput(InputManager.PlayerTag.Player1); }
bool isInsideRegion(Vector2 point) { var topLeft = new Vector2(region.x * Screen.width, region.y * Screen.height); var bottomRight = topLeft + new Vector2(region.width * Screen.width, region.height * Screen.height); if (VirtualInput.pointInsideAABB(topLeft, bottomRight, point)) { return(true); } return(false); }
public static void SwitchActiveInputMethod(ActiveInputMethod activeInputMethod) { switch (activeInputMethod) { case ActiveInputMethod.Hardware: activeInput = s_HardwareInput; break; case ActiveInputMethod.Touch: activeInput = s_TouchInput; break; } }
private float doubleClickDelay = 0.4f; // The interval between button presses to define the double click action. // Start is always called after any Awake functions. void Start() { // Set up the references. doubleClickTimer = 0; bg = this.GetComponent <Image>(); joystick = this.transform.GetChild(0).GetComponent <Image>(); releaseColor = joystick.color; // Subscribe this virtual analog axes on the virtual Input manager. VirtualInput.AddAxis(inputXAxis, this); VirtualInput.AddAxis(inputYAxis, this); VirtualInput.AddAxis(buttonName, this); }
public static void ChangeActiveInputMethod(ActiveInputMethod activeInputMethod) { switch (activeInputMethod) { case ActiveInputMethod.Mobile: activeInput = mobileInput; break; case ActiveInputMethod.Standalone: activeInput = standaloneInput; break; } }
private void SpawnPlayer(VirtualInput vi, int controllerId) { Vector3 spawnPoint = spawnPoints.GetRandomUnusedSpawnPoint(); Player player = Instantiate(playerPrefab, spawnPoint, Quaternion.identity); //player.playerColor = Random.ColorHSV(0f, 1f); //player.SetColor(Random.ColorHSV(0f, 1f)); player.ControllerID = controllerId; playerSpawner.SetUpPlayerColor(player, player.ControllerID); player.SetVirtualInput(vi); player.transform.GetChild(2).GetComponent <Canvas>().worldCamera = Camera.main; player.GetComponent <PlayerController>().scoreManager = scoreManager; }
protected override void Start() { base.Start(); rectTransform = GetComponent <RectTransform>(); if (horizontal) { horizontalAxis = () => { if (ed == null || rectTransform == null) { return(0); } switch (inputType) { default: case InputType.Delta: return(ed.delta.x / Screen.width * horizontalSensitivity.Value); case InputType.Position: return((ed.position.x - dp.x) / Screen.width * horizontalSensitivity.Value); } }; VirtualInput.Register(horizontalAxisName, horizontalAxis); } if (vertical) { verticalAxis = () => { if (ed == null || rectTransform == null) { return(0); } switch (inputType) { default: case InputType.Delta: return(ed.delta.y / Screen.height * horizontalSensitivity.Value); case InputType.Position: return((ed.position.y - dp.y) / Screen.height * horizontalSensitivity.Value); } }; VirtualInput.Register(verticalAxisName, verticalAxis); } if (button && buttonKey != null && buttonKey.Length > 0) { _btn = () => GetState(); VirtualInput.Register(buttonKey, _btn); } }
static CrossPlatformInput() { CrossPlatformInput.virtualInput = new StandaloneInput(); }