public void PostTest() { var container = UnityConfig.Container; var bikeBll = container.Resolve <IBikeBll>(); var userBll = new Mock <IUserBll>(); var bikeController = new BikeController(bikeBll, BikePortalMapper.Create(), userBll.Object); bikeController.Request = new HttpRequestMessage(); var user = User.Create("name", "name"); userBll.Setup(u => u.GetUser(It.IsAny <string>())).Returns(user); var description = "description"; var model = "model of bike"; var price = 123M; var name = "name of bike"; var bikeBindingModel = new BikeBindingModel { Description = description, Model = model, Price = price, Name = name }; var responseTask = bikeController.Post(bikeBindingModel); var message = responseTask.ExecuteAsync(new CancellationToken()).Result; Assert.AreEqual(message.StatusCode, HttpStatusCode.OK); var bikeViewModel = bikeController.Get(); Assert.IsTrue(bikeViewModel.Any()); }
private void Update() { if (!_bikeController) { _bikeController = GameObject.FindWithTag("GameManager").GetComponent <GameMan>().GetLocalPlayerInstance().GetComponent <BikeController>(); _bikeController.gamePaused = false; } if (Input.GetKeyDown(KeyCode.Escape)) { pauseUI.SetActive(!pauseUI.activeSelf); _bikeController.gamePaused = !_bikeController.gamePaused; } if (leaderBoardFound) { if (Input.GetKeyDown(KeyCode.Tab)) { leaderBoardUI.SetActive(!leaderBoardUI.activeSelf); } } else { if (GameObject.FindWithTag("LeaderBoard")) { leaderBoardUI = GameObject.FindWithTag("LeaderBoard"); leaderBoardFound = true; } } }
private void Start() { GameObject playerManagerGameObject = Utils.FilterTaggedObjectByParent("PlayerManager", transform.parent.parent.name); if (playerManagerGameObject == null) { Debug.LogError("Null player manager game object"); } PlayerManager playerManager = playerManagerGameObject.GetComponent <PlayerManager>(); if (playerManager == null) { Debug.LogError("Null player manager"); } GameObject bike = playerManager.activeBike; if (bike == null) { return; } _bikeController = bike.GetComponent <BikeController>(); }
void Start() { //assign sound to audioSource highRPMAudio = gameObject.AddComponent <AudioSource>(); highRPMAudio.loop = true; highRPMAudio.playOnAwake = false; highRPMAudio.clip = highRPM; highRPMAudio.pitch = 0; highRPMAudio.volume = 0.0f; //same assign for skid sound skidSound = gameObject.AddComponent <AudioSource>(); skidSound.loop = false; skidSound.playOnAwake = false; skidSound.clip = skid; skidSound.pitch = 1.0f; skidSound.volume = 1.0f; //real-time linking to current bike //linkToBike = GetComponent<BikeControllerV2>(); linkToBike = GetComponent <BikeController>(); engineSource = GetComponent <AudioSource>(); engineSource.PlayOneShot(engineStartSound); StartCoroutine(playEngineWorkSound()); lastGear = linkToBike.CurrentGear; }
public void PostPutInShoppingCartTest() { Database.SetInitializer(new BikePortalDbTestInitializer()); var container = UnityConfig.Container; var bikeBll = container.Resolve <IBikeBll>(); var userBll = new Mock <IUserBll>(); var mapper = BikePortalMapper.Create(); var articleController = new BikeController(bikeBll, mapper, userBll.Object); articleController.Request = new HttpRequestMessage(); var bikes = articleController.Get(); var firstBikeId = bikes.First().Id; var comments = articleController.GetComments(firstBikeId).ToList(); var user = User.Create("name", "name"); userBll.Setup(u => u.GetUser(It.IsAny <string>())).Returns(user); var commentText = "hello wordl"; var commentBindingModel = new CommentBindingModel { CommentText = commentText }; var responseTask = articleController.PostComment(firstBikeId, commentBindingModel); var message = responseTask.ExecuteAsync(new CancellationToken()).Result; Assert.AreEqual(message.StatusCode, HttpStatusCode.OK); var updatedBikeComments = articleController.GetComments(firstBikeId).ToList(); Assert.AreEqual(comments.Count() + 1, updatedBikeComments.Count()); }
public void Should_PUT_Bike() { var controller = new BikeController(vehicleStorage.Object, logger.Object); var bike = GetBike(); var result = controller.Put(new Guid(id), bike); Assert.True(result.GetType() == typeof(OkResult), "PUT Test failed for success case"); }
public XSensGyroBridge(XSensGyro xsensGyro, BikeController bikeController) { this.xsensGyro = xsensGyro; this.bikeController = bikeController; xsensGyro.OnStateChange += XSensGyroStateChange; xsensGyro.OnDataAvailable += XSensGyroDataAvailable; }
public void Should_Post_Bike() { var controller = new BikeController(vehicleStorage.Object, logger.Object); var bike = GetBike(); var result = controller.Post(bike); Assert.True(result.GetType() == typeof(CreatedResult), "POST Test failed"); }
private void Start() { bikeController = GetComponent <BikeController>(); if (!arduinoConnector.useArduino && !useKeyboard) { bikeController.setRotationAndSpeed(new Vector2(0, keyBoardMaxSpeed)); } }
public void Should__NOT_PUT_Bike() { var controller = new BikeController(vehicleStorage.Object, logger.Object); var bike = GetBike(); var result = controller.Put(new Guid(), bike); Assert.False(result.GetType() == typeof(OkResult), "PUT Test failed for failure case"); Assert.True(result.GetType() == typeof(NotFoundResult), "PUT Test failed for failure case"); }
controlHub outsideControls; // making a link to corresponding bike's script public void Start() { ctrlHub = GameObject.Find("gameScenario"); //link to GameObject with script "controlHub" outsideControls = ctrlHub.GetComponent <controlHub>(); //to connect c# mobile control script to this one myAnimator = GetComponent <Animator>(); lookPoint = camPoint;//use it if you want to rider look at anything when riding //need to know when bike crashed to launch a ragdoll bikeController = bikeRideOn.GetComponent <BikeController>(); myAnimator.SetLayerWeight(2, 0.0f); //to turn off layer with reverse animation which override all other }
private void Update() { if (gameOverScreen == null) { gameOverScreen = GameObject.FindGameObjectWithTag("GameOverScreen"); gameOverScreen.SetActive(false); } if (playerController == null) { playerController = Transform.FindObjectOfType <BikeController>(); } }
public BikePhysics(BikeController bikeController) { this.bikeController = bikeController; this._gravity = CalculateGravity(); this._airDensity = CalculateAirDensity(); // Use the value of going vertically straight up against gravity as the maximum force. this._maxForceForResistance = this._gravity * this._mass; this.heading = bikeController.Heading; this.pitch = bikeController.Pitch; }
private Vector3 _windVelocity = new Vector3(0, 0, 0); // magnitude is speed in m/s #endregion Fields #region Constructors public BikePhysics(BikeController bikeController) { this.bikeController = bikeController; this._gravity = CalculateGravity(); this._airDensity = CalculateAirDensity(); // Use the value of going vertically straight up against gravity as the maximum force. this._maxForceForResistance = this._gravity * this._mass; this.heading = bikeController.Heading; this.pitch = bikeController.Pitch; }
// Update is called once per frame void Update() { float distance = Mathf.Abs(team1.frame.transform.localPosition.z - team2.frame.transform.localPosition.z); BikeController winner = team1.frame.transform.localPosition.z > team2.frame.transform.localPosition.z ? team1 : team2; if (distance >= winDistance) { gameOver = true; endText.SetActive(true); team1.brakeToStop(); team2.brakeToStop(); team1.enabled = false; team2.enabled = false; musicPlayer.stopAll(); if (winner.alive) { winnerName.text = winner.gameObject.name; musicPlayer.playFanfare(); winner.alive = false; } // else { // winnerName.text = "No one"; // } } if (Input.GetButtonUp("Jump") && title.activeSelf) { // Start the game title.SetActive(false); countDownGo(); } if (Input.GetButtonUp("Jump") && gameOver) { Application.LoadLevel("main"); } if (Input.GetButtonUp("Cancel")) { Application.LoadLevel("main"); } if (Input.GetKey(KeyCode.Q)) { Application.Quit(); } }
IEnumerator SetSpeedometerSettings(string par) { if (par == "sport") { topSpeed = 210; stopAngle = -215; topSpeedAngle = 0; topRPM = 12000; stopRPMAngle = -200; topRPMAngle = 0; yield return(new WaitForSeconds(0.5f)); linkToBike = GameObject.Find("rigid_bike").GetComponent <BikeController>(); } }
public void PostTest() { // Arrange var mockBikeBll = new Mock <IBikeBll>(); var mapper = BikePortalMapper.Create(); var mockUserBll = new Mock <IUserBll>(); var mockUser = new Mock <User>(); mockUserBll.Setup(u => u.GetUser(It.IsAny <string>())).Returns(mockUser.Object); var controller = new BikeController(mockBikeBll.Object, mapper, mockUserBll.Object); const string description = "Wonderful bike"; const string model = "Model"; const string name = "Name"; const decimal price = 123M; // Act var bindingModel = new BikeBindingModel { Description = description, Model = model, Name = name, Price = price }; controller.Post(bindingModel); // Assert var bike = new Bike { Id = 0, Uploader = mockUser.Object, Comments = new List <Comment>(), Description = description, Model = model, Name = name, Price = price }; mockBikeBll.Verify(m => m.Add(bike)); }
private void Restart() { _faults++; // Destroy both player and bike game objects GameObject tmp = Utils.FilterTaggedObjectByParentAndName("Body", "Player Body", transform.parent.name); if (tmp != null) { Destroy(tmp); } if (activeBike != null) { BikeController bikeController = activeBike.GetComponent <BikeController>(); GameOver -= bikeController.FinishedGame; Destroy(activeBike); } // Instantiate bike activeBike = Instantiate(_bikePrefab); activeBike.name = "Bike"; activeBike.transform.parent = transform.parent; activeBike.transform.position = _checkpoint.BikeNewPosition(); Utils.SetLayer(activeBike.transform, gameObject.layer + 1); // Instantiate player tmp = Instantiate(_playerPrefab); tmp.name = "Player Body"; tmp.transform.parent = transform.parent; tmp.transform.position = _checkpoint.BikeNewPosition(); Utils.SetLayer(tmp.transform, gameObject.layer + 1); if (NewPlayer != null) { NewPlayer(activeBike); } }
void Start() { linkToBike = GetComponent <BikeController>(); }
public static void SetBikeController(BikeController bikeController) { UIOverlay.bikeController = bikeController; }
private void Awake() { _bikeController = FindObjectOfType<BikeController>(); _trialManager = GameObject.Find("TrialManager").GetComponent<TrialManager>(); }
/// <summary> /// Instantiate a new BikeSteering class that is connected to the given BikeController. /// </summary> /// <param name="bikeController">The BikeController this BikeSteering instance is for.</param> public BikeSteering(BikeController bikeController) : this(bikeController, null) { }
void SpawnPlayer() { Vector2 viewTopLeftCorner = new Vector2(-7, 4.5f); RaycastHit2D hit = Physics2D.Raycast((Vector2)cam.transform.position + viewTopLeftCorner, Vector2.down); player = (GameObject)Instantiate(playerPrefab, hit.point, Quaternion.identity); player.transform.parent = transform; playerController = player.GetComponent<BikeController>(); Invoke("PlayerGo", 0.16f); }
private void NewPlayerFinish(GameObject bike) { BikeController bikeController = bike.GetComponent <BikeController>(); GameOver += new PlayerFinish(bikeController.FinishedGame); }
/// <summary> /// Instantiate a new BikeSteering class that is connected to the given BikeController. /// </summary> /// <param name="bikeController">The BikeController this BikeSteering instance is for.</param> /// <param name="bikeSteeringCurve">Gets or sets an animation curve that we will use as a /// steering curve, mapping the calculated angle to a new angle defined by the steering curve. /// The x-axis represents a handles angle between 0.0 = 0 deg and 1.0 = 90 deg and the y-axis /// represents the new value to map a given handles angle to (again, with 0.0 = 0 deg and /// 1.0 = 90 deg). By default the steering curve used is the linear line y = x which has no /// effect. </param> public BikeSteering(BikeController bikeController, AnimationCurve bikeSteeringCurve) { this.bikeController = bikeController; this.SetRelativeLeftAndRightPoints(); this._steeringCurve = bikeSteeringCurve; }
public void SetUp() { mockMapper = new Mock <IMapper>(); mockService = new Mock <IBikeService>(); bikesController = new BikeController(mockMapper.Object, mockService.Object); }
void Start() { linkToBike = GameObject.Find("rigid_bike").GetComponent <BikeController>(); //linkToBike = GetComponent<BikeController>(); findCurrentBike(); }
public static void SetBikeController(BikeController bikeController) { UIDebugOverlay.bikeController = bikeController; }
// Start is called before the first frame update void Start() { bikeController = GetComponent <BikeController>(); terrain = GameObject.FindGameObjectWithTag("Terrain").GetComponent <TerrainGeneration>(); }
void Start() { gameOverScreen = GameObject.FindGameObjectWithTag("GameOverScreen"); gameOverScreen.SetActive(false); playerController = Transform.FindObjectOfType <BikeController>(); }