示例#1
0
        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);
        }
示例#2
0
        public static int Distance(Zahnrad from, Zahnrad to)
        {
            int d = from.System._Path(to).Count;

            from.System.rec_finished();
            return(d);
        }
示例#3
0
    private Zahnrad CogBelow()
    {
        Zahnrad cog = Experiment.CurrentTrial <CogTrial>().CogAt(this.transform.position);

        if (cog == null || cog.IsStart)
        {
            return(null);
        }
        return(cog);
    }
示例#4
0
    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);
     }
 }
示例#6
0
    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);
        }
    }
示例#7
0
 private void Disconnect()
 {
     Experiment.CurrentTrial <PropellerTrial>().DetachPropeller(AttachedTo);
     AttachedTo = null;
 }
示例#8
0
 public bool Contains(Zahnrad other)
 {
     return(Set.Contains(other));
 }
示例#9
0
 public ConnectedComponent(Zahnrad p)
 {
     parent = p;
 }