public override void Update()
        {
            if (GameMode.started)
            {
                Level.Remove((Thing)this);
            }
            this.distOut = Lerp.FloatSmooth(this.distOut, 16f, 0.08f, 1.2f);
            this.distLen = Lerp.FloatSmooth(this.distLen, 10f, 0.08f, 1.2f);
            this.rot     = Lerp.FloatSmooth(this.rot, 45f, 0.08f, 1.1f);
            if ((double)Math.Abs(this.rot - 45f) < 20.0)
            {
                this.streamAlpha -= 0.03f;
                if ((double)this.streamAlpha < 0.0)
                {
                    this.streamAlpha = 0.0f;
                }
            }
            Vec2 to = Vec2.Transform(this.targetPos, Level.current.camera.getMatrix());

            to.x         *= this.layer.camera.width / (float)Graphics.width;
            to.y         *= this.layer.camera.height / (float)Graphics.height;
            this.position = Lerp.Vec2Smooth(this.position, to, 0.2f);
            if ((double)(this.position - to).length > 16.0)
            {
                this.prevPos.Add(this.position);
            }
            this.sizeWaver += 0.2f;
        }
Example #2
0
        public void Update()
        {
            Vec2 vec2 = Vec2.Transform(new Vec2(this.center.x, this.center.y), Level.current.camera.getMatrix());
            int  num1 = (int)vec2.x;

            if (num1 < 0)
            {
                num1 = 0;
            }
            if (num1 > Graphics.width)
            {
                num1 = Graphics.width;
            }
            int num2 = (int)vec2.y;

            if (num2 < 0)
            {
                num2 = 0;
            }
            if (num2 > Graphics.height)
            {
                num2 = Graphics.height;
            }
            if (this.horizontal)
            {
                if (this.isLeft)
                {
                    this.layer.scissor = new Rectangle(0.0f, (float)num2, (float)Graphics.width, (float)(Graphics.height - num2));
                }
                else
                {
                    this.layer.scissor = new Rectangle(0.0f, 0.0f, (float)Graphics.width, (float)num2);
                }
            }
            else if (this.isLeft)
            {
                this.layer.scissor = new Rectangle((float)num1, 0.0f, (float)(Graphics.width - num1), (float)Graphics.height);
            }
            else
            {
                this.layer.scissor = new Rectangle(0.0f, 0.0f, (float)num1, (float)Graphics.height);
            }
        }