// Update is called once per frame void Update() { if (VirtualController.AnyKeyPressed()) { gameObject.SetActive(false); } }
static void AddGameLogicObjects() { GameObject playableBase = new GameObject("###PlayableBase###"); playableBase.tag = "PlayBase"; playableBase.AddComponent <MainManager>(); HierarchyHighlighterComponent hhc = playableBase.AddComponent <HierarchyHighlighterComponent>(); hhc.color = Color.red; hhc.highlight = true; playableBase.transform.position = new Vector3(0, 0, 0); VirtualController vc = GameObject.Instantiate(AssetDatabase.LoadAssetAtPath <VirtualController>("Assets/Prefabs/Runtime/VirtualController.prefab")); ManagerBase mb = GameObject.Instantiate(AssetDatabase.LoadAssetAtPath <ManagerBase>("Assets/Prefabs/Runtime/ManagerBase.prefab")); DialogueBoxManager dbm = GameObject.Instantiate(AssetDatabase.LoadAssetAtPath <DialogueBoxManager>("Assets/Prefabs/Runtime/DialogueBoxManager.prefab")); GameObject coreLogic = GameObject.Instantiate(AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Prefabs/Runtime/CoreLogic.prefab")); vc.name = "###VIRTUALCONTROLLER###"; mb.name = "###MANAGERBASE###"; dbm.name = "###DIALOGUEBOXMANAGER###"; coreLogic.transform.SetParent(playableBase.transform); vc.transform.SetParent(playableBase.transform); mb.transform.SetParent(playableBase.transform); dbm.transform.SetParent(playableBase.transform); mb.dialogueBoxManager = dbm; }
void HandleRegisterConnection(Socket handler) { VirtualController virtualController = new VirtualController(UDP_PORT, CONTROLLER_ID); virtualControllers.Add(virtualController); if (controllerManager != null && controllerManager.AddNewVirtualController(virtualController)) { byte[] portData = BitConverter.GetBytes(Convert.ToUInt16(UDP_PORT)); MemoryStream memoryStream = new MemoryStream(); memoryStream.WriteByte((byte)COMMAND.REGISTER_SUCCESS); memoryStream.Write(portData, 0, portData.Length); handler.Send(memoryStream.ToArray()); memoryStream.Close(); UDP_PORT++; CONTROLLER_ID++; } else { handler.Send(new byte[] { (byte)COMMAND.NO_PORT_AVALAIBLE }); } }
private VirtualController AddTrackedController(string serial, bool isController, bool isL = true) { var ctrl = new VirtualController(vrInputEmulator); var idL = ctrl.AddTrackedController(serial); if (idL < 0) { idL = ctrl.GetDeviceID(); ctrl.GetOpenVRDeviceID(); } else { if (isController) { ctrl.SetControllerProperty(isL); } else { ctrl.SetTrackerProperty(); } } virtualController.Add(ctrl); Controllers.options.Add(new Dropdown.OptionData(serial)); return(ctrl); }
bool FacingAndTouchingWall() { if (_anim.Facing == 0) { return(false); } //if not pushing into wall via input or velocity, dont walljump if (!(PMath.GetSign(VirtualController.GetAxisHorizontal()) == _anim.Facing) && !(PMath.GetSign(_rigidbody.velocity.x) == _anim.Facing)) { return(false); } Vector3 dir = new Vector3(_anim.Facing, 0); RaycastHit r; Vector3 origin = transform.position; float spd = 0.55f; int gMask = Layers.GetGroundMask(true); if (Physics.Raycast(origin + new Vector3(0, 0.8f, 0), dir, out r, spd, gMask) || Physics.Raycast(origin + new Vector3(0, 0.5f, 0), dir, out r, spd, gMask) || Physics.Raycast(origin + new Vector3(0, 0.2f, 0), dir, out r, spd, gMask) || Physics.Raycast(origin + new Vector3(0, -0.15f, 0), dir, out r, spd, gMask) || Physics.Raycast(origin + new Vector3(0, -0.45f, 0), dir, out r, spd, gMask)) { return(true); } else { return(false); } }
void BasicMovement() { Vector3 moveInputs = Vector3.zero; moveInputs.x = VirtualController.GetAxisHorizontal(); moveInputs.z = VirtualController.GetAxisVertical(); _anim.SetMoving(moveInputs.x != 0); _anim.SetFacing(moveInputs.x); if (UnlockTable.PowerActive(UnlockID.Crouch)) { _anim.SetCrouchInput(moveInputs.z < 0); } if (moveInputs.x != 0 && _rigidbody.velocity.x != 0) { _rigidbody.velocity = new Vector3(0, _rigidbody.velocity.y); } Vector3 movement = CheckMovement(moveInputs); Vector3 movepos = transform.position; movepos.x += movement.x; //movepos.z += movement.z; transform.position = movepos; }
// Update is called once per frame void Update() { if (VirtualController.PauseButtonPressed()) { ToggleShop(); } }
private void OnMidSessionControllerConnect(VirtualController virtualController) { if (MidSessionControllerConnect != null) { MidSessionControllerConnect(virtualController); } }
// Start is called before the first frame update void Start() { anim = this.GetComponent <Animator>(); if (controller == null) { controller = this.GetComponent <VirtualController>(); } }
public void VirtualControllerShoots(VirtualController virtualController, Vector2 shoot) { smartphoneControllers.TryGetValue(virtualController.controllerID, out smartphoneController); if (smartphoneController != null) { smartphoneController.SetRightAnalogStick = shoot; } }
public void VirtualControllerSendsPauseButton(VirtualController virtualController) { smartphoneControllers.TryGetValue(virtualController.controllerID, out smartphoneController); if (smartphoneController != null) { smartphoneController.SetPausePressed = true; } }
public void VirtualControllerMoves(VirtualController virtualController, Vector2 movement) { smartphoneControllers.TryGetValue(virtualController.controllerID, out smartphoneController); if (smartphoneController != null) { smartphoneController.SetLeftAnalogStick = movement; } }
private void Start() { attr = GetComponent <NpcAttribute>(); aiBase = GetComponent <AIBase>(); vcontroller = GetComponent <MoveController>().vcontroller; gameObject.AddComponent <DebugServerPos>(); }
public void VirtualControllerSendsSpecialAttack(VirtualController virtualController) { smartphoneControllers.TryGetValue(virtualController.controllerID, out smartphoneController); if (smartphoneController != null) { smartphoneController.SetAbilityPressed = true; } }
private void RemoveVirtualController(VirtualController virtualController) { smartphoneControllers.TryGetValue(virtualController.controllerID, out smartphoneController); if (smartphoneController != null) { InputManager.DetachDevice(smartphoneController); currentSmartPhoneController--; } }
public Input(string modFolder) { ModFolder = modFolder; Controllers = new VirtualController[8]; for (int x = 0; x < Mappings.ControllerFiles.Length; x++) { Controllers[x] = new VirtualController(Path.Combine(ModFolder, Mappings.ControllerFiles[x])); } }
// Update is called once per frame void Update() { if (dashPauseTimer > 0) { dashPauseTimer -= Time.deltaTime; _rigidbody.velocity = Vector3.zero; if (dashPauseTimer <= 0) { dashPauseTimer = 0; _anim.StopDashSlashAnim(); } return; } if (wallJumpLockTimer > 0) { wallJumpLockTimer -= Time.deltaTime; if (wallJumpLockTimer <= 0) { wallJumpLockTimer = 0; Vector3 v = _rigidbody.velocity; v.x *= 0.65f; v.y *= 0.75f; _rigidbody.velocity = v; } return; } isGrounded = Grounded(); _anim.SetGrounded(isGrounded); if (controlsLocked || hitstun) { return; } BasicMovement(); if (VirtualController.JumpButtonPressed()) { if (UnlockTable.PowerActive(UnlockID.Jump)) { Jump(); } } else if (!_anim.IsCrouching && VirtualController.ActionButtonPressed()) { if (VirtualController.GetAxisHorizontal() != 0 && UnlockTable.PowerActive(UnlockID.DashSlash)) { DashSlash(PMath.GetSign(VirtualController.GetAxisHorizontal())); } else if (UnlockTable.PowerActive(UnlockID.Slash)) { Slash(); } } if (isGrounded) { numAirJumps = maxAirJumps; } UpdateCoords(); }
public Mapping(VirtualController source, string name, int mappingIndex, MappingType type) { Source = source; Name = name; MappingIndex = mappingIndex; MapMeText = "Map Me!"; FriendlyName = source.GetFriendlyMappingName(mappingIndex); Type = type; }
public Configuration(ConfiguratorInput input) { ConfigurationName = input.ConfigurationName; Controller = new VirtualController(input.ConfigurationPath); foreach (var entry in input.Entries) { Mappings.Add(new Mapping(Controller, entry.Name, entry.MappingIndex, entry.Type)); } }
public ButtonActions GetSlot(VirtualController c) { if (IsAxisGesture) { return(c.GetAxis(Axis).GetPole(AxisGesture)); } else { return(c.GetButton(Button)); } }
public XInputManager(VirtualController virtualController) { VirtualController = virtualController; Controllers = new[] { new XInputController(new SharpDX.XInput.Controller(UserIndex.One)), new XInputController(new SharpDX.XInput.Controller(UserIndex.Two)), new XInputController(new SharpDX.XInput.Controller(UserIndex.Three)), new XInputController(new SharpDX.XInput.Controller(UserIndex.Four)), }; }
public static void CreateMyAsset() { VirtualController asset = ScriptableObject.CreateInstance <VirtualController>(); // AssetDatabase.CreateAsset(asset, "Assets/Fighter.asset"); //AssetDatabase.SaveAssets(); ProjectWindowUtil.CreateAsset(asset, "Assets/InputConfiguration.asset"); //EditorUtility.FocusProjectWindow(); //Selection.activeObject = asset; }
public Axis(VirtualController vc, HID_USAGES axis) { this.vc = vc; this.ID = vc.ID; this.axis = axis; this._value = 0; this.vc.joystick.GetVJDAxisMin(this.ID, this.axis, ref this._min_value); this.vc.joystick.GetVJDAxisMax(this.ID, this.axis, ref this._max_value); this.half_range = this._max_value / 2; // this.vc.logger.Debug($"Loaded axis {axis} with value {this._min_value} -> {this._max_value}"); }
//プレイヤーの入力を可能にしたり、不可能にしたりする // void CanInputPlayer(bool aCan) { float lTime = 0.0f; if (aCan == false) { lTime = 1.0f * 60.0f * 60.0f * 24.0f; } VirtualController.SetAxis(VirtualController.CtrlCode.Horizontal, 0.0f, lTime); VirtualController.SetAxis(VirtualController.CtrlCode.Jump, 0.0f, lTime); VirtualController.SetAxis(VirtualController.CtrlCode.Lift, 0.0f, lTime); VirtualController.SetAxis(VirtualController.CtrlCode.Vertical, 0.0f, lTime); }
public DInputManager(VirtualController virtualController) { VirtualController = virtualController; DirectInput = new DirectInput(); Hotplugger = new Hotplugger(); Refresh(); Hotplugger.OnConnectedDevicesChanged += () => { Refresh(); VirtualController.Refresh(); }; }
public void Setup(VirtualController controller) { P = controller.P; Taunt = controller.Taunt; Dash = controller.Dash; Block = controller.Block; DP = controller.DP; Teabag = controller.Teabag; hor = controller.hor; ver = controller.ver; dpadhor = controller.dpadhor; Jump = controller.Jump; }
void OnTriggerEnter(Collider other) { if (other.CompareTag("Player") && !isTurning) { playerObject = other.transform; player = playerObject.GetComponent <PlayerMachine>(); camera = player.gameManager.mainCamera.GetComponent <SmoothCameraMovement>(); input = player.gameManager.controller; startRotation = playerObject.rotation.eulerAngles; isTurning = true; StartCoroutine(turnPlayer(targetRotation, false)); } }
void Awake() { if (virtualCtrl) { Debug.LogError("複数のVirtualControllerが生成されました。\n" + VirtualCtrl.name + ", " + name); enabled = false; return; } else { virtualCtrl = this; } }
void OnGUI() { controller = (VirtualController)EditorGUILayout.ObjectField("Controller:", controller, typeof(VirtualController), false); if (controller) { controller.P = (KeyCode)EditorGUILayout.EnumPopup("Attack", controller.P); controller.Taunt = (KeyCode)EditorGUILayout.EnumPopup("Taunt", controller.Taunt); controller.Dash = (KeyCode)EditorGUILayout.EnumPopup("Dash", controller.Dash); controller.Block = (KeyCode)EditorGUILayout.EnumPopup("Block", controller.Block); controller.Teabag = (KeyCode)EditorGUILayout.EnumPopup("Teabag", controller.Teabag); controller.hor = EditorGUILayout.TextField("Horizontal", controller.hor); controller.ver = EditorGUILayout.TextField("Vertical", controller.ver); controller.dpadhor = EditorGUILayout.TextField("DPad Horizontal", controller.dpadhor); } }
public State(VirtualController vc, int buttonCount) { this.AxisX = new Axis(vc, HID_USAGES.HID_USAGE_X); this.AxisY = new Axis(vc, HID_USAGES.HID_USAGE_Y); this.AxisZ = new Axis(vc, HID_USAGES.HID_USAGE_Z); this.AxisXR = new Axis(vc, HID_USAGES.HID_USAGE_RX); this.AxisYR = new Axis(vc, HID_USAGES.HID_USAGE_RY); this.AxisZR = new Axis(vc, HID_USAGES.HID_USAGE_RZ); this.buttons = new List <Button>(); for (int i = 0; i < buttonCount; i++) { this.buttons.Add(new Button(vc)); } }
/// <summary> /// Responds to user input. /// </summary> public override void HandleInput(VirtualController vtroller) { if (Controller.IsButtonPressed(VirtualButtons.Select) && !_cantAdd) { Point pointer = Controller.Point; foreach (Rectangle rect in _platforms) { if (pointer.X > rect.X && pointer.X < rect.X + rect.Width) { if (pointer.Y > rect.Y && pointer.Y < rect.Y + rect.Height) { Texture2D textureToUse = platformTextures[new Vector2(rect.Width, rect.Height)]; editableLevel.MoveablePlatforms.Add(new Platform(textureToUse, new Vector2(rect.X, rect.Y), new Vector2(rect.Width, rect.Height), false)); ExitScreen(); } } } foreach (Rectangle rect in _breakablePlatforms) { if (pointer.X > rect.X && pointer.X < rect.X + rect.Width) { if (pointer.Y > rect.Y && pointer.Y < rect.Y + rect.Height) { Texture2D textureToUse = breakablePlatformTextures[new Vector2(rect.Width, rect.Height)]; editableLevel.MoveablePlatforms.Add(new Platform(textureToUse, new Vector2(rect.X, rect.Y), new Vector2(rect.Width, rect.Height), true)); ExitScreen(); } } } if (editableLevel.Custom) { if (Intersects(deathTrap, pointer)) { editableLevel.DeathTraps.Add(deathTrap); ExitScreen(); } if (Intersects(treasure, pointer)) { editableLevel.Treasures.Add(treasure); ExitScreen(); } } } if (_cantAdd && Controller.IsButtonPressed(VirtualButtons.Select)) { ExitScreen(); } }
/// <summary> /// Allows the screen to handle user input. Unlike Update, this method /// is only called when the screen is active, and not when some other /// screen has taken the focus. /// </summary> public virtual void HandleInput(VirtualController vtroller) { }
/// <summary> /// Lets the game respond to player input. Unlike the Update method, /// this will only be called when the gameplay screen is active. /// </summary> public override void HandleInput(VirtualController vtroller) { //I was going to handle launching the gameplayscreen here but im not sure how to. -Brian if (Controller.IsButtonPressed(VirtualButtons.Mode)) { launchToolbox = true; } if (launchToolbox && !toolboxLaunched) { String message = "Select an object to add to the level"; if (editableLevel.AdditionsLeft > 0) { toolbox = new ToolboxScreen(TopLevel, editableLevel, message, false); } else { message = "Object addition limit reached"; toolbox = new ToolboxScreen(TopLevel, editableLevel, message, true); } ScreenList.AddScreen(toolbox); launchToolbox = false; if(!editableLevel.FindCollision()) LevelSaver.SaveLevel(editableLevel); } //Calls the UpdateMovement method to move object on the scree UpdateMovement(); //Check if there is collisions in the simulation. if (editableLevel.FindCollision()) { foundCollision = true; } else { foundCollision = false; } }
/// <summary> /// Lets the game respond to player input. Unlike the Update method, /// this will only be called when the gameplay screen is active. /// </summary> public override void HandleInput(VirtualController vtroller) { // there was a bug where if you exit the toolbox without // selecting a platform the toolbox was unreachable. //toolboxLaunched = false; //I was going to handle launching the gameplayscreen here but im not sure how to. -Brian if (Controller.IsButtonPressed(VirtualButtons.Mode)) { launchToolbox = true; } if (launchToolbox && !toolboxLaunched) { String message = "Select a platform to add to the level"; if (editableLevel.AdditionsLeft > 0) { toolbox = new ToolboxScreen(TopLevel, editableLevel, message, false); } else { message = "Platform addition limit reached"; toolbox = new ToolboxScreen(TopLevel, editableLevel, message, true); } ScreenList.AddScreen(toolbox); launchToolbox = false; //toolboxLaunched = true; //Console.WriteLine(addedPlatform.Origin) } //Calls the UpdateMovement method to move object on the scree UpdateMovement(); //Check if there is collisions in the simulation. if (editableLevel.FindCollision()) { foundCollision = true; } else { foundCollision = false; } }