public static IBindable Create(Vector2 position, bool isAnchor = true) { var anchor = new StaticAnchor(); anchor._position = position; anchor._isAnchor = isAnchor; return(anchor); }
public static RootBlock Create(int x, int y, int rootId = -1) { rootId = rootId == -1 ? Roots.Count : rootId; var b = Instantiate(Prefabs.Instance.rootBlock, Roots.Root[rootId].rootCanvas.transform).GetComponent <RootBlock>(); b.rootId = rootId; b.logic.SetCoords(x, y); b.transform.position = b.logic.Position; b.StartInit(); BindMatrix.AddBind(StaticAnchor.Create(b.logic.Position), b, Vector2.zero, Bind.BlockStaticBindStrength); b.view.SetDirty(); return(b); }
public static NodeBlock Create(int x, int y, int rootId = 0, float startOffsetClamp = 0f) { var position = new Vector2(x, y); var startPosition = position + Vector2.ClampMagnitude(Roots.Root[rootId].block.logic.Position - position, startOffsetClamp); var b = Instantiate(Prefabs.Instance.nodeBlock, startPosition, Quaternion.identity, Roots.Root[rootId].rootCanvas.transform).GetComponent <NodeBlock>(); b.rootId = rootId; b.logic.SetCoords(x, y); b.StartInit(); var startModel = b.view.VisualBase.Current; Animator.Interpolate(0.4f, 1f, 0.4f) .PassValue(v => startModel.transform.localScale = new Vector3(v, v, 1)) .Type(InterpolationType.InvSquare).NullCheck(startModel.gameObject); BindMatrix.AddBind(StaticAnchor.Create(b.logic.Position, false), b, Vector2.zero, Bind.BlockStaticBindStrength); Roots.Root[rootId].DeadEndsSetDirty(); return(b); }
protected override void StartInit() { base.StartInit(); view.SetInitialModel(BlockVisualBase.Model.Root); BindMatrix.AddBind(StaticAnchor.Create(logic.Position), this, Vector2.zero, Bind.BlockBindStrength); }