void Sternenmanagement() { // ausglimmen lassen _st = _st.Select(s => new Stern() { X = s.X, Y = s.Y, Hell = 0.8f * s.Hell }).ToList(); // tote sterne weg: _st = _st.Where(s => s.Hell > 0.01f).ToList(); // auftoppen int diff = this.Anzahl - _st.Count(); int topup = Convert.ToInt32(diff / 4.0); for (int i = 0; i < topup; i++) { Stern stern = new Stern() { X = (rnd.Next((int)sizex)), Y = (rnd.Next((int)sizey)), Hell = 1.0f }; if (stern.X >= sizex || stern.Y >= sizey) { Debugger.Break(); } _st.Add(stern); } }
public bool RemoveStern(Stern stern) { if (this.stern == stern) { RemoveComponent(stern); this.stern = null; RecalculateLayout(); return(true); } return(false); }
private static void Main(string[] args) { var sternOne = new Stern(2); var sternTwo = new Stern(4); var sternThree = new Stern(9); var stabOne = new Stab(sternOne, sternTwo, 9); var stabTwo = new Stab(stabOne, sternThree, 10); stabTwo.Balance(); stabTwo.Print(); }
public void ValidateBalance_Case1() { var sternOne = new Stern(2) as INode; var sternTwo = new Stern(4) as INode; var sternThree = new Stern(9) as INode; var stabOne = new Stab(sternOne, sternTwo, 9) as INode; var stabTwo = new Stab(stabOne, sternThree, 10) as INode; stabTwo.Balance(); stabTwo.Print(); Assert.IsTrue(Math.Abs(((Stab)stabOne).Position - 6) < 0.05); Assert.IsTrue(Math.Abs(((Stab)stabTwo).Position - 6) < 0.05); }
public bool AddStern(Stern stern) { if (CanPickupStern) { this.stern = stern; AddComponent(stern); SternHealth = 100f; RecalculateLayout(); return(true); } if (planks.Count < minPlanksRequiredForStern) { PopupText("Need " + minPlanksRequiredForStern + " planks!", stern.transform.position); } return(false); }