コード例 #1
0
ファイル: Barricading.cs プロジェクト: alexturpin/Zombles
        public static IEnumerable<Barricading> Discover(Beliefs beliefs)
        {
            var blockBeliefs = beliefs.GetBlock(beliefs.Entity.Block);

            var resources = beliefs.Entities
                .Where(x => x.Type == EntityType.PlankPile || x.Type == EntityType.PlankSource)
                .Where(x => x.LastBlock == blockBeliefs.Block)
                .Sum(x => x.Type == EntityType.PlankPile
                    ? x.Entity.GetComponent<WoodPile>().Count
                    : x.Entity.GetComponent<WoodenBreakable>().AveragePlanks);

            if (!blockBeliefs.Block.Enclosed && blockBeliefs.Resources + resources > 10) {
                yield return new Barricading(blockBeliefs);
            }
        }