Migrate to System.Lazy.

This commit is contained in:
Paul Chote
2014-03-12 22:48:47 +13:00
parent 67cd0645a4
commit 1b2a90c00c
25 changed files with 87 additions and 125 deletions

View File

@@ -8,6 +8,7 @@
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
@@ -41,9 +42,9 @@ namespace OpenRA.Mods.RA
// Spawned actors (e.g. building husks) shouldn't be revealed
startsRevealed = info.StartsRevealed && !init.Contains<ParentActorInit>();
footprint = FootprintUtils.Tiles(init.self);
tooltip = Lazy.New(() => init.self.TraitsImplementing<IToolTip>().FirstOrDefault());
tooltip = Lazy.New(() => init.self.TraitsImplementing<IToolTip>().FirstOrDefault());
health = Lazy.New(() => init.self.TraitOrDefault<Health>());
tooltip = Exts.Lazy(() => init.self.TraitsImplementing<IToolTip>().FirstOrDefault());
tooltip = Exts.Lazy(() => init.self.TraitsImplementing<IToolTip>().FirstOrDefault());
health = Exts.Lazy(() => init.self.TraitOrDefault<Health>());
frozen = new Dictionary<Player, FrozenActor>();
visible = init.world.Players.ToDictionary(p => p, p => false);