Exemplo n.º 1
0
        public void TwoColorTest()
        {
            var g   = GraphSample();
            var dfs = new TwoColor(g);

            Assert.False(dfs.IsBipartite());
        }
Exemplo n.º 2
0
    // checks if the wheels are spinning and is so does three things
    // 1) emits particles
    // 2) plays tiure skidding sounds
    // 3) leaves skidmarks on the ground
    // these effects are controlled through the WheelEffects class
    private void CheckForWheelSpin()
    {
        // loop through all wheels

        bool allWheelHit = true;
        int  col         = 2;

        for (int i = 0; i < 4; i++)
        {
            // WheelHit wheelHit;
            //  m_WheelColliders[i].GetGroundHit(out wheelHit);
            if (!m_WheelColliders[i].isGrounded)
            {
                col--;
            }

            if (col < 0)
            {
                allWheelHit = false;
                break;
            }


            m_WheelColliders[i].GetComponent <Probuksovka>().ProbuksovkaEmit();

            //  m_WheelColliders[i].GetComponent<Probuksovka>().RideEffectEmit();
        }

        if (allWheelHit)
        {
            ParticleSystem particleSystem = rideEffect.GetParticle();
            Quaternion     quater         = Quaternion.LookRotation(m_Rigidbody.velocity.normalized);
            quater *= Quaternion.Euler(0, 180, 0);
            particleSystem.transform.rotation = Quaternion.Slerp(particleSystem.transform.rotation, quater, Time.deltaTime * 5);

            TwoColor twoColor = particleSystem.GetComponent <TwoColor>();
            Color    color    = particleSystem.startColor;

            if (twoColor != null)
            {
                if (UnityEngine.Random.Range(1, 3) == 1)
                {
                    color = twoColor.color1;
                }
                else
                {
                    color = twoColor.color2;
                }
            }

            color.a = color.a * CurrentSpeed / MaxSpeed;
            particleSystem.startColor = color;

            if (!particleSystem.loop)
            {
                rideEffect.PlayLoop();
            }
        }
        else
        {
            rideEffect.StopLoop();
        }


        // is the tire slipping above the given threshhold
        // if (Mathf.Abs(wheelHit.forwardSlip) >= m_SlipLimit || Mathf.Abs(wheelHit.sidewaysSlip) >= m_SlipLimit)
        //  {
        //      m_WheelEffects[i].EmitTyreSmoke();

        // avoiding all four tires screeching at the same time
        // if they do it can lead to some strange audio artefacts

        /*
         * if (!AnySkidSoundPlaying())
         * {
         *  m_WheelEffects[i].PlayAudio();
         * }
         * //         continue;*/
        //     }

        /*
         * // if it wasnt slipping stop all the audio
         * if (m_WheelEffects[i].PlayingAudio)
         * {
         *  m_WheelEffects[i].StopAudio();
         * }
         * // end the trail generation*/
        // m_WheelEffects[i].EndSkidTrail();
        //}
    }