public void Buy(GrowButtons.GrowButton grButton) { this.waitedButton = grButton; if (this.waitedButton != null) { this.waitedButton.WaitForGrow(); } }
public GrowButton(GrowButton grButton) : base(grButton) { this.Manager = grButton.Manager; this.Price = grButton.Price; this.CoolDown = new Counter.Timer(grButton.CoolDown); this.visualCoolDown = new Counter.Timer(grButton.visualCoolDown); this.coolDownImage = new Sprite(grButton.coolDownImage); this.visualCoolDown.OnMeet += new Counter.EventOnCounterMeet(this.OnVisualCoolDownTick); this.CoolDown.OnMeet += new Counter.EventOnCounterMeet(this.OnCoolDownTick); this.LastCanBuy = grButton.LastCanBuy; }
public void Grow(Vector2 position) { if (this.waitedButton == null) return; this.waitedButton.StopWait(); GrowButtons.GrowButton grButton = this.waitedButton; this.waitedButton = null; Griding.Cell cell = this.Manager.GetGriding.IndexOf(position); if (cell != null) { foreach (Griding.IGridable grc in cell.Components) { if (grc is Plant.Plant) return; } Plant.Plant plant = grButton.Buy(); if (plant != null) { plant.Position = position; } } }