Files
OpenRA/OpenRA.Mods.Common/Graphics/ActorPreview.cs
steelphase f948bf0d1b Add Mod.Common Graphics
Moved Graphics to Mod.Common
2014-09-21 01:34:35 -04:00

46 lines
1.3 KiB
C#

#region Copyright & License Information
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.Collections.Generic;
using OpenRA.Graphics;
using OpenRA.Primitives;
namespace OpenRA.Mods.Common.Graphics
{
public interface IActorPreview
{
void Tick();
IEnumerable<IRenderable> Render(WorldRenderer wr, WPos pos);
}
public class ActorPreviewInitializer
{
public readonly ActorInfo Actor;
public readonly Player Owner;
public readonly WorldRenderer WorldRenderer;
public World World { get { return WorldRenderer.world; } }
readonly TypeDictionary dict;
public ActorPreviewInitializer(ActorInfo actor, Player owner, WorldRenderer worldRenderer, TypeDictionary dict)
{
Actor = actor;
Owner = owner;
WorldRenderer = worldRenderer;
this.dict = dict;
}
public T Get<T>() where T : IActorInit { return dict.Get<T>(); }
public U Get<T, U>() where T : IActorInit<U> { return dict.Get<T>().Value(World); }
public bool Contains<T>() where T : IActorInit { return dict.Contains<T>(); }
}
}