public RealizedPowerAuraOptions(PowerAuraOptions opts, GenCtx gcx, Vector2 unparentedOffset, ICancellee cT, Func <RealizedPowerAuraOptions, Action> next) { scale = opts.scale?.Invoke(gcx); color = opts.color; time = opts.time?.Invoke(gcx) ?? 1f; iterations = opts.itrs?.Invoke(gcx) ?? 1f; sfx = opts.sfx; layer = opts.layer; this.cT = cT; if (opts.static_) { parent = null; offset = unparentedOffset; } else { parent = gcx.exec; offset = Vector2.zero; } if (opts.next != null) { //Note that you must operate over GCX now, since it may be destroyed after this function is exited. continuation = next(new RealizedPowerAuraOptions(opts.next, gcx, unparentedOffset, cT, next)); } else { continuation = null; } }
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); }
/// <summary> /// Do 2 iterations inwards with color1 over 1.5 seconds, then 1 iteration outwards with color2 over 0.5 seconds, /// using the sound effects "x-powerup-1" and "x-powerdown-1" respectively. /// </summary> public static PowerAuraOption Boss1(TP4 color1, TP4 color2) => new CompositeProp( Color(color1), SFX("x-powerup-1"), Time(_ => 1.5f), Iterations(_ => 2), Next(new[] { Color(color2), SFX("x-powerdown-1"), Time(_ => 0.5f), Iterations(_ => - 1) }) );
public PowerAuraOptions(IEnumerable <PowerAuraOption> props) { foreach (var prop in props.Unroll()) { if (prop is ScaleProp sp) { scale = sp.value; } else if (prop is StaticFlag) { static_ = true; } else if (prop is ColorProp cp) { color = cp.value; } else if (prop is TimeProp tp) { time = tp.value; } else if (prop is IterationsProp ip) { itrs = ip.value; } else if (prop is SFXProp sfxp) { sfx = sfxp.value; } else if (prop is LayerProp lp) { layer = lp.value.Int(); } else if (prop is NextProp np) { next = new PowerAuraOptions(np.value); } else { throw new Exception($"PowerAura option {prop.GetType()} not handled."); } } }
public void Initialize(TP4 colorizer, BPRV2 locater) { base.Initialize(colorizer); locate = locater; }
public void Initialize(TP4 colorizer) { color = colorizer; sprite.color = new Color(0, 0, 0, 0); }
public static PowerAuraOption Color(TP4 color) => new ColorProp(color);