private List <Zahnrad> _Path(Zahnrad to) { if (parent == to) { return new List <Zahnrad> { parent } } ; if (rec_updated) { return new List <Zahnrad> { } } ; rec_updated = true; List <Zahnrad> path = new List <Zahnrad> { }; foreach (var c in parent.ConnectedCogs) { var path_partial = c.System._Path(to); if ((path_partial.Count < path.Count && path_partial.Count > 0) || path.Count == 0) { path = path_partial; } } path.Insert(0, parent); return(path); }
public static int Distance(Zahnrad from, Zahnrad to) { int d = from.System._Path(to).Count; from.System.rec_finished(); return(d); }
private Zahnrad CogBelow() { Zahnrad cog = Experiment.CurrentTrial <CogTrial>().CogAt(this.transform.position); if (cog == null || cog.IsStart) { return(null); } return(cog); }
private Vector2 SnapToCog(float x, float y) { Zahnrad below = Experiment.CurrentTrial <CogTrial>().CogAt(new Vector2(x, y)); if (below == null || below.IsStart) { return(new Vector2(x, y)); } return(below.transform.position); }
private void CursorDeselect(Vector2 pos) { AttachedTo = CogBelow(); if (AttachedTo != null) { baseRotation = this.transform.rotation; baseRotation *= Quaternion.Inverse(AttachedTo.transform.rotation); Experiment.CurrentTrial <DirectionTrial>().AttachSticker(this, AttachedTo); } else { Destroy(gameObject); } }
private void CursorDeselect(Vector2 pos) { if (CursorSelected) { CursorSelected = false; transform.localScale = baseScale; sprite.sortingOrder = 2; AttachedTo = CogBelow(); baseRotation = this.transform.rotation; if (AttachedTo != null) { baseRotation *= Quaternion.Inverse(AttachedTo.transform.rotation); } Experiment.CurrentTrial <PropellerTrial>().AttachPropeller(AttachedTo); } }
private void Disconnect() { Experiment.CurrentTrial <PropellerTrial>().DetachPropeller(AttachedTo); AttachedTo = null; }
public bool Contains(Zahnrad other) { return(Set.Contains(other)); }
public ConnectedComponent(Zahnrad p) { parent = p; }