void Update() { //Debug.LogWarning("A"); var xAxis = Input.GetAxis("Horizontal"); var yAxis = Input.GetAxis("Vertical"); Vector3 targetDirection = new Vector3(xAxis, 0f, yAxis); targetDirection = Camera.main.transform.TransformDirection(targetDirection); if (Input.GetKeyDown(KeyCode.R)) { Debug.LogWarning("A"); //SceneManager.LoadSceneAsync(BuildSettings.SplashScreenScene, LoadSceneMode.Additive); //Model.GetComponent<Renderer>().enabled = (true); //GetComponent<Rigidbody>().isKinematic = false; PlayerInputWriter.Send(new PlayerInput.Update().AddRespawn(new Respawn())); Debug.LogWarning("B"); } var update = new PlayerInput.Update(); update.SetJoystick(new Joystick(targetDirection.x, targetDirection.z)); PlayerInputWriter.Send(update); }
private void OnPlayerInputUpdated(PlayerInput.Update update) { if (update.TargetPosition.HasValue) { targetPos = update.TargetPosition.Value.ToUnityVector(); tragetUpdated = true; } }
void Update() { var xAxis = Input.GetAxis("Horizontal"); var yAxis = Input.GetAxis("Vertical"); var update = new PlayerInput.Update(); update.SetJoystick(new Joystick(xAxis, yAxis)); PlayerInputWriter.Send(update); }
private void RandomizeSteering() { var xAxis = Random.Range(-0.9f, 0.9f); var yAxis = Random.Range(-0.9f, 0.9f); var update = new PlayerInput.Update(); update.SetJoystick(new Joystick(xAxis, yAxis)); PlayerInputWriter.Send(update); PlayerRotationWriter.Send(new PlayerRotation.Update().SetBearing(Random.Range(0f, 360f))); }
private void InputSender() { var xAxis = Input.GetAxis("Horizontal"); var yAxis = Input.GetAxis("Vertical"); var update = new PlayerInput.Update(); update.SetJoystick(new Joystick(xAxis, yAxis)); PlayerInputWriter.Send(update); if (Input.GetKeyDown(KeyCode.Space)) { PlayerInputWriter.Send(new PlayerInput.Update().AddFire(new Fire())); } }
void Update() { var xAxis = Input.GetAxis("Horizontal"); var yAxis = Input.GetAxis("Vertical"); bool shift = Input.GetKey(KeyCode.LeftShift); bool w = Input.GetKey(KeyCode.W); bool s = Input.GetKey(KeyCode.S); bool space = Input.GetKey(KeyCode.Space); w = w || Input.GetKey(KeyCode.UpArrow); s = s || Input.GetKey(KeyCode.DownArrow); var update = new PlayerInput.Update(); update.SetJoystick(new Joystick(xAxis, yAxis, shift, w, s, space)); PlayerInputWriter.Send(update); }
void Update() { var xAxis = Input.GetAxis("Horizontal"); var yAxis = Input.GetAxis("Vertical"); var update = new PlayerInput.Update(); update.SetJoystick(new Joystick(xAxis, yAxis)); PlayerInputWriter.Send(update); if (xAxis != 0 || yAxis != 0) { PlayerInputWriter.Send(new PlayerInput.Update().AddMove(new Move())); } else { PlayerInputWriter.Send(new PlayerInput.Update().AddStop(new Stop())); } if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0)) { PlayerInputWriter.Send(new PlayerInput.Update().AddFire(new Fire())); } if ((Input.GetKeyDown(KeyCode.P) || usingShield) && readyShield) { //Debug.LogError ("using shield: " + usingShield + " readyshield: " + readyShield); if (usingShield == false) { spawnTime = Time.time; } if ((Time.time - spawnTime) < SecondsUntilDisableShield) { // Debug.LogError ("Secondi: " + (Time.time - spawnTime)); usingShield = true; PlayerInputWriter.Send(new PlayerInput.Update().AddShield(new Shield())); } else { //Debug.LogError ("ho disabilitato"); PlayerInputWriter.Send(new PlayerInput.Update().AddNotShield(new NotShield())); usingShield = false; } } }
void Update() { var xAxis = Input.GetAxis("Horizontal"); var yAxis = Input.GetAxis("Vertical"); var feedbackButton = Input.GetKeyDown(KeyCode.F); var arrowButton = Input.GetKeyDown(KeyCode.Q); var update = new PlayerInput.Update(); update.SetJoystick(new Joystick(xAxis, yAxis)); update.SetJump(Input.GetKey(KeyCode.Space)); update.SetFight(Input.GetKey(KeyCode.LeftShift)); PlayerInputWriter.Send(update); if (feedbackButton) { //inputFieldGUI.SetActive(true); var createPosition = transform.position; createPosition.y = 1f; NoticeCreatorWriter.Send(new NoticeCreator.Update() .AddCreate(new CreateNoticeData("Hello", createPosition.ToSpatialCoordinates()))); } if (arrowButton) { //inputFieldGUI.SetActive(true); var createPosition = (transform.position + ((new Vector3(xAxis, 0.5f, yAxis).normalized))); Vector3 relativePos = createPosition - transform.position; Vector3 createRotation = Quaternion.LookRotation(relativePos).eulerAngles; ArrowCreatorWriter.Send(new ArrowCreator.Update() .AddCreate(new CreateArrowData(createPosition.ToSpatialCoordinates(), createRotation.ToSpatialCoordinates()))); } }
private void RandomizeShooting() { var update = new PlayerInput.Update(); PlayerInputWriter.Send(new PlayerInput.Update().AddFire(new Fire())); }