#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 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() where T : IActorInit { return dict.Get(); } public U Get() where T : IActorInit { return dict.Get().Value(World); } public bool Contains() where T : IActorInit { return dict.Contains(); } } }