Пример #1
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>();
        }
Пример #2
0
        public static IEnumerator Velocity(Transform t, TP3 eq)
        {
            var bpi = new ParametricInfo()
            {
                loc = t.position
            };

            for (bpi.t = 0f;; bpi.t += ETime.FRAME_TIME)
            {
                t.localPosition += eq(bpi) * ETime.FRAME_TIME;
                bpi.loc          = t.position;
                yield return(null);
            }
            // ReSharper disable once IteratorNeverReturns
        }
Пример #3
0
        private Vector3 SelectByPower(TP3[] powers, TP3 otherwise)
        {
            if (powers.Length == 0)
            {
                return(otherwise(bpi));
            }
            int index = Math.Min(powers.Length - 1, GameManagement.Instance.PowerIndex);

            if (index != currPower)
            {
                lastPower = currPower;
                currPower = index;
                powerLerp = 0;
            }
            return(Vector3.Lerp(powers[lastPower](bpi), powers[currPower](bpi), powerLerp));
        }
Пример #4
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();
        }
Пример #5
0
 private void Awake()
 {
     locF = location.Into <TP3>();
     tr   = transform;
 }
            internal AutoScope(ProfilerMarker <TP1, TP2, TP3> marker, TP1 p1, TP2 p2, TP3 p3)
            {
#if ENABLE_PROFILER
                m_Marker = marker;
                m_Marker.Begin(p1, p2, p3);
#endif
            }
Пример #7
0
 protected override void Awake()
 {
     base.Awake();
     rotate = ReflWrap <TP3> .Wrap(rotator);
 }