Пример #1
0
    void OnTriggerStay(Collider col)
    {
        inWind = IN_WIND.IN;

        // Replace get component ???
        gc = col.GetComponent <GlideController>();


        if (gc != null)
        {
            if (forceApplication == FORCE_APPLICATION.INSTANT)
            {
                gc.WindVelocity = windIntensity * transform.right;

                // high +ve values = high tailwind, high -ve = headwind, zero = wind is side-on
                float tailwind = Vector3.Dot(gc.transform.forward, transform.right) * windIntensity;
                //gc.acceleration += tailwind * Time.deltaTime * boostPercentage;
                gc.acceleration += tailwind * Time.deltaTime;
                //Debug.Log(gc.acceleration);
            }
            else if (forceApplication == FORCE_APPLICATION.SLOWLY)
            {
                if (wind < windIntensity)
                {
                    wind++;
                }

                gc.WindVelocity = wind * transform.right;

                // high +ve values = high tailwind, high -ve = headwind, zero = wind is side-on
                float tailwind = Vector3.Dot(gc.transform.forward, transform.right) * wind;
                //gc.acceleration += tailwind * Time.deltaTime * boostPercentage;
                gc.acceleration += tailwind * Time.deltaTime;
                //Debug.Log(wind);
            }
            else if (forceApplication == FORCE_APPLICATION.QUICKLY)
            {
                if (wind < windIntensity)
                {
                    wind += 3;
                }

                gc.WindVelocity = wind * transform.right;

                // high +ve values = high tailwind, high -ve = headwind, zero = wind is side-on
                float tailwind = Vector3.Dot(gc.transform.forward, transform.right) * wind;
                //gc.acceleration += tailwind * Time.deltaTime * boostPercentage;
                gc.acceleration += tailwind * Time.deltaTime;
                //Debug.Log(wind);
            }
        }
    }
Пример #2
0
 void OnTriggerExit(Collider col)
 {
     inWind = IN_WIND.OUT;
     wind   = 0;
 }