コード例 #1
0
        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());
        }
コード例 #2
0
ファイル: PauseMenu.cs プロジェクト: H-H11/NoBrakesPun
    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;
            }
        }
    }
コード例 #3
0
    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>();
    }
コード例 #4
0
ファイル: BikeAudio.cs プロジェクト: ArtoriasL/01_JohnWick
    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;
    }
コード例 #5
0
        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());
        }
コード例 #6
0
        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");
        }
コード例 #7
0
        public XSensGyroBridge(XSensGyro xsensGyro, BikeController bikeController)
        {
            this.xsensGyro      = xsensGyro;
            this.bikeController = bikeController;

            xsensGyro.OnStateChange   += XSensGyroStateChange;
            xsensGyro.OnDataAvailable += XSensGyroDataAvailable;
        }
コード例 #8
0
        public XSensGyroBridge(XSensGyro xsensGyro, BikeController bikeController)
        {
            this.xsensGyro = xsensGyro;
            this.bikeController = bikeController;

            xsensGyro.OnStateChange += XSensGyroStateChange;
            xsensGyro.OnDataAvailable += XSensGyroDataAvailable;
        }
コード例 #9
0
        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");
        }
コード例 #10
0
    private void Start()
    {
        bikeController = GetComponent <BikeController>();

        if (!arduinoConnector.useArduino && !useKeyboard)
        {
            bikeController.setRotationAndSpeed(new Vector2(0, keyBoardMaxSpeed));
        }
    }
コード例 #11
0
        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");
        }
コード例 #12
0
ファイル: BikerAnim.cs プロジェクト: ArtoriasL/01_JohnWick
    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
    }
コード例 #13
0
 private void Update()
 {
     if (gameOverScreen == null)
     {
         gameOverScreen = GameObject.FindGameObjectWithTag("GameOverScreen");
         gameOverScreen.SetActive(false);
     }
     if (playerController == null)
     {
         playerController = Transform.FindObjectOfType <BikeController>();
     }
 }
コード例 #14
0
        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;
        }
コード例 #15
0
        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;
        }
コード例 #16
0
    // 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();
        }
    }
コード例 #17
0
ファイル: SpeedoMeter.cs プロジェクト: ArtoriasL/01_JohnWick
    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>();
        }
    }
コード例 #18
0
        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));
        }
コード例 #19
0
    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);
        }
    }
コード例 #20
0
 void Start()
 {
     linkToBike = GetComponent <BikeController>();
 }
コード例 #21
0
 public static void SetBikeController(BikeController bikeController)
 {
     UIOverlay.bikeController = bikeController;
 }
コード例 #22
0
 private void Awake()
 {
     _bikeController = FindObjectOfType<BikeController>();
     _trialManager = GameObject.Find("TrialManager").GetComponent<TrialManager>();
 }
コード例 #23
0
 /// <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)
 {
 }
コード例 #24
0
 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);
 }
コード例 #25
0
    private void NewPlayerFinish(GameObject bike)
    {
        BikeController bikeController = bike.GetComponent <BikeController>();

        GameOver += new PlayerFinish(bikeController.FinishedGame);
    }
コード例 #26
0
 /// <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;
 }
コード例 #27
0
 public void SetUp()
 {
     mockMapper      = new Mock <IMapper>();
     mockService     = new Mock <IBikeService>();
     bikesController = new BikeController(mockMapper.Object, mockService.Object);
 }
コード例 #28
0
ファイル: SpeedoMeter.cs プロジェクト: ArtoriasL/01_JohnWick
 void Start()
 {
     linkToBike = GameObject.Find("rigid_bike").GetComponent <BikeController>();
     //linkToBike = GetComponent<BikeController>();
     findCurrentBike();
 }
コード例 #29
0
 /// <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;
 }
コード例 #30
0
 public static void SetBikeController(BikeController bikeController)
 {
     UIDebugOverlay.bikeController = bikeController;
 }
コード例 #31
0
ファイル: NPC.cs プロジェクト: rush86999/Biking-Simulator
 // Start is called before the first frame update
 void Start()
 {
     bikeController = GetComponent <BikeController>();
     terrain        = GameObject.FindGameObjectWithTag("Terrain").GetComponent <TerrainGeneration>();
 }
コード例 #32
0
 void Start()
 {
     gameOverScreen = GameObject.FindGameObjectWithTag("GameOverScreen");
     gameOverScreen.SetActive(false);
     playerController = Transform.FindObjectOfType <BikeController>();
 }
コード例 #33
0
 /// <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)
 {
 }