cleaning up a bunch of stuff; silo works sensibly now

This commit is contained in:
Chris Forbes
2009-10-11 23:27:47 +13:00
parent 6ca0776e9a
commit 99b508956e
7 changed files with 188 additions and 220 deletions

View File

@@ -70,7 +70,6 @@ namespace OpenRa.Game
case "stek":
case "fact":
case "proc":
case "silo":
case "hpad":
case "afld":
case "dome":
@@ -106,6 +105,10 @@ namespace OpenRa.Game
traits.Add( new Traits.Turreted( this ) );
traits.Add( new Traits.RenderBuildingTurreted( this ) );
break;
case "silo":
traits.Add(new Traits.Building(this));
traits.Add(new Traits.RenderBuildingOre(this));
break;
default:
throw new NotImplementedException( "Actor traits for " + name );
@@ -198,6 +201,15 @@ namespace OpenRa.Game
}
}
class RenderBuildingOre : RenderBuilding
{
public RenderBuildingOre(Actor self)
: base(self)
{
anim.PlayThen("make", () => anim.PlayFetchIndex("idle", () => (int)(5 * self.Owner.GetSiloFullness())));
}
}
class RenderWarFactory : RenderBuilding
{
public Animation roof;

View File

@@ -24,7 +24,7 @@ namespace OpenRa.Game
return (1 / 24.0f) * (new float2(mi.Location.X, mi.Location.Y) + game.viewport.Location);
}
float2? dragStart, dragEnd;
float2 dragStart, dragEnd;
public void HandleMouseInput(MouseInput mi)
{
var xy = GetWorldPos(mi);
@@ -35,20 +35,19 @@ namespace OpenRa.Game
}
if (mi.Button == MouseButtons.Left && mi.Event == MouseInputEvent.Move)
if (dragEnd != null)
dragEnd = GetWorldPos(mi);
if (mi.Button == MouseButtons.Left && mi.Event == MouseInputEvent.Up)
{
if (!(orderGenerator is PlaceBuilding))
{
if (dragStart.HasValue && !(dragStart.Value == GetWorldPos(mi)))
orderGenerator = new UnitOrderGenerator( FindUnits( game, 24 * dragStart.Value, 24 * xy ) ); /* band-box select */
if (dragStart != GetWorldPos(mi))
orderGenerator = new UnitOrderGenerator( FindUnits( game, 24 * dragStart, 24 * xy ) ); /* band-box select */
else
orderGenerator = new UnitOrderGenerator( FindUnits( game, 24 * xy, 24 * xy ) ); /* click select */
}
dragStart = dragEnd = null;
dragStart = dragEnd;
}
if (mi.Button == MouseButtons.None && mi.Event == MouseInputEvent.Move)
@@ -88,10 +87,8 @@ namespace OpenRa.Game
public Pair<float2, float2>? SelectionBox()
{
if (dragStart == null || dragEnd == null)
return null;
return Pair.New(24 * dragStart.Value, 24 * dragEnd.Value);
if (dragStart == dragEnd) return null;
return Pair.New(24 * dragStart, 24 * dragEnd);
}
}
}

View File

@@ -1,234 +1,195 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="OpenRa.Game.Actor" Collapsed="true">
<Position X="4" Y="3.5" Width="1.5" />
<Class Name="OpenRa.Game.Actor">
<Position X="1" Y="8.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAgAAAAAAAgAAAAAAAAAAAAAAAAAAIAAAAAIAAQAA=</HashCode>
<HashCode>AAEAAAiAAAAAAAAAAQIAAIAAAQAAAAAAABAAAAAAQAA=</HashCode>
<FileName>Actor.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="Owner" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.World">
<Position X="8.75" Y="4.25" Width="1.5" />
<Position X="1" Y="1.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAYAACABAAAAgAAAAIAABgAAAAAAAAAIAAAAAAAAAAA=</HashCode>
<HashCode>AAYAACABABAAgAAAAIAABgAAAAAAAAAIAAAAAAAAAAA=</HashCode>
<FileName>World.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Building" Collapsed="true">
<Position X="4" Y="6.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA=</HashCode>
<FileName>Building.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="game" />
</ShowAsAssociation>
<ShowAsCollectionAssociation>
<Property Name="Actors" />
</ShowAsCollectionAssociation>
</Class>
<Class Name="OpenRa.Game.Game">
<Position X="11" Y="0.5" Width="1.5" />
<Position X="5.25" Y="6.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAEAAAAIAAAAEEBAAAIAAQQAAAAQAAJAAAAABAQAA=</HashCode>
<HashCode>AAAAEAAAAIAAAAEEBAAAIAAQQAAAAAAAJAAAAABAQAA=</HashCode>
<FileName>Game.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.MainWindow" Collapsed="true">
<Position X="12.75" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAABAAAAAKIEAACAAAgAI=</HashCode>
<FileName>MainWindow.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.MoveOrder" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="4" Y="1.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAABAAAAAAIAAAAAAAAAAAAAAEAAAAAAAAAAA=</HashCode>
<FileName>MoveOrder.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.DeployMcvOrder" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="1.75" Y="1.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAABAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>MoveOrder.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.HarvestOrder" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="6.25" Y="1.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAABAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>MoveOrder.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="controller" />
<Field Name="world" />
<Field Name="worldRenderer" />
<Field Name="viewport" />
<Field Name="pathFinder" />
<Field Name="terrain" />
<Field Name="network" />
<Property Name="LocalPlayer" />
</ShowAsAssociation>
<ShowAsCollectionAssociation>
<Field Name="players" />
</ShowAsCollectionAssociation>
</Class>
<Class Name="OpenRa.Game.PathFinder" Collapsed="true">
<Position X="14.5" Y="0.5" Width="1.5" />
<Position X="5.25" Y="4" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAEAAAAAAAABAAAAAAAAAAAAAEEAAAMAAAAAAAAAA=</HashCode>
<FileName>PathFinder.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Player">
<Position X="12.75" Y="3.25" Width="1.5" />
<Position X="9.25" Y="10.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAEAAAAAAAAAAAAAAAAAACAAAgAAAAAAAAAAAAAAAAA=</HashCode>
<HashCode>AAEAAAAAAAIAAAAAAAAAACAAAgAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Player.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="TechTree" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.PlayerOwned" Collapsed="true">
<Position X="2.75" Y="4.75" Width="1.5" />
<Class Name="OpenRa.Game.UiOverlay">
<Position X="5.25" Y="10.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAgAAAAAAAIAAAAAAAAIACAAAAAAAAAgAAAIAAAAA=</HashCode>
<FileName>PlayerOwned.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Refinery" Collapsed="true">
<Position X="4" Y="7.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Refinery.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Rules" Collapsed="true">
<Position X="12.75" Y="1.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAgAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Rules.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Sidebar" Collapsed="true">
<Position X="14.5" Y="1.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AACAAAQAgECAAGAAEAgCAEAACABAiIAIAAAAIAC8AAA=</HashCode>
<FileName>Sidebar.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.PlaceBuilding" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="16.25" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAEAAACAAAAAAAAAAAAAAAQAAAAAAAAAAAAAQAAAAAA=</HashCode>
<FileName>Sidebar.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" Collapsed="true" />
</Class>
<Class Name="OpenRa.Game.SidebarItem" Collapsed="true">
<Position X="16.25" Y="1.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAACEBAAACAAAAAAAAAIAAA=</HashCode>
<FileName>SidebarItem.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.TerrainCosts" Collapsed="true">
<Position X="14.5" Y="3.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAIAAAAAABAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>TerrainCosts.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Tree" Collapsed="true">
<Position X="6.25" Y="4.75" Width="1.5" />
<TypeIdentifier>
<HashCode>gAAAgAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAIAAAAA=</HashCode>
<FileName>Tree.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.UiOverlay" Collapsed="true">
<Position X="12.75" Y="2.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAIAAAiQAQAAQIABAQAAgAAAYAAAAAAQAAAA=</HashCode>
<HashCode>AAAAAAAAAIAAAiAAAAAQIABAAAAkAAAYAAAAAAQAAAA=</HashCode>
<FileName>UiOverlay.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="game" />
<Field Name="spriteRenderer" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Unit" Collapsed="true">
<Position X="1.75" Y="6.25" Width="1.5" />
<Class Name="OpenRa.Game.Controller">
<Position X="2.25" Y="1.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAEAgDgAAAAAAAAAAAAAAAEAAAEGAAgAAAAERAAAQAA=</HashCode>
<FileName>Unit.cs</FileName>
<HashCode>IAAAAAAIAAAAAAAAAAACAgAAABAAAAAIAIAAAIAABAA=</HashCode>
<FileName>Controller.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
<ShowAsAssociation>
<Field Name="game" />
<Field Name="orderGenerator" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.UnitInfo" Collapsed="true">
<Position X="14.5" Y="2.5" Width="1.5" />
<Class Name="OpenRa.TechTree.TechTree">
<Position X="11.25" Y="14.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AIAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>UnitInfo.cs</FileName>
<HashCode>AAAACAAAAAAAAAAAAAAEAAIgAQAAoyACAAAAAAAAAAA=</HashCode>
<FileName>TechTree\TechTree.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.UnitMissions">
<Position X="16.25" Y="2.5" Width="1.5" />
<Members>
<Method Name="Turn" Hidden="true" />
</Members>
<Class Name="OpenRa.Game.Graphics.WorldRenderer">
<Position X="1.25" Y="10.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAYAAAAAAAAACAAABAAAAAAAAABAAAAAAAAA=</HashCode>
<FileName>UnitMissions.cs</FileName>
<HashCode>AACAEABAAAAAAmAAAAAAAAAIAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Graphics\WorldRenderer.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="uiOverlay" />
<Field Name="spriteRenderer" />
<Field Name="lineRenderer" />
<Field Name="world" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.Viewport">
<Position X="10.75" Y="5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAABAAAiAAAAIYAAEAAAABCAAAAAABgAAAAgBE=</HashCode>
<FileName>Graphics\Viewport.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="renderer" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.Renderer">
<Position X="13.5" Y="5" Width="1.5" />
<TypeIdentifier>
<HashCode>AACAEAACCAAAAgMAAAAAAEAAAAAAAAAAEAAAAAAAAAA=</HashCode>
<FileName>Graphics\Renderer.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.Order" Collapsed="true">
<Position X="5" Y="0.5" Width="1.5" />
<Class Name="OpenRa.Game.Graphics.SpriteRenderer">
<Position X="8" Y="13.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>MoveOrder.cs</FileName>
<HashCode>AAAQQAAAAECAAAAAAAAAAAAAABAQABAAAAAAAACIwAQ=</HashCode>
<FileName>Graphics\SpriteRenderer.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="renderer" />
<Field Name="currentSheet" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.LineRenderer">
<Position X="2.5" Y="13.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAQQAAAACCAAAAAAAAAAAAAABIQAAAAAEAAAAAIwAA=</HashCode>
<FileName>Graphics\LineRenderer.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="renderer" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.Sheet">
<Position X="14.75" Y="9.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAACAgAAACAgAAAAIAAAAAgAAAAIAAAAggAA=</HashCode>
<FileName>Graphics\Sheet.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="renderer" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.TerrainRenderer">
<Position X="8.25" Y="6" Width="1.5" />
<TypeIdentifier>
<HashCode>AACQEAAAAAAAAgAABAAACgAAABgAAAAAAAAAAAAAgAA=</HashCode>
<FileName>Graphics\TerrainRenderer.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="renderer" />
<Field Name="overlayRenderer" />
<Field Name="viewport" />
<Field Name="tileSet" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.Game.Graphics.OverlayRenderer">
<Position X="12.25" Y="10.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAEAAAABAAAiCAAEAAAAAAAAQAAABAAAAAEAAQAAA=</HashCode>
<FileName>Graphics\OverlayRenderer.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Field Name="spriteRenderer" />
</ShowAsAssociation>
</Class>
<Class Name="OpenRa.FileFormats.TileSet">
<Position X="8.25" Y="2.75" Width="1.5" />
<TypeIdentifier />
</Class>
<Class Name="OpenRa.Game.Network">
<Position X="2.25" Y="5.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAKAAAAAgAAAAAAAAEAAAAAACAAAAABAAAAAJAAAQAA=</HashCode>
<FileName>Network\Network.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="OpenRa.Game.PlaceBuildingOrder" Collapsed="true">
<Position X="8.5" Y="1.75" Width="1.5" />
<TypeIdentifier>
<HashCode>EAAAAAAAABAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Sidebar.cs</FileName>
</TypeIdentifier>
</Class>
<Struct Name="OpenRa.Game.CellInfo" Collapsed="true">
<Position X="14.5" Y="4" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAIAAAEAAAAAAAAAAAQAAAAAAAAAAAA=</HashCode>
<FileName>PathFinder.cs</FileName>
</TypeIdentifier>
</Struct>
<Struct Name="OpenRa.Game.PathDistance" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="12.75" Y="8" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAQAAAIAQAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>PathFinder.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" Collapsed="true" />
</Struct>
<Interface Name="OpenRa.Game.IOrderGenerator" Collapsed="true">
<Position X="11" Y="6" Width="1.5" />
<Position X="2.25" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAA=</HashCode>
<FileName>IOrderGenerator.cs</FileName>
</TypeIdentifier>
</Interface>
<Enum Name="OpenRa.Game.UnitMovementType" Collapsed="true">
<Position X="16.25" Y="7" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAQAAAAAAAiAAA=</HashCode>
<FileName>TerrainCosts.cs</FileName>
</TypeIdentifier>
</Enum>
<Enum Name="OpenRa.Game.TerrainMovementType" Collapsed="true">
<Position X="14.5" Y="7" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAABAAAAAAAAIEAAAAAAAABgAAQgAAAAAABQAAA=</HashCode>
<FileName>TerrainCosts.cs</FileName>
</TypeIdentifier>
</Enum>
<Enum Name="OpenRa.Game.SupportedMissions" Collapsed="true">
<Position X="12.75" Y="7" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAIBAAAAAAAAA=</HashCode>
<FileName>UnitMissions.cs</FileName>
</TypeIdentifier>
</Enum>
<Enum Name="OpenRa.TechTree.Race" Collapsed="true">
<Position X="11" Y="7" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAABIAAAAAAAAEAAAA=</HashCode>
<FileName>Race.cs</FileName>
</TypeIdentifier>
</Enum>
<Delegate Name="OpenRa.Game.UnitMission" Collapsed="true">
<Position X="11" Y="8" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAA=</HashCode>
<FileName>UnitMissions.cs</FileName>
</TypeIdentifier>
</Delegate>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>

View File

@@ -11,7 +11,7 @@ namespace OpenRa.Game
{
public readonly World world;
public readonly Map map;
public readonly TreeCache treeCache;
readonly TreeCache treeCache;
public readonly TerrainRenderer terrain;
public readonly Viewport viewport;
public readonly PathFinder pathFinder;

View File

@@ -13,5 +13,10 @@ namespace OpenRa.Game
this.PlayerName = playerName;
TechTree.CurrentRace = race;
}
public float GetSiloFullness()
{
return 0.5f; /* todo: work this out the same way as RA */
}
}
}

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using OpenRa.FileFormats;
using System.Linq;
using OpenRa.Game;
namespace OpenRa.TechTree
@@ -31,14 +32,6 @@ namespace OpenRa.TechTree
CheckAll();
}
static IEnumerable<T> Concat<T>(IEnumerable<T> one, IEnumerable<T> two)
{
foreach (T t in one)
yield return t;
foreach (T t in two)
yield return t;
}
IEnumerable<Tuple<string, string, bool>> Lines(string filename, bool param)
{
Regex pattern = new Regex(@"^(\w+),([\w ]+),(\w+)$");
@@ -55,12 +48,10 @@ namespace OpenRa.TechTree
void LoadRules()
{
IEnumerable<Tuple<string, string, bool>> definitions = Concat( Concat(
Lines("buildings.txt", true),
Lines("vehicles.txt", false) ),
Lines("infantry.txt", false) );
var rules = SharedResources.Rules;
IEnumerable<Tuple<string, string, bool>> definitions =
Lines("buildings.txt", true)
.Concat( Lines( "vehicles.txt", false ) )
.Concat( Lines( "infantry.txt", false ) );
foreach (Tuple<string, string, bool> p in definitions)
objects.Add(p.a, new Item(p.a, p.b, Rules.UnitInfo.Get(p.a), p.c));

View File

@@ -18,20 +18,22 @@ namespace OpenRa.Game
public void Remove( Actor a ) { actors.Remove( a ); }
public void AddFrameEndTask( Action<World> a ) { frameEndActions.Add( a ); }
int lastTime = Environment.TickCount + 2000;
int lastTime = Environment.TickCount;
const int timestep = 40;
public void Update()
{
int t = Environment.TickCount;
int dt = t - lastTime;
if( dt >= 40 )
if( dt >= timestep )
{
lastTime += 40;
lastTime += timestep;
foreach( Actor a in actors )
a.Tick( game, 40 );
a.Tick(game, timestep);
Renderer.waterFrame += 0.05f;
Renderer.waterFrame += 0.00125f * timestep;
}
foreach (Action<World> a in frameEndActions) a(this);