public override void AffectOther(Node other) { if (!active) { return; } if (exclusions.Contains(other)) { return; } if (link != null && link.formation != null && link.formation.AffectionSets.ContainsKey(parent)) { foreach (Node n in link.formation.AffectionSets[parent]) { if (orbiterDatas.ContainsKey(n)) { OrbiterData od = orbiterDatas[n]; od.angle += od.angledelta * speedMult; if (od.angle > Math.PI) { od.angle = od.angle - 2 * (float)Math.PI; } else if (od.angle < -Math.PI) { od.angle = od.angle + 2 * (float)Math.PI; } //Console.WriteLine(od.angle + " : " + od.angle); float x = od.radius * (float)Math.Cos(od.angle); float y = od.radius * (float)Math.Sin(od.angle); //n.transform.position.X = (float)Math.Atan2(parent.transform.position.Y - y, parent.transform.position.X - x); n.body.pos = new Vector2R(parent.body.pos.X - x, parent.body.pos.Y - y); orbiterDatas[n] = od; } else { orbiterDatas[n] = new OrbiterData(maxSpeed, maxRadius); } } } }
public override void AffectOther(Node other) { if (!active) { return; } if (exclusions.Contains(other)) return; if (link != null && link.formation != null && link.formation.AffectionSets.ContainsKey(parent)) { foreach (Node n in link.formation.AffectionSets[parent]) { if (orbiterDatas.ContainsKey(n)) { OrbiterData od = orbiterDatas[n]; od.angle += od.angledelta * speedMult; if (od.angle > Math.PI) od.angle = od.angle - 2 * (float)Math.PI; else if (od.angle < -Math.PI) od.angle = od.angle + 2 * (float)Math.PI; //Console.WriteLine(od.angle + " : " + od.angle); float x = od.radius * (float)Math.Cos(od.angle); float y = od.radius * (float)Math.Sin(od.angle); //n.transform.position.X = (float)Math.Atan2(parent.transform.position.Y - y, parent.transform.position.X - x); n.body.pos = new Vector2(parent.body.pos.X - x, parent.body.pos.Y - y); orbiterDatas[n] = od; } else { orbiterDatas[n] = new OrbiterData(maxSpeed, maxRadius); } } } }