Exemplo n.º 1
0
        public static ExCoordF Polar(ExBPY r, ExBPY theta)
        {
            var vr     = ExUtils.VFloat();
            var lookup = new TExV2();

            return((c, s, bpi, nrv, fxy) => Ex.Block(new[] { vr, lookup },
                                                     Ex.Assign(lookup, ExM.CosSinDeg(theta(bpi))),
                                                     Ex.Assign(vr, r(bpi)),
                                                     fxy(Ex.Subtract(Ex.Multiply(c, lookup.x), Ex.Multiply(s, lookup.y)).Mul(vr),
                                                         Ex.Add(Ex.Multiply(s, lookup.x), Ex.Multiply(c, lookup.y)).Mul(vr)),
                                                     Expression.Empty()
                                                     ));
        }
Exemplo n.º 2
0
        public static ExCoordF Polar2(ExTP radThetaDeg)
        {
            var rt     = new TExV2();
            var lookup = new TExV2();

            return((c, s, bpi, nrv, fxy) => Ex.Block(new ParameterExpression[] { rt, lookup },
                                                     Ex.Assign(rt, radThetaDeg(bpi)),
                                                     Ex.Assign(lookup, ExM.CosSinDeg(rt.y)),
                                                     fxy(Ex.Subtract(Ex.Multiply(c, lookup.x), Ex.Multiply(s, lookup.y)).Mul(rt.x),
                                                         Ex.Add(Ex.Multiply(s, lookup.x), Ex.Multiply(c, lookup.y)).Mul(rt.x)),
                                                     Expression.Empty()
                                                     ));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Return the direction, in degrees, of the bullet.
 /// </summary>
 /// <returns></returns>
 public static ExBPY Dir() => sb => ExM.ATan(sb.SB.direction);
Exemplo n.º 4
0
 /// <summary>
 /// Short for `* smooth / t TIME ss0 - LOCATION loc`. Use with NROFFSET.
 /// </summary>
 public static ExTP EaseToTarget([LookupMethod] Func <tfloat, tfloat> ease, ExBPY time, ExTP location) => bpi =>
 ExM.Mul(ease(Div(bpi.t, time(bpi))), ExMSamplers.SS0(x => Sub(location(x), x.loc))(bpi));
Exemplo n.º 5
0
 /// <summary>
 /// See <see cref="ExM.PM"/>.
 /// </summary>
 /// <returns></returns>
 public static ExBPY PM(int self, int children) => bpi => ExM.PM(self, children, bpi.index);
Exemplo n.º 6
0
 /// <summary>
 /// See <see cref="ExM.P2M"/>.
 /// </summary>
 /// <returns></returns>
 public static ExBPY P2M(int mod) => bpi => ExM.P2M(mod, bpi.index);
Exemplo n.º 7
0
 /// <summary>
 /// See <see cref="ExM.P2"/>.
 /// </summary>
 /// <returns></returns>
 public static ExBPY P2() => bpi => ExM.P2(bpi.index);
Exemplo n.º 8
0
 /// <summary>
 /// See <see cref="ExM.P1"/>.
 /// </summary>
 /// <returns></returns>
 public static ExBPY P1() => bpi => ExM.P1(bpi.index);
Exemplo n.º 9
0
 /// <summary>
 /// Returns Atan(Player.Loc - this.Loc) in degrees.
 /// </summary>
 public static ExBPY AngleToPlayer() => AngleTo(x => ExM.LPlayer());