Ejemplo n.º 1
0
    private void _RainLoop()
    {
        FieldMap fieldmap = PersistenSingleton <EventEngine> .Instance.fieldmap;

        if (fieldmap == (UnityEngine.Object)null)
        {
            return;
        }
        BGCAM_DEF currentBgCamera = fieldmap.GetCurrentBgCamera();

        for (Int32 i = 0; i < this.numRain; i++)
        {
            FieldRainRenderer.Rain rain = this.rainList[i];
            this._RTPTRain(rain, this.speed, this.gen);
            Vector3 p  = PSX.CalculateGTE_RTPT_POS(rain.p0, Matrix4x4.identity, currentBgCamera.GetMatrixR(), currentBgCamera.GetViewDistance(), fieldmap.GetProjectionOffset(), false);
            Vector3 p2 = PSX.CalculateGTE_RTPT_POS(rain.p1, Matrix4x4.identity, currentBgCamera.GetMatrixR(), currentBgCamera.GetViewDistance(), fieldmap.GetProjectionOffset(), false);
            Vector3 p3 = PSX.CalculateGTE_RTPT_POS(rain.p2, Matrix4x4.identity, currentBgCamera.GetMatrixR(), currentBgCamera.GetViewDistance(), fieldmap.GetProjectionOffset(), false);
            rain.p0   = p;
            rain.p1   = p2;
            rain.p2   = p3;
            rain.col0 = new Color(0f, 0f, 0f, 1f);
            Int32 num  = (Int32)p.z;
            Int32 num2 = num >> 6;
            Int32 num3 = 240;
            num3     -= num2;
            rain.col1 = new Color((Single)num3 / 255f, (Single)num3 / 255f, (Single)num3 / 255f, 1f);
        }
    }
Ejemplo n.º 2
0
    private void _RTPTRain(FieldRainRenderer.Rain p, Int32 rainSpeed, Int32 hold)
    {
        Vector3 pos = p.pos;

        p.p0   = pos;
        p.p1   = pos;
        p.p1.y = p.p1.y - (Single)rainSpeed;
        if (hold == 0)
        {
            p.pos = p.p1;
        }
        p.p2   = p.p1;
        p.p2.y = p.p2.y - (Single)rainSpeed;
    }
Ejemplo n.º 3
0
    private void _GenerateRain(Int32 height)
    {
        Int32 num = this.strength;

        this.numRain = 0;
        this.over    = 0;
        for (Int32 i = 0; i < num; i++)
        {
            if (this.numRain == this.maxRain)
            {
                this.over = 1;
                break;
            }
            if (this.rainList[i].pos.y > -2000f)
            {
                FieldRainRenderer.Rain rain = this.rainList[i];
                rain.pos.y = rain.pos.y - (Single)this.speed;
                this.numRain++;
            }
            else
            {
                UInt32 num2 = this._rnd521();
                UInt32 num3 = num2 << 16;
                num3 >>= 19;
                UInt32 num4 = num3 & 65535u;
                if (this.isIifaTreeMap)
                {
                    this.rainList[i].pos.x = (Single)UnityEngine.Random.Range(-2000, 4000) + this.posOffset.x;
                    this.rainList[i].pos.y = (Single)UnityEngine.Random.Range(1500, 2000) + this.posOffset.y;
                    this.rainList[i].pos.z = (Single)UnityEngine.Random.Range(800, 2200) + this.posOffset.z;
                }
                else
                {
                    this.rainList[i].pos.x = (Single)((Int32)((Int16)num4) * this._rndSign()) * 0.5f;
                    num3  = (num2 & 255u);
                    num3 += (UInt32)height;
                    this.rainList[i].pos.y = (Single)((Int16)num3);
                    num3 = num2 >> 19;
                    this.rainList[i].pos.z = (Single)((Int32)((Int16)num3) * this._rndSign()) * 0.5f;
                }
                this.numRain++;
            }
        }
    }
Ejemplo n.º 4
0
 private void OnPostRender()
 {
     if (PersistenSingleton <SceneDirector> .Instance.IsFading)
     {
         return;
     }
     if (this.numRain == 0)
     {
         return;
     }
     GL.PushMatrix();
     this.mat.SetPass(0);
     GL.LoadOrtho();
     GL.Begin(7);
     for (Int32 i = 0; i < this.numRain; i++)
     {
         FieldRainRenderer.Rain rain = this.rainList[i];
         Vector3 p  = rain.p0;
         Vector3 p2 = rain.p1;
         Vector3 p3 = rain.p2;
         p.x  -= this.offset.x;
         p2.x -= this.offset.x;
         p3.x -= this.offset.x;
         p.y  -= this.offset.y;
         p2.y -= this.offset.y;
         p3.y -= this.offset.y;
         p.x  /= FieldMap.PsxFieldWidth;
         p2.x /= FieldMap.PsxFieldWidth;
         p3.x /= FieldMap.PsxFieldWidth;
         p.y  /= FieldMap.PsxFieldHeightNative;
         p2.y /= FieldMap.PsxFieldHeightNative;
         p3.y /= FieldMap.PsxFieldHeightNative;
         p.z   = 0f;
         p2.z  = 0f;
         p3.z  = 0f;
         this.DrawFieldRain(p, p2, rain.col0, rain.col1);
         this.DrawFieldRain(p2, p3, rain.col1, rain.col0);
     }
     GL.End();
     GL.PopMatrix();
 }