public override void _Ready() { _map = GetNode <Map>("Map"); _pathOverlay = GetNode <PathOverlay>("PathOverlay"); _pathArrow = GetNode <PathArrow>("PathArrow"); _commandDialog = GetNode <VBoxContainer>("UI/CommandDialog"); _fireButton = GetNode <Button>("UI/CommandDialog/Fire"); foreach (Unit unit in GetNode("PlayerUnits").GetChildren()) { _playerUnits.Add(unit.Cell, unit); } foreach (Unit unit in GetNode("AIUnits").GetChildren()) { _enemyUnits.Add(unit.Cell, unit); } }
protected override void OnSizeChanged(int w, int h, int oldw, int oldh) { base.OnSizeChanged(w, h, oldw, oldh); ActualWidth = w; ActualHeight = h; if (ArrowType == EControlType.Right) { PathArrow.MoveTo((float)(2.0), (float)(h * 2 / 5.0)); PathArrow.LineTo((float)(2.0), (float)(h * 3 / 5.0)); PathArrow.LineTo((float)(w * 3 / 5.0), (float)(h * 3 / 5.0)); PathArrow.LineTo((float)(w * 3 / 5.0), (float)(h * 7 / 10.0)); PathArrow.LineTo((float)(w - 2), (float)(h / 2.0)); PathArrow.LineTo((float)(w * 3 / 5.0), (float)(h * 3 / 10.0)); PathArrow.LineTo((float)(w * 3 / 5.0), (float)(h * 2 / 5.0)); PathArrow.LineTo((float)(2.0), (float)(h * 2 / 5.0)); } else { PathArrow.MoveTo((float)(w - 2), (float)(h * 2 / 5.0)); PathArrow.LineTo((float)(w - 2), (float)(h * 3 / 5.0)); PathArrow.LineTo((float)(w * 2 / 5.0), (float)(h * 3 / 5.0)); PathArrow.LineTo((float)(w * 2 / 5.0), (float)(h * 7 / 10.0)); PathArrow.LineTo((float)(2.0), (float)(h / 2.0)); PathArrow.LineTo((float)(w * 2 / 5.0), (float)(h * 3 / 10.0)); PathArrow.LineTo((float)(w * 2 / 5.0), (float)(h * 2 / 5.0)); PathArrow.LineTo((float)(w / 2.0 - 2), (float)(h * 2 / 5.0)); } PathBorder.MoveTo(2, (float)(2.0)); PathBorder.LineTo((float)(w - 2.0), (float)(2.0)); PathBorder.LineTo((float)(w - 2.0), (float)(h - 2)); PathBorder.LineTo(2, h - 2); PathBorder.LineTo(2, (float)(2.0)); }