You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.5 KiB
C#
87 lines
2.5 KiB
C#
using System.Collections.Generic;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Media;
|
|
using NodeEditor.Extensions;
|
|
|
|
namespace NodeEditor.Controls
|
|
{
|
|
public partial class Path : UserControl
|
|
{
|
|
public static List<Path> Paths { get; } = new List<Path>();
|
|
public int[] Difficulty { get; set; }
|
|
public double Distance { get; set; }
|
|
public int LvlRequired { get; set; }
|
|
public Modes Mode { get; set; }
|
|
public int Cost { get; set; }
|
|
|
|
public Path()
|
|
{
|
|
Difficulty = new[] {1, 1, 1, 1, 1};
|
|
Distance = 0;
|
|
LvlRequired = 0;
|
|
Mode = Modes.Walk;
|
|
Cost = 0;
|
|
Paths.Add(this);
|
|
InitializeComponent();
|
|
}
|
|
public Path(int distance)
|
|
{
|
|
Difficulty = new[] {1, 1, 1, 1, 1};
|
|
Distance = distance;
|
|
LvlRequired = 0;
|
|
Mode = Modes.Walk;
|
|
Cost = 0;
|
|
Paths.Add(this);
|
|
InitializeComponent();
|
|
}
|
|
public Path(int distance, Modes mode)
|
|
{
|
|
Difficulty = new[] {1, 1, 1, 1, 1};
|
|
Distance = distance;
|
|
LvlRequired = 0;
|
|
Mode = mode;
|
|
Cost = 0;
|
|
Paths.Add(this);
|
|
InitializeComponent();
|
|
}
|
|
public Path(int distance, Modes mode, int cost)
|
|
{
|
|
Difficulty = new[] {1, 1, 1, 1, 1};
|
|
Distance = distance;
|
|
LvlRequired = 0;
|
|
Mode = mode;
|
|
Cost = cost;
|
|
Paths.Add(this);
|
|
InitializeComponent();
|
|
}
|
|
public Path(int distance, Modes mode, int cost, int lvlRequired)
|
|
{
|
|
Difficulty = new[] {1, 1, 1, 1, 1};
|
|
Distance = distance;
|
|
LvlRequired = lvlRequired;
|
|
Mode = mode;
|
|
Cost = cost;
|
|
Paths.Add(this);
|
|
InitializeComponent();
|
|
}
|
|
public Path(int distance, Modes mode, int cost, int lvlRequired, int[] difficulty)
|
|
{
|
|
Difficulty = difficulty;
|
|
Distance = distance;
|
|
LvlRequired = lvlRequired;
|
|
Mode = mode;
|
|
Cost = cost;
|
|
Paths.Add(this);
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void Destroy()
|
|
{
|
|
var parentObject = VisualTreeHelper.GetParent(this);
|
|
var parent = parentObject as Canvas;
|
|
|
|
parent?.Children.Remove(this);
|
|
Paths.Remove(this);
|
|
}
|
|
}
|
|
} |