public override void InstallBindings() { Container.BindInstance <SpawningConfig>(spawningConfig); Container.BindInstance <RenderingConfig>(renderingConfig); Container.BindInstance <Speed>(speed); Container.BindInstance <UnitRadius>(unitRadius); Container.BindInstance <StatsRenderer>(infoRenderer); var worldRect = new math.WorldRect(unitRadius.value, 0, 800 - unitRadius.value * 2, 450); Container.Bind <Stats>().To <Stats>().AsSingle(); Container.Bind <TrajectoryResolver>().AsSingle(); Container.Bind <World>().AsSingle(); Container.BindInstance <WorldRect>(worldRect); Container.Bind <DebugSystem>().To <DebugSystem>().AsSingle(); // Вот здесь можно как угодно фантазировать на предмет вариантов траекторий, которые будут спаунится, вероятности и пр. var builder = new RandomTrajectoryBuilder(); builder.addBuilder(Container.Instantiate <LineBuilder>()); builder.addBuilder(Container.Instantiate <CircleBuilder>()); Container.BindInstance <TrajectoryBuilder>(builder); Container.Bind <TrajectorySpawner>().To <TrajectorySpawner>().AsSingle(); Container.BindInstance <SphereItemRenderer>(sphereItemRenderer); Container.BindInstance <DebugRenderer>(sphereItemRenderer); InitializationUtils.InitSystem <TrajectoryApplicationUpdater>(Container); }
public static trajectory.Trajectory buildLine(float x1, float x2, float t0, math.WorldRect worldRect, float s, bool odd) { var xSign = x1 > x2 ? -1 : 1; var ySign = odd ? 1 : -1; float dx = (x2 - x1); float dy = worldRect.height(); float dxSq = (dx * dx); float dySq = (dy * dy); float sySq = (((s * s) * dySq) / ((dySq + dxSq))); float sxSq = ((s * s) - sySq); float pathLen = Mathf.Sqrt(dxSq + dySq); var period = new Range(t0, t0 + pathLen / s); var line = new LineTrajectory(x1, odd ? worldRect.y0 : worldRect.y1, xSign * Mathf.Sqrt(sxSq), ySign * Mathf.Sqrt(sySq), period); return(line); }