Convert overlays (wall, field, crate) to actors. Untested cnc support.

This commit is contained in:
Paul Chote
2010-04-02 00:44:51 +13:00
committed by Bob
parent 3b15aec294
commit 8c15a4f6f4
8 changed files with 255 additions and 166 deletions

View File

@@ -21,6 +21,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System;
using OpenRA.FileFormats;
using OpenRA.GameRules;
using OpenRA.Traits;
@@ -55,6 +56,9 @@ namespace OpenRA
if (name != null)
{
if (!Rules.Info.ContainsKey(name.ToLowerInvariant()))
throw new NotImplementedException("No rules definition for unit {0}".F(name.ToLowerInvariant()));
Info = Rules.Info[name.ToLowerInvariant()];
Health = this.GetMaxHP();

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -262,7 +262,6 @@
<Compile Include="Traits\Unit.cs" />
<Compile Include="Traits\World\SpawnMapActors.cs" />
<Compile Include="Traits\World\UnitInfluence.cs" />
<Compile Include="Traits\World\WallLoadHook.cs" />
<Compile Include="Traits\World\WaterPaletteRotation.cs" />
<Compile Include="Traits\Modifiers\WithShadow.cs" />
<Compile Include="Network\UnitOrders.cs" />

View File

@@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRA.Traits
{
class WallLoadHookInfo : ITraitInfo
{
public readonly string[] OverlayTypes = { };
public readonly string ActorType = "brik";
public object Create(Actor self) { return new WallLoadHook( self, this ); }
}
class WallLoadHook // : IGameStarted
{
WallLoadHookInfo info;
public WallLoadHook(Actor self, WallLoadHookInfo info) { this.info = info; }
/*
public void GameStarted(World w)
{
var map = w.Map;
for (int y = map.YOffset; y < map.YOffset + map.Height; y++)
for (int x = map.XOffset; x < map.XOffset + map.Width; x++)
if (info.OverlayTypes.Contains(w.Map.MapTiles[x, y].overlay))
w.CreateActor(info.ActorType, new int2(x, y), w.NeutralPlayer);
}
*/
}
}