improved humanoid animations, some map stats in map editor, gap connections visible in editor, editing wire nodes in editor, pumps don't have to be manually linked, coroutine exception handling
This commit is contained in:
@@ -38,8 +38,19 @@ namespace Subsurface.Items.Components
|
||||
public Pump(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
item.linkedTo.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{ GetHulls(); };
|
||||
GetHull();
|
||||
}
|
||||
|
||||
public override void Move(Vector2 amount)
|
||||
{
|
||||
base.Move(amount);
|
||||
|
||||
GetHull();
|
||||
}
|
||||
|
||||
public override void OnMapLoaded()
|
||||
{
|
||||
GetHull();
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
@@ -77,28 +88,33 @@ namespace Subsurface.Items.Components
|
||||
|
||||
voltage = 0.0f;
|
||||
}
|
||||
|
||||
private void GetHulls()
|
||||
|
||||
private void GetHull()
|
||||
{
|
||||
hull1 = null;
|
||||
hull2 = null;
|
||||
|
||||
foreach (MapEntity e in item.linkedTo)
|
||||
{
|
||||
Hull hull = e as Hull;
|
||||
if (hull == null) continue;
|
||||
|
||||
if (hull1 == null)
|
||||
{
|
||||
hull1 = hull;
|
||||
}
|
||||
else if (hull2 == null && hull != hull1)
|
||||
{
|
||||
hull2 = hull;
|
||||
break;
|
||||
}
|
||||
}
|
||||
hull1 = Hull.FindHull(item.Position, item.CurrentHull);
|
||||
}
|
||||
|
||||
//private void GetHulls()
|
||||
//{
|
||||
// hull1 = null;
|
||||
// hull2 = null;
|
||||
|
||||
// foreach (MapEntity e in item.linkedTo)
|
||||
// {
|
||||
// Hull hull = e as Hull;
|
||||
// if (hull == null) continue;
|
||||
|
||||
// if (hull1 == null)
|
||||
// {
|
||||
// hull1 = hull;
|
||||
// }
|
||||
// else if (hull2 == null && hull != hull1)
|
||||
// {
|
||||
// hull2 = hull;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
{
|
||||
|
||||
@@ -287,20 +287,21 @@ namespace Subsurface.Items.Components
|
||||
|
||||
for (int i = 1; i < Nodes.Count; i++)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 3, (int)-Nodes[i].Y -3, 6, 6), Color.Red, true, 0.0f);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 3, (int)-Nodes[i].Y - 3, 6, 6), Color.Red, true, 0.0f);
|
||||
|
||||
if (Vector2.Distance(Game1.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) < 20.0f)
|
||||
if (GUIComponent.MouseOn == null &&
|
||||
Vector2.Distance(Game1.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) < 20.0f)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 10, (int)-Nodes[i].Y - 10, 20, 20), Color.Red, false, 0.0f);
|
||||
|
||||
if (selectedNodeIndex==null && selectedNodeIndex>0 && selectedNodeIndex<Nodes.Count-1)
|
||||
if (selectedNodeIndex==null)// && selectedNodeIndex>0 && selectedNodeIndex<Nodes.Count-1)
|
||||
{
|
||||
if ( PlayerInput.LeftButtonDown())
|
||||
if (PlayerInput.LeftButtonDown())
|
||||
{
|
||||
MapEntity.SelectEntity(item);
|
||||
selectedNodeIndex = i;
|
||||
}
|
||||
else
|
||||
else if (PlayerInput.RightButtonClicked())
|
||||
{
|
||||
Nodes.RemoveAt(i);
|
||||
break;
|
||||
@@ -325,8 +326,7 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (selectedNodeIndex != null) MapEntity.SelectEntity(item); ;
|
||||
selectedNodeIndex = null;
|
||||
selectedNodeIndex = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user