1
0
mirror of synced 2024-12-04 20:08:00 +01:00
Switch-Toolbox/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Paths/EnemyPaths.cs

105 lines
3.1 KiB
C#
Raw Normal View History

2019-04-06 21:13:55 +02:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using GL_EditorFramework.EditorDrawables;
using GL_EditorFramework.GL_Core;
using GL_EditorFramework.Interfaces;
using OpenTK.Graphics.OpenGL;
using OpenTK;
using System.Drawing;
namespace FirstPlugin.Turbo.CourseMuuntStructs
{
2019-04-08 03:14:39 +02:00
public class EnemyPathGroup : BasePathGroup, IObject
2019-04-06 21:13:55 +02:00
{
public const string N_EnemyPathGroup = "EnemyPathGroup";
public const string N_UnitIdNum = "UnitIdNum";
public EnemyPathGroup(dynamic bymlNode)
{
if (bymlNode is Dictionary<string, dynamic>) Prop = (Dictionary<string, dynamic>)bymlNode;
else throw new Exception("Not a dictionary");
foreach (var point in this["PathPt"])
{
PathPoints.Add(new EnemyPathPoint(point));
}
}
[Browsable(false)]
public Dictionary<string, dynamic> Prop { get; set; } = new Dictionary<string, dynamic>();
public int EnemyPathGroupId
{
2019-04-07 23:54:37 +02:00
get { return this[N_EnemyPathGroup] != null ? this[N_EnemyPathGroup] : -1; }
2019-04-06 21:13:55 +02:00
set { this[N_EnemyPathGroup] = value; }
}
public int UnitIdNum
{
2019-04-07 23:54:37 +02:00
get { return this[N_UnitIdNum] != null ? this[N_UnitIdNum] : -1; }
2019-04-06 21:13:55 +02:00
set { this[N_UnitIdNum] = value; }
}
public dynamic this[string name]
{
get
{
if (Prop.ContainsKey(name)) return Prop[name];
else return null;
}
set
{
if (Prop.ContainsKey(name)) Prop[name] = value;
else Prop.Add(name, value);
}
}
}
2019-04-08 03:14:39 +02:00
public class EnemyPathPoint : BasePathPoint
2019-04-06 21:13:55 +02:00
{
2019-04-07 03:45:25 +02:00
private RenderablePathPoint renderablePoint;
2019-04-06 21:13:55 +02:00
[Browsable(false)]
public override RenderablePathPoint RenderablePoint
{
get
{
2019-04-07 03:45:25 +02:00
if (renderablePoint == null)
renderablePoint = new RenderablePathPoint(new Vector4(1f, 0f, 0f, 1f), Translate, Rotate, new OpenTK.Vector3(30), this);
return renderablePoint;
2019-04-06 21:13:55 +02:00
}
}
[Category("Properties")]
public int BattleFlag
{
2019-04-07 23:54:37 +02:00
get { return this["BattleFlag"] != null ? this["BattleFlag"] : -1; }
2019-04-06 21:13:55 +02:00
set { this["BattleFlag"] = value; }
}
[Category("Properties")]
public int Priority
{
2019-04-07 23:54:37 +02:00
get { return this["Priority"] != null ? this["Priority"] : -1; }
2019-04-06 21:13:55 +02:00
set { this["Priority"] = value; }
}
public EnemyPathPoint(dynamic bymlNode)
{
if (bymlNode is Dictionary<string, dynamic>) Prop = (Dictionary<string, dynamic>)bymlNode;
else throw new Exception("Not a dictionary");
foreach (var point in this["NextPt"])
{
NextPoints.Add(new PointID(point));
}
foreach (var point in this["PrevPt"])
{
PrevPoints.Add(new PointID(point));
}
}
}
}