예제 #1
0
        private IEnumerator _FadeSpriteOpacity(BPY fader01, ParametricInfo tbpi, float over, ICancellee cT, Action done)
        {
            if (cT.Cancelled)
            {
                done(); yield break;
            }
            Color c = sprite.color;

            for (tbpi.t = 0f; tbpi.t < over - ETime.FRAME_YIELD; tbpi.t += ETime.FRAME_TIME)
            {
                yield return(null);

                if (cT.Cancelled)
                {
                    break;
                }                        //Set to target and then leave
                tbpi.loc     = beh.rBPI.loc;
                c.a          = fader01(tbpi);
                sprite.color = c;
            }
            tbpi.t       = over;
            c.a          = fader01(tbpi);
            sprite.color = c;
            done();
        }
예제 #2
0
 public void Initialize(TP locator, BPY scaler, TP4?colorizer)
 {
     locate       = locator;
     scale        = scaler;
     color        = colorizer ?? (_ => Color.black);
     sprite.color = new Color(0, 0, 0, 0);
     pb.SetFloat(PropConsts.ScaleX, sprite.transform.lossyScale.x);
 }
예제 #3
0
파일: Pather.cs 프로젝트: Bagoum/danmokou
 private void Initialize(bool isNew, Movement movement, ParametricInfo pi, SOPlayerHitbox _target, float maxRemember,
                         BPY remember, BEHStyleMetadata style, ref RealizedBehOptions options)
 {
     ctr.SetYScale(options.scale); //Needs to be done before Colorize sets first frame
     //Order is critical so rBPI override points to initialized data on SM start
     ctr.Initialize(this, config, style.RecolorOrThrow.material, isNew, movement, pi, remember, maxRemember, _target, ref options);
     base.Initialize(style, options, null, movement.WithNoMovement(), pi, _target, out int layer); // Call after Awake/Reset
     ctr.Activate();                                                                               //This invokes UpdateMesh
 }
예제 #4
0
        public override void FadeSpriteOpacity(BPY fader01, float over, ICancellee cT, Action done)
        {
            Color c    = sprite.color;
            var   tbpi = ParametricInfo.WithRandomId(beh.rBPI.loc, beh.rBPI.index);

            c.a          = fader01(tbpi);
            sprite.color = c;
            beh.RunRIEnumerator(_FadeSpriteOpacity(fader01, tbpi, over, cT, done));
        }
예제 #5
0
 public static BehCFc FlipYLT(BPY wall, Pred cond)
 {
     return(new BehCFc(b => {
         var bpi = b.rBPI;
         if (bpi.loc.y < wall(bpi) && cond(bpi))
         {
             b.rBPI.FlipSimple(true, wall(bpi));
             b.FlipVelY();
         }
     }, BM.BulletControl.P_MOVE_3));
 }
예제 #6
0
        protected override void Awake()
        {
            string CXYZ(Vector3 loc) => $"pxyz {loc.x} {loc.y} {loc.z}";

            base.Awake();
            velMov           = movement.Into <TP>();
            tr.localPosition = startLoc;
            fireScaler       =
                //WARNING incompatible with baking
                FormattableString
                .Invariant(
                    $"lerpsmooth ebounce2 {timeToFirstHit} {timeToSecondHitPost} t {fireMultiplier.x} {fireMultiplier.y}")
                .Into <BPY>();
            upperTextLerp =
                FormattableString
                .Invariant($"lerpsmooth in-sine {timeToLerpStart} {timeToFirstHit} t {CXYZ(upperTextOffset)} zero")
                .Into <TP3>();
            lowerTextLerp =
                FormattableString
                .Invariant($"lerpsmooth in-sine {timeToFirstHit} {timeToSecondHit} t {CXYZ(lowerTextOffset)} zero")
                .Into <TP3>();
            upperTextScaler = FormattableString
                              .Invariant($"lerpsmooth out-sine {sx} {sy} (t - {timeToFirstHit}) {textScale.x} {textScale.y}").Into <BPY>();
            lowerTextScaler = FormattableString
                              .Invariant($"lerpsmooth out-sine {sx} {sy} (t - {timeToSecondHit}) {textScale.x} {textScale.y}")
                              .Into <BPY>();
            if (fireSprite != null)
            {
                fireSprite.GetPropertyBlock(firePB = new MaterialPropertyBlock());
                firePB.SetFloat(PropConsts.xBlocks, xBlocks);
                firePB.SetFloat(PropConsts.yBlocks, yBlocks);
                firePB.SetColor(PropConsts.color1, color1);
                firePB.SetColor(PropConsts.color2, color2);
                firePB.SetColor(PropConsts.color3, color3);
                firePB.SetFloat(PropConsts.multiplier, fireScaler(bpi));
            }
            //SetColorA(upperText, 0);
            //SetColorA(lowerText, 0);
            //upperTr = upperText.transform;
            //lowerTr = lowerText.transform;
            upperTextBaseLoc = upperTr.localPosition;
            lowerTextBaseLoc = lowerTr.localPosition;
            RunDroppableRIEnumerator(Tracker());

            textBacker.GetPropertyBlock(textBackPB = new MaterialPropertyBlock());
            textBackPB.SetFloat(PropConsts.fillRatio, 0);
            textBackPB.SetTexture(PropConsts.trueTex, textBackSprite);
            textBackFiller = FormattableString.Invariant($"lerpt {textBackFillTime.x} {textBackFillTime.y} 0 1")
                             .Into <BPY>();
        }
예제 #7
0
        public static void Smooth1()
        {
            BPY lerp = "lerp 4 5 t 0 2".Into <BPY>();
            var pi   = new ParametricInfo(Vector2.right, 234, 3243, 0f);

            AreEqual(lerp(pi.CopyWithT(3f)), 0f, err);
            AreEqual(lerp(pi.CopyWithT(4.4f)), 0.8f, err);
            AreEqual(lerp(pi.CopyWithT(6f)), 2f, err);
            lerp = "lerp 4 5 t t 2".Into <BPY>();
            AreEqual(lerp(pi.CopyWithT(3)), 3f, err);
            AreEqual(lerp(pi.CopyWithT(4)), 4f, err);
            AreEqual(lerp(pi.CopyWithT(4.5f)), 0.5f * (4.5f + 2f), err);
            AreEqual(lerp(pi.CopyWithT(5f)), 2f, err);
        }
예제 #8
0
        public void Initialize(PlayerInput playr)
        {
            Player = playr;
            //I feel kind of bad about this, but it ensures that PlayerInput is linked before the SM runs.
            base.Awake();
            sr             = GetComponent <SpriteRenderer>();
            original_angle = 0; //Shoot up by default
            freeOffset     = ReflWrap <TP3> .Wrap(offsetFree);

            if (string.IsNullOrWhiteSpace(offsetFocus))
            {
                offsetFocus = offsetFree;
            }
            focusOffset = ReflWrap <TP3> .Wrap(offsetFocus);

            // ReSharper disable once AssignmentInConditionalExpression
            if ((doOpacity = !string.IsNullOrWhiteSpace(opacityFree)))
            {
                freeOpacity = ReflWrap <BPY> .Wrap(opacityFree);

                if (string.IsNullOrWhiteSpace(opacityFocus))
                {
                    opacityFocus = opacityFree;
                }
                focusOpacity = ReflWrap <BPY> .Wrap(opacityFocus);

                rootColor = sr.color;
            }
            freeOffsetPower  = powerOffsetFree.Select(ReflWrap <TP3> .Wrap).ToArray();
            focusOffsetPower = powerOffsetFocus.Select(ReflWrap <TP3> .Wrap).ToArray();
            if (!string.IsNullOrWhiteSpace(spriteRotation))
            {
                rotator = ReflWrap <BPY> .Wrap(spriteRotation);
            }
            if (!string.IsNullOrWhiteSpace(freeAngleOffset))
            {
                freeAngle = ReflWrap <BPY> .Wrap(freeAngleOffset);
            }
            if (!string.IsNullOrWhiteSpace(focusAngleOffset))
            {
                focusAngle = ReflWrap <BPY> .Wrap(focusAngleOffset);
            }
            lastPower = currPower = Math.Min(freeOffsetPower.Length - 1, GameManagement.Instance.PowerIndex);
            SetLocation();
        }
예제 #9
0
 public override void FadeSpriteOpacity(BPY fader01, float over, ICancellee cT, Action done) =>
 recvSprite.FadeSpriteOpacity(fader01, over, cT, done);
예제 #10
0
 public static CoordF Polar(BPY r, BPY theta) => delegate(float c, float s, ParametricInfo bpi, out Vector2 nrv) {
     var cs  = M.CosSinDeg(theta(bpi));
     var rad = r(bpi);
     nrv.x = rad * (c * cs.x - s * cs.y);
     nrv.y = rad * (s * cs.x + c * cs.y);
 };
예제 #11
0
파일: Pather.cs 프로젝트: Bagoum/danmokou
        public static void Request(BEHStyleMetadata style, Movement movement, ParametricInfo pi, float maxRemember, BPY remember, SOPlayerHitbox collisionTarget, ref RealizedBehOptions opts)
        {
            Pather created = (Pather)BEHPooler.RequestUninitialized(style.RecolorOrThrow.prefab, out bool isNew);

            created.Initialize(isNew, movement, pi, collisionTarget, maxRemember, remember, style, ref opts);
        }
예제 #12
0
 private static void TestTPoints(BPY b, (float t, float val)[] pts)