public void Bereiche() { if (c.ZuBewegen == null) { return; } aktiveFigur = c.ZuBewegen; if (aktiveFigur.Route_Pos == -1) { Bereich.DataContext = "Haus"; } else if (aktiveFigur.Route_Pos >= 4 || aktiveFigur.Route_Pos <= 39) { Bereich.DataContext = "Weg"; } else if (aktiveFigur.Route_Pos >= 40) { Bereich.DataContext = "Ziel"; } else { Bereich.DataContext = "Null"; } Position.DataContext = aktiveFigur.Route_Pos; }
private Figur CreateFigur() { Figur figurToCreate = null; if (SelectFigurComboBox.SelectedIndex == 0) { figurToCreate = new Quadrat(double.Parse(xCord.Text), double.Parse(yCord.Text), (int)sliderSeiteA.Value); } else if (SelectFigurComboBox.SelectedIndex == 1) { figurToCreate = new Rechteck(double.Parse(xCord.Text), double.Parse(yCord.Text), (int)sliderSeiteA.Value, (int)sliderSeiteB.Value); } else if (SelectFigurComboBox.SelectedIndex == 2) { figurToCreate = new RechtwinkligesDreieck(double.Parse(xCord.Text), double.Parse(yCord.Text), (int)sliderSeiteA.Value, (int)sliderSeiteB.Value); } else if (SelectFigurComboBox.SelectedIndex == 3) { figurToCreate = new Kreis(double.Parse(xCord.Text), double.Parse(yCord.Text), (int)sliderSeiteA.Value); } else { throw new Exception("No Figur selected!"); } return(figurToCreate); }
static void Main(string[] args) { Start: Console.WriteLine("Введите тип фигуры:"); int namber = int.Parse(Console.ReadLine()); Figur figur = (Figur)namber; if (namber < 1 || namber > 3) { throw new Exception("Введенное значение выходит за допустимые пределы от 1 до 3!"); Console.WriteLine("Вы ввели не верное значение!"); goto Start; return; } switch (figur) { case Figur.krug: Console.WriteLine("Введите деаметр:"); double a = double.Parse(Console.ReadLine()); double value1 = 0; double value2 = 0; value1 = Math.PI * a; value2 = Math.PI * Math.Pow(a / 2, 2); Console.WriteLine("Периметер равен: {0}", value1); Console.WriteLine("Площадь равна: {0}", value2); break; case Figur.triugolnik: Console.WriteLine("Введите длинну стороны:"); double b = double.Parse(Console.ReadLine()); double val1 = 0; double val2 = 0; val1 = b * 3; val2 = b / 2 * Math.Sqrt(3) / 2 * b; Console.WriteLine("Периметер равен: {0}", val1); Console.WriteLine("Площадь равна: {0}", val2); break; case Figur.pryamougolnik: Console.WriteLine("Введите ширину прямоугольника:"); double d = double.Parse(Console.ReadLine()); Console.WriteLine("Введите высоту прямоугольника:"); double c = double.Parse(Console.ReadLine()); double valu1 = 0; double valu2 = 0; valu1 = 2 * (d + c); valu2 = d * c; Console.WriteLine("Периметер равен: {0}", valu1); Console.WriteLine("Площадь равна: {0}", valu2); break; } Console.ReadKey(); }
public bool Down(Figur druge1, Figur druge2) { if (((Math.Max(druge1.figura.x, druge2.figura.x) - Math.Min(druge1.figura.x, druge2.figura.x) <= Math.Min(druge1.figura.len, druge2.figura.len) && ((Math.Max(druge1.figura.y, druge2.figura.y) - Math.Min(druge1.figura.y, druge2.figura.y) <= Math.Min(druge1.figura.hig, druge2.figura.hig)))))) { return(true); } return(false); }
public void Waehle_Figur(Figur f) { Gewaehlt = -1; for (int i = 0; i < 4; i++) { if (f == p[Am_Zug].Figuren[i]) { Gewaehlt = i; ZuBewegen = p[Am_Zug].Figuren[i]; } } }
private void Kicke_Figur(Feld feld) { int figur = Gib_Figur(feld); if (figur == -1) { return; } ZuKicken = p[feld.Besetzt].Figuren[figur]; Setze_Ins_Haus(feld.Besetzt, figur); }
public void draw_Field(GameField field, Gamer g) { Console.CursorVisible = false; PacBze pac = field.getPacBze(); int maxy = 0; killTheTrace(field); //Alte SPuren beseitigen :) foreach (object o in field.GameFieldContent) { Figur f = (Figur)o; Figur tf = new Figur(); //Klone anlegen tf.x = f.x; tf.y = f.y; if (maxy < f.y) { maxy = f.y; } Console.SetCursorPosition(f.x, f.y); switch (o.GetType().ToString()) { case "PACBZE.classes.Wall": Console.Write("#"); break; case "PACBZE.classes.PacBze": this._Backbuffer.GameFieldContent.Add(tf); Console.Write("@"); break; case "PACBZE.classes.Monster": this._Backbuffer.GameFieldContent.Add(tf); Console.Write("M"); break; case "PACBZE.classes.Coin": this._Backbuffer.GameFieldContent.Add(tf); Console.Write("*"); break; } } maxy = maxy + 1; Console.SetCursorPosition(0, maxy); Console.Write("Gamer:{0} Coins:{1} Score:{2} Life:{3}", g.GamerName, pac.SaveCoins.Count, g.Score, pac.Life); Console.CursorVisible = true; }
public List <object> getFieldInfo(byte x, byte y) { // Wer steht alles auf dem Feld rum List <object> templ = new List <object>(); foreach (object o in this.GameFieldContent) { Figur f = (Figur)o; if (f.x == x && f.y == y) { templ.Add(o); } } return(templ); }
private void Auswahl_Click(object sender, RoutedEventArgs e) { Button b = (Button)sender; Figur f = (Figur)b.DataContext; //Wenn f eine der Figuren ist waehle diese aus (0, 1, 2, 3) c.Waehle_Figur(f); //Wichtig fuer die Bewege Funktion! TmpFigurButton = b; //Figur Animation Figur_Gewaehlt.Style = b.Style; Figur_Gewaehlt.Content = b.Content; }
static void Main(string[] args) { int N, NN; int len1, hig1, x, y; string name; string nam1, nam2; Figur[] drug; N = Convert.ToInt32(Console.ReadLine()); NN = Convert.ToInt32(Console.ReadLine()); drug = new Figur[N]; for (int i = 0; i < N; i++) { name = Console.ReadLine(); len1 = Convert.ToInt32(Console.ReadLine()); hig1 = Convert.ToInt32(Console.ReadLine()); x = Convert.ToInt32(Console.ReadLine()); y = Convert.ToInt32(Console.ReadLine()); drug[i] = new Figur(); drug[i].Add(name, len1, hig1, x, y); } for (int i = 0; i < NN; i++) { nam1 = Console.ReadLine(); nam2 = Console.ReadLine(); for (int j = 0; j < N; j++) { for (int f = 0; f < N; f++) { if (nam1 == drug[j].figura.name && nam2 == drug[f].figura.name) { Console.WriteLine(drug[i].Down(drug[j], drug[f])); } } } } Console.ReadKey(); }
private void DrawLastLineOfFigur(Figur figurToDraw) { Punkt[] punkte = figurToDraw.GetEckpunkte(); int lastElement = punkte.Length - 1; Line l = new Line(); l.X1 = GetRealX(punkte[lastElement].x); l.Y1 = GetRealY(punkte[lastElement].y); l.X2 = GetRealX(punkte[0].x); l.Y2 = GetRealY(punkte[0].y); l.Stroke = Brushes.Red; l.StrokeThickness = FigurLineThikness; CoordinateSystem.Children.Add(l); }
} //Gefuehlt, wenn Gewinner feststeht public Controller() { b = new Brett(); b = BaueBrett.Spielbrett(0); w = new Wuerfel(); p = new List <Spieler>(); Am_Zug = 0; Wurf = 0; Gewaehlt = -1; ZuKicken = null; ZuBewegen = null; rest_wuerfe = 3; zug_moeglich = false; aus_haus_gesetzt = false; Spiel_zuende = false; }
private void Bewege_Click(object sender, RoutedEventArgs e) { c.Bewege_Figur(); if (TmpFigurButton != null) { Figur tmp = (Figur)TmpFigurButton.DataContext; Bewege_Grid(TmpFigurButton, Brett[tmp.Aktuell]); //Keine Figur mehr gewaehlt Figur_Gewaehlt.Style = (Style)Application.Current.FindResource("Figur_Grey_Small"); Figur_Gewaehlt.Content = "None"; if (c.ZuKicken != null) { Figur kick = c.ZuKicken; Bewege_Grid(Figuren[kick], Brett[kick.Aktuell]); } } }
static void Main() { Stack <Figur> figurenStack = new Stack <Figur>(); Figur[] figuren = new Figur[10]; figuren[0] = new Kreis("blau", 3.0); figuren[1] = new Kreis("rot", 7.3); figuren[2] = new Rechteck("lila", 20.5, 30.7); figuren[3] = new Ring("blau", 20.9, 19.3); figuren[4] = new Rechteck("grün", 10.2, 4.9); figuren[5] = new Parallelogram("grau", 70.0, 20.4, 67.0); figuren[6] = new Ring("magenta", 20.0, 17.2); figuren[7] = new Rechteck("schwarz", 90.3, 73.5); figuren[8] = new Kreis("gelb", 34.4); figuren[9] = new Parallelogram("blau", 44.2, 19.9, 22.6); foreach (Figur fig in figuren) { figurenStack.Push(fig); } Figur.zeigeZaehler(); Console.WriteLine("Momentane Stackgröße: " + figurenStack.Count); Console.WriteLine("Ausgabe: "); for (uint i = figurenStack.Count; i != 0; --i) { Console.Write(i + ") "); figurenStack.Pop().Show(); } Figur.zeigeZaehler(); Console.WriteLine("Momentane Stackgröße: " + figurenStack.Count); Console.ReadKey(); }
private void DrawFigur(Figur figurToDraw) { Punkt[] punkte = figurToDraw.GetEckpunkte(); Line l = null; for (int idx = 1; idx < punkte.Length; idx++) { l = new Line(); l.X1 = GetRealX(punkte[idx - 1].x); l.Y1 = GetRealY(punkte[idx - 1].y); l.X2 = GetRealX(punkte[idx].x); l.Y2 = GetRealY(punkte[idx].y); l.Stroke = Brushes.Red; l.StrokeThickness = FigurLineThikness; CoordinateSystem.Children.Add(l); } DrawLastLineOfFigur(figurToDraw); }
private void Figur_Click(Figur figur) { figur.bild.RaiseEvent(new RoutedEventArgs(System.Windows.Controls.Primitives.ButtonBase.ClickEvent)); }
public virtual bool Equals(Figur other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Serie, Serie); }
// Use this for initialization void Start() { playerZambieew = GameObject.FindGameObjectWithTag("Player").GetComponent <Figur>(); GetComponent <NavMeshAgent>().Warp(transform.position); print(transform.position); }