Move() public method

public Move ( float steering, float accel, float footbrake, float handbrake ) : void
steering float
accel float
footbrake float
handbrake float
return void
コード例 #1
0
ファイル: CarUserControl.cs プロジェクト: Regnac/GuideMe
        private void FixedUpdate()
        {
            if (photon)
            {
                if (myPhotonView.IsMine)
                {
                    // pass the input to the car!
                    float h = CrossPlatformInputManager.GetAxis("Horizontal");
                    float v = CrossPlatformInputManager.GetAxis("Vertical");
#if !MOBILE_INPUT
                    float handbrake = CrossPlatformInputManager.GetAxis("Jump");
                    m_Car.Move(h, v, v, handbrake);
#else
                    m_Car.Move(h, v, v, 0f);
#endif
                }
            }
            else
            {            // pass the input to the car!
                float h = CrossPlatformInputManager.GetAxis("Horizontal");
                float v = CrossPlatformInputManager.GetAxis("Vertical");
#if !MOBILE_INPUT
                float handbrake = CrossPlatformInputManager.GetAxis("Jump");
                m_Car.Move(h, v, v, handbrake);
#else
                m_Car.Move(h, v, v, 0f);
#endif
            }
        }
コード例 #2
0
ファイル: CarUserControl.cs プロジェクト: x3n0r/BouncyCars
        private void FixedUpdate()
        {
            // pass the input to the car!
            if (gameObject.transform.name == "Player1")
            {
                float h = CrossPlatformInputManager.GetAxis("Horizontal");
                float v = CrossPlatformInputManager.GetAxis("Vertical");
#if !MOBILE_INPUT
                float handbrake = CrossPlatformInputManager.GetAxis("Jump");
                m_Car.Move(h, v, v, handbrake);
#else
                m_Car.Move(h, v, v, 0f);
#endif
            }
            else if (gameObject.transform.name == "Player2")
            {
                float h = CrossPlatformInputManager.GetAxis("Horizontal_P2");
                float v = CrossPlatformInputManager.GetAxis("Vertical_P2");
#if !MOBILE_INPUT
                float handbrake = CrossPlatformInputManager.GetAxis("Jump_P2");
                m_Car.Move(h, v, v, handbrake);
#else
                m_Car.Move(h, v, v, 0f);
#endif
            }
        }
コード例 #3
0
        void FixedUpdate()
        {
            // pass the input to the car!
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            float v = CrossPlatformInputManager.GetAxis("Vertical");

            if (Fuel > 0)                                                                                                       // check if car have fuel, if yes allow player to play
            {
                CarController.m_Topspeed = MaxSpeed;                                                                            //get the max speed from managercar script and set it in CarController
                if (CrossPlatformInputManager.GetAxis("Vertical") == 1 || CrossPlatformInputManager.GetAxis("Vertical") == -1)  //check if car is moving/driving :p
                {
                    moving = true;
                }
                else
                {
                    moving = false;
                }
            }
            else if (Fuel <= 0)
            {
                CarController.m_Topspeed = 7.5f;
            }
#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(h, v, v, handbrake);
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #4
0
        private void FixedUpdate()
        {
            // ### High level controls ###
            int oldControl = HighLevelControl;

            if (Input.GetKey(KeyCode.I))
            {
                HighLevelControl = 0;
            }
            else if (Input.GetKey(KeyCode.J))
            {
                HighLevelControl = 1;
            }
            else if (Input.GetKey(KeyCode.L))
            {
                HighLevelControl = 2;
            }
            if (oldControl != HighLevelControl)
            {
                m_Car.setHighLevelControl(HighLevelControl);
            }

            // If holding down W or S control the car manually
            if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S))
            {
                s.UpdateValues();
                m_Car.Move(s.H, s.V, s.V, 0f);
            }
            else

            {
                m_Car.Move(SteeringAngle, Acceleration, Acceleration, 0f);
            }
        }
コード例 #5
0
        private void FixedUpdate()
        {
            // pass the input to the car!
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            ////print("H" + (h * 10000).ToString());
            float v = CrossPlatformInputManager.GetAxis("Vertical");

            ////print("V" + v.ToString());
#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            if (input_destination.transform.childCount > 0)
            {
                //m_Car.Move(h, v, v, handbrake);
                ////print(input_destination.transform.GetChild(0).GetChild(0).GetComponent<TMP_Text>().text);
                text = input_destination.transform.GetChild(0).GetChild(0).GetComponent <TMP_Text>();
                ////debug.log("THE CAR MAX SPEED CHOSEN IS " + m_Car.m_Topspeed.ToString());
                if (text.text == "nothing")
                {
                    m_Car.Move(0, v, v, 0);
                }
            }
            else
            {
                m_Car.Move(0, 0, 0, 0);
            }
#else
            //m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #6
0
ファイル: CarUserControl.cs プロジェクト: Vovanni/Selo
        void FixedUpdate()
        {
            // pass the input to the car!
            h = CrossPlatformInputManager.GetAxis("Horizontal");
            v = CrossPlatformInputManager.GetAxis("Vertical");
#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            //ѕь¤нь наносит ответный удар
            drunk = Counter.drunk;
            if (drunk != 0)
            {
                h += UnityEngine.Random.Range(-0.1f * drunk, 0.1f * drunk);
                if (h > 1f)
                {
                    h = 1f;
                }
                if (h < -1f)
                {
                    h = -1f;
                }
            }


            m_Car.Move(h, v, v, handbrake);
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #7
0
        private void FixedUpdate()
        {
            ////debug.log(FORWARD);
            ////debug.log(TURN);
            // pass the input to the car!
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            ////print("H" + (h * 10000).ToString());
            float v = CrossPlatformInputManager.GetAxis("Vertical");

            ////print("V" + v.ToString());
#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            //m_Car.Move(5, 2, v, handbrake)
            ////debug.log(FORWARD);
            m_Car.Move(TURN, FORWARD, 0, 0);
            if (drop1.transform.childCount > 0)
            {
                ////debug.log("drop1transform");
                pausecanvas.gameObject.SetActive(true);
                FORWARD = float.Parse(drop1.transform.GetChild(0).transform.GetChild(1).GetComponent <TMP_Text>().text);
                Destroy(barrier);
                dragAndDropCanvas.SetActive(false);
                m_Car.Move(TURN, FORWARD, 0, 0);
                m_Car.m_Topspeed = FORWARD;
            }
            ////debug.log("before entered the second drag and drop canvas");
            //pausecanvas.gameObject.SetActive(false);
            if (drop2.transform.childCount > 0)
            {
                pausecanvas.gameObject.SetActive(true);
                ////debug.log("entered the second drag and drop canvas");
                TURN = (float.Parse(drop2.transform.GetChild(0).transform.GetChild(1).GetComponent <TMP_Text>().text)) / 100;
                dragAndDropCanvas2.SetActive(false);
                m_Car.Move(TURN, FORWARD, 0, 0);
                ////debug.log("MOVELEVEL1SCENE2");
                Time.timeScale = 1;
            }

            IEnumerator Example2(float time)
            {
                ////debug.log("It reached here2");
                timeDone2 = false;
                yield return(new WaitForSeconds((float)time));

                timeDone2 = true;
                ////debug.log("It reached here3" + timeDone2.ToString());
            }

            IEnumerator Example3(float time)
            {
                timeDone3 = false;
                yield return(new WaitForSeconds((float)time));

                timeDone3 = true;
                ////debug.log("It reached here4" + timeDone2.ToString());
            }
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #8
0
ファイル: CarAI.cs プロジェクト: cire96/multiagent_A3
        void calculateBearing()
        {
            CarAI otherCarAI = carHit.GetComponent <CarAI>();

            ourDis = ownPath.Count - targetIndex;                                      //-(0.1f*temp);//Vector3.Distance(transform.position,goal_pos);
            float otherDis = otherCarAI.ownPath.Count - otherCarAI.targetIndex;        //-(0.1f*otherCarAI.temp);//Vector3.Distance(carHit.transform.position,otherCarAI.goal_pos);

            if (Aggressiveness < otherCarAI.Aggressiveness && !pathsCross(otherCarAI)) //ourDis>otherDis
            {
                temp++;
                waitTimer = 50;
                Vector3 vel = m_Car.GetComponent <Rigidbody>().velocity;
                if (transform.InverseTransformDirection(vel).z > 0.01)
                {
                    newSpeed  = -1;
                    handBrake = 1;
                }
                else if (transform.InverseTransformDirection(vel).z < -0.01)
                {
                    newSpeed  = 1;
                    handBrake = 1;
                }
                else
                {
                    newSpeed  = 0;
                    handBrake = 1;
                }
                m_Car.Move(0, newSpeed, newSpeed, handBrake);
            }

            else
            {
                followPath();
            }
        }
コード例 #9
0
        private void FixedUpdate()
        {
            if (!m_gameController.Pause && !m_gameController.Finished)
            {
                // pass the input to the car!
                float h = CrossPlatformInputManager.GetAxis("Horizontal");
                float v = CrossPlatformInputManager.GetAxis("Vertical");

                // pass the input to the camera
                if (Input.GetButton("Mouse Left"))
                {
                    m_Camera.Rotate(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));
                }
                m_Camera.Rotate(Input.GetAxis("Joystick X"), Input.GetAxis("Joystick Y"));

                m_Camera.Switch(Input.GetButton("Mouse Right"));

#if !MOBILE_INPUT
                float handbrake = Input.GetAxis("Handbreak");
                m_Car.Move(h, v, v, handbrake);
#else
                m_Car.Move(h, v, v, 0f);
#endif
            }
        }
コード例 #10
0
ファイル: CarUserControl.cs プロジェクト: 17426/DS2019-09
        private void FixedUpdate()
        {
            // pass the input to the car!
            h1 = CrossPlatformInputManager.GetAxis("Horizontal");
            if (-0.35f > h1 || h1 < 0.35f)
            {
                h = h1 * 1.8f;
            }
            v1 = CrossPlatformInputManager.GetAxis("Vertical");

            v = (v1 + 0.99f) / 2.0f;

            footbrake = v1 * 0.0005f;



#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");



            m_Car.Move(h, v, footbrake, handbrake);
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
        private void FixedUpdate()
        {
            // pass the input to the car!
            //if (h >= 0.5 && h <= 0.7 || h >= -0.5 && h <= -0.7 ) {
            //h = CrossPlatformInputManager.GetAxis ("Horizontal");
            //}

            //if (h >= 0.5 && h <= 0.7 || h >= -0.5 && h <= -0.7 ) {
            h = GvrController.Orientation.y;
            //}

            v = CrossPlatformInputManager.GetAxis("Vertical");

            if (GvrController.IsTouching)
            {
                v = 1;
            }

#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(h, v, v, handbrake);
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #12
0
ファイル: CarUserControl.cs プロジェクト: ShunIshii/Accerace
        private void FixedUpdate()
        {
            if (RaceSceneManager.isRacing)
            {
                // pass the input to the car!
                float h = CrossPlatformInputManager.GetAxis("Horizontal");
                float v = CrossPlatformInputManager.GetAxis("Vertical");

                if (isAccelButtonPushing)
                {
                    v += 1;
                }
                if (isBrakeButtonPushing)
                {
                    v -= 1;
                }

                h += Input.acceleration.x * 0.5f;

#if !MOBILE_INPUT
                float handbrake = CrossPlatformInputManager.GetAxis("Jump");
                m_Car.Move(h, v, v, handbrake);
#else
                m_Car.Move(h, v, v, 0f);
#endif
            }
        }
コード例 #13
0
        private void FixedUpdate()
        {
            // pass the input to the car!

            if (generateData == true)
            {
                h = CrossPlatformInputManager.GetAxis("Horizontal");
                v = CrossPlatformInputManager.GetAxis("Vertical");
            }
            else if (driveCar == true)
            {
                h = CrossPlatformInputManager.GetAxis("Horizontal");
                v = CrossPlatformInputManager.GetAxis("Vertical");
                h = netConn.SteeringAngleTest;
                v = netConn.ThrottleTest;
            }

#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(h, v, v, handbrake);
            //Debug.Log(h);
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #14
0
        private void FixedUpdate()
        {
            if (!isLocalPlayer)
            {
                return;
            }
            //   cam.Render();

            //    RenderTexture targetTexture = cam.targetTexture;

            //    RenderTexture.active = targetTexture;


            //   Texture2D texture2D = new Texture2D (targetTexture.width, targetTexture.height, TextureFormat.RGB24, false);
            //    texture2D.ReadPixels (new Rect (0, 0, targetTexture.width, targetTexture.height), 0, 0);
            //    texture2D.Apply ();
            //   byte[] image = texture2D.EncodeToJPG ();
            //  UnityEngine.Object.DestroyImmediate (texture2D);
            //  CompressedImageMsg msg = new CompressedImageMsg(new HeaderMsg(0, new TimeMsg(0,0),"cam"), "jpeg", image);
            //   ros.Publish(CompressedImageMsg.GetMessageTopic(), msg);
            // If holding down W or S control the car manually
            if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || true)
            {
                s.UpdateValues();
//		s.H = 0f;
//		s.V = 0.2f;
                m_Car.Move(s.H, s.V, s.V, 0f);
            }
            else
            {
                m_Car.Move(SteeringAngle, Acceleration, Acceleration, 0f);
            }
        }
コード例 #15
0
        private void FixedUpdate()
        {
            if (Input.GetAxis("GearDown") > 0.5f && currentGear >= -1f)
            {
                currentGear = currentGear - 1f;
            }
            else if (Input.GetAxis("GearUp") > 0.5f && currentGear <= 1f)
            {
                currentGear = currentGear + 1f;
            }

            // pass the input to the car!
            float h = CrossPlatformInputManager.GetAxis("Horizontal");

            //float v = CrossPlatformInputManager.GetAxis("Vertical");

            Debug.Log(currentGear);
            bool  speed = CrossPlatformInputManager.GetButton("Speed");
            float v     = 0f;

            if (speed)
            {
                v = currentGear * 1;
            }



#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(h, v, v, handbrake);
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #16
0
        private void FixedUpdate()
        {
            // pass the input to the car!
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            float v = CrossPlatformInputManager.GetAxis("Vertical");

#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(h, v, v, handbrake);


            if (Input.GetButtonDown("Fire3") && turbo)
            {
                m_Car.m_FullTorqueOverAllWheels = 500000;
                StartCoroutine(turboTime());
            }
            if (Input.GetButtonDown("Fire3") && overload)
            {
                GetComponent <ProgressBar>().overload();
                source.PlayOneShot(overloadClip);
                OverLoad.SetActive(false);
            }
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #17
0
ファイル: CarRemoteControl.cs プロジェクト: azshue/SAAP
        private void Update()
        {
            statistics();
            updateCheckpoints();
            //Bounds bbx = GetMaxBounds(mainCar);

            if (useExpert)
            {
                drive();
            }

            // If holding down W or S control the car manually
            if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D))
            {
                s.UpdateValues();
                //Debug.Log("s.v " + s.V);
                m_Car.Move(s.H, s.V, s.V, 0f);
            }
            else
            {
//                 Debug.Log("m_Car.CurrentSpeed " + m_Car.CurrentSpeed.ToString());
//                 Debug.Log("Acceleration " + Acceleration.ToString());
//                 Debug.Log("SteeringAngle " + SteeringAngle.ToString());
//                 adjustAcceleration();
//                 Debug.Log("SteeringAngle " + SteeringAngle.ToString());
                if (UpdatedFlag || useExpert)
                {
                    UpdatedFlag = false;
                    m_Car.Move(SteeringAngle, Acceleration, Acceleration, 0f);
                }
            }
        }
コード例 #18
0
    private void BetterDrive()
    {
        if (selfDriving == false)
        {
            float h = Input.GetAxis("Horizontal");
            float v = Input.GetAxis("Vertical");

            m_Car.Move(h, v, v, 0);
        }
        else
        {
            float[] preds = Predict(activationOnLast: true, lastActivationFunc: "TanH");

            float predictH = preds[0];
            horizontal += FixPrediction(predictH, horizontal, "TanH", biased: false, vertical: false);

            float predictV = preds[1];
            vertical += FixPrediction(predictV, vertical, "TanH", biased: false, vertical: true);

            float predBrake = preds[2] > 0 ? 1 : 0;

            m_Car.Move(horizontal, vertical, vertical, predBrake);
        }

        DoRaycast();
    }
コード例 #19
0
ファイル: CarAI.cs プロジェクト: Jonrunar95/DD2438-A1
 private void FixedUpdate()
 {
     iter++;
     sinceLastChange += m_Car.CurrentSpeed * t;
     if (Done)
     {
         m_Car.Move(0f, 0f, 0f, 1f);
     }
     else
     {
         //UnityEngine.Debug.Log("----------------------------- Iteration: " + iter + " -----------------------------");
         if (nextPoint)
         {
             sinceLastChange += 1;
             if (sinceLastChange > 4)
             {
                 next++;
                 sinceLastChange = 0;
                 nextPoint       = false;
                 if (nextnext <= next)
                 {
                     nextnext++;
                 }
             }
         }
         car_pos = new Vector3(transform.position.x, 0, transform.position.z);
         //UnityEngine.Debug.Log(next + "/" + my_path.Count);
         float[] results = Steer(car_pos, my_path[next].pos);
         float   steer   = -results[1] / max_steer_angle;
         //UnityEngine.Debug.Log(" Steer: " + steer + " velocity: " + m_Car.CurrentSpeed + " accel: " + results[0] + " Brake: " + results[2]);
         m_Car.Move(steer, results[0], 0f, results[2]);
     }
 }
コード例 #20
0
        private void FixedUpdate()
        {
            // pass the input to the car!
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            float v = CrossPlatformInputManager.GetAxis("Vertical");

#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(h, v, v, handbrake);

            //Debug.Log("InputKey h:" + h + " v:" + v + " hb:" + handbrake);

            //if (beforeSteering != h || beforeAccel != v || beforeFootbrake != v || beforeHandbrake != handbrake)
            //{

            if ((v == 0 && beforeAccel != 0.0f))
            {
                beforeSteering  = h;
                beforeAccel     = v;
                beforeFootbrake = v;
                beforeHandbrake = handbrake;

                PK_C_REQ_MOVE packet = new PK_C_REQ_MOVE();
                packet.userNumber = GameManager.getInstance.userCar;
                packet.steering   = h;
                packet.accel      = v;
                packet.footbrake  = v;
                packet.handbrake  = handbrake;

                //Debug.Log("count : " + count.ToString() + "userNumber : " + packet.userNumber.ToString() + "sterring : " + packet.steering.ToString() + " accel : " + packet.accel.ToString());


                GameNetWork.getInstance.sendPacket(packet);
            }


            if (h != 0.0f || v != 0.0f || handbrake != 0.0f)
            {
                beforeSteering  = h;
                beforeAccel     = v;
                beforeFootbrake = v;
                beforeHandbrake = handbrake;

                PK_C_REQ_MOVE packet = new PK_C_REQ_MOVE();
                packet.userNumber = GameManager.getInstance.userCar;
                packet.steering   = h;
                packet.accel      = v;
                packet.footbrake  = v;
                packet.handbrake  = handbrake;

                //Debug.Log("count : " + count.ToString() + "userNumber : " + packet.userNumber.ToString() + "sterring : " + packet.steering.ToString() + " accel : " + packet.accel.ToString());


                GameNetWork.getInstance.sendPacket(packet);
            }
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #21
0
        private void FixedUpdate()
        {
            if (Input.GetKeyDown(KeyCode.Alpha0))
            {
                PlayerPrefs.SetInt("Highscore", 0);
            }


            textScore.text = "Score: " + score.ToString();


            if (transform.position.z > PlayerPrefs.GetInt("Highscore"))
            {
                textHighScore.text = "Highscore: " + score.ToString();
            }
            else
            {
                textHighScore.text = "Highscore: " + PlayerPrefs.GetInt("Highscore").ToString();
            }

            if (disabled)
            {
                if (Input.GetKeyDown(KeyCode.R))
                {
                    Enable();
                }
            }
            else
            {
                score = (int)transform.position.z;
            }


            if (disabled)
            {
                return;
            }

            // if (!    (transform.eulerAngles.z > -1 && transform.eulerAngles.z < 1)   )
            if (transform.up.y <= 0)
            {
                // Debug.Log("Hit: " + transform.eulerAngles.z);
                Disable();
            }


            // pass the input to the car!
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            float v = CrossPlatformInputManager.GetAxis("Vertical");

#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(h, v, v, handbrake);
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #22
0
        private void FixedUpdate()
        {
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            //float v = CrossPlatformInputManager.GetAxis("Vertical");
            float v         = 0.04f;
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");

            m_Car.Move(h, v, v, handbrake);
            m_Car.Move(h, v, v, 0f);
        }
コード例 #23
0
ファイル: CarUserControl.cs プロジェクト: TolyaPGG/unity
        private void FixedUpdate()
        {
            float h = Input.GetAxis("Horizontal");
            float v = Input.GetAxis("Vertical");

            float handbrake = Input.GetAxis("Jump");

            m_Car.Move(h, v, v, handbrake);
            m_Car.Move(h, v, v, 0f);
        }
コード例 #24
0
        private void FixedUpdate()
        {
            // pass the input to the car!
#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(horizontal, vertical, vertical, handbrake);
#else
            m_Car.Move(horizontal, vertical, vertical, 0f);
#endif
        }
コード例 #25
0
        private void FixedUpdate()
        {
            // pass the input to the car!
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            ////print("H" + (h * 10000).ToString());
            float v = CrossPlatformInputManager.GetAxis("Vertical");

            ////print("V" + v.ToString());
#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            //m_Car.Move(5, 2, v, handbrake)
            if (drop1.transform.childCount > 0 & drop2.transform.childCount > 0 & drop3.transform.childCount > 0)
            {
                ////debug.log(drop1.transform.childCount > 0);
                ////debug.log(drop2.transform.childCount > 0);
                ////debug.log(drop3.transform.childCount > 0);
                if (change_if_content)
                {
                    change_if_content = false;
                    List <float> countdownlist = new List <float>();
                    countdownlist.Add(float.Parse(drop3.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text));
                    countdownlist.Add(float.Parse(drop2.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text));
                    countdownlist.Add(float.Parse(drop1.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text));
                    ////debug.log(countdownlist);
                    lst.text = lst.text + drop3.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text + drop2.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text + drop1.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text + "]";
                    if ((drop3.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text == "3" & drop2.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text == "2" & drop1.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text == "1") || (drop3.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text == "1" & drop2.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text == "2" & drop1.transform.GetChild(0).transform.GetChild(0).GetComponent <TMP_Text>().text == "3"))
                    {
                        feedback.text = "Nice Timer!";
                    }
                }
                //Pause.SetActive(true);
                if (!entered)
                {
                    StartCoroutine(CountdownTimer());
                }
                ////debug.log(timeDone.ToString() + "timeDone");
                ////debug.log(timeDone2.ToString() + "timeDone2");
                dragAndDropCanvas.SetActive(false);
                watchCodeExecution.SetActive(true);
                if (drive)
                {
                    if (timer != 0)
                    {
                        m_Car.Move(0, 2, 0, 0);
                    }
                    timer--;
                    lst.color            = new Color32(150, 20, 45, 45);
                    forLoop.color        = new Color32(150, 20, 45, 45);
                    forLoopContent.color = new Color32(150, 20, 45, 45);
                }
            }
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #26
0
        //private CarController m_Car; // the car controller we want to use


        /* private void Awake()
         * {
         *   // get the car controller
         *   m_Car = GetComponent<CarController>();
         * }*/


        private void FixedUpdate()
        {
            // pass the input to the car!
            //float h = CrossPlatformInputManager.GetAxis("Horizontal");
            //float v = CrossPlatformInputManager.GetAxis("Vertical");
#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(gz, 0, handbrake);
#else
            m_Car.Move(h, 0, 0f);
#endif
        }
コード例 #27
0
        private void FixedUpdate()
        {
            float m_h = CrossPlatformInputManager.GetAxis("Horizontal");
            float m_v = CrossPlatformInputManager.GetAxis("Vertical");

                        #if !MOBILE_INPUT
            float m_handbrake = CrossPlatformInputManager.GetAxis("Jump");
            m_Car.Move(m_h, m_v, m_v, m_handbrake);
                        #else
            m_Car.Move(m_h, m_v, m_v, 0f);
                        #endif
        }
コード例 #28
0
ファイル: SocketClient.cs プロジェクト: pkusunbx/sensorCar
        public void Update()
        {
            if (!doNetSteer || netControl == false)
            {
                float h         = CrossPlatformInputManager.GetAxis("Horizontal");
                float v         = CrossPlatformInputManager.GetAxis("Vertical");
                float handbrake = CrossPlatformInputManager.GetAxis("Jump");

                carController.Move(h, v, v, handbrake);
            }
            else if (netControl && CrossPlatformInputManager.GetAxis("Horizontal") != 0)
            {
                float h = CrossPlatformInputManager.GetAxis("Horizontal");
                float v = 0f;

                if (doAutoAccelerate)
                {
                    v = verticalInput;
                }
                else if (doIgnoreVertical == false)
                {
                    v = CrossPlatformInputManager.GetAxis("Vertical");
                }

                float handbrake = CrossPlatformInputManager.GetAxis("Jump");
                carController.Move(h, v, v, handbrake);
            }
            else if (netControl && doRecord)
            {
                doRecord = false;

                // collect data
                data = new Dictionary <string, string> ();

                for (int i = 0; i < carSensor.distances.Count; i++)
                {
                    if (float.IsInfinity(carSensor.distances [i]))
                    {
                        doRecord = true;
                        return;
                    }
                    else
                    {
                        data ["s" + i.ToString()] = carSensor.distances [i].ToString();
                    }
                }

                Debug.Log(new JSONObject(data));

                socket.Emit("evaluate", new JSONObject(data));
            }
        }
コード例 #29
0
        private void FixedUpdate()
        {
            // pass the input to the car!
            float h = CrossPlatformInputManager.GetAxis("Horizontal");
            float v = CrossPlatformInputManager.GetAxis("Accelerate");

#if !MOBILE_INPUT
            float handbrake = CrossPlatformInputManager.GetAxis("Handbrake");
            m_Car.Move(h, v, v, handbrake);
#else
            m_Car.Move(h, v, v, 0f);
#endif
        }
コード例 #30
0
 private void FixedUpdate()
 {
     // If holding down W or S control the car manually
     if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D))
     {
         s.UpdateValues();
         m_Car.Move(s.H, s.V, s.V, 0f);
     }
     else
     {
         m_Car.Move(SteeringAngle, Acceleration, Acceleration, 0f);
     }
 }