Exemplo n.º 1
0
        public List <GameObject> GetAvailableObjects(IEnumerable <GameObject> gameObjects)
        {
            if (gameObjects == null || !gameObjects.Any())
            {
                return(null);
            }

            IEnumerable <GameObject> leftGameObjects  = gameObjects;
            List <GameObject>        availableObjects = new List <GameObject>();

            foreach (var ig in ItemGroups.Where(ig => !ig.IsCompleted))
            {
                var objectForAction = ig.GetAvailableObjects(leftGameObjects);
                if (objectForAction != null && objectForAction.Any())
                {
                    availableObjects.AddRange(objectForAction);
                    leftGameObjects = leftGameObjects.Except(objectForAction).ToList();
                }

                if (!leftGameObjects.Any())
                {
                    break;
                }
            }
            ;

            return(availableObjects);
        }
Exemplo n.º 2
0
        public ProjectItemElement AddItem(string itemType, string include,
                                          IEnumerable <KeyValuePair <string, string> > metadata)
        {
            var itemGroup = ItemGroups.
                            Where(p => string.IsNullOrEmpty(p.Condition) &&
                                  p.Items.Where(s => s.ItemType.Equals(itemType,
                                                                       StringComparison.OrdinalIgnoreCase)).FirstOrDefault() != null).
                            FirstOrDefault();

            if (itemGroup == null)
            {
                itemGroup = AddItemGroup();
            }
            return(itemGroup.AddItem(itemType, include, metadata));
        }
Exemplo n.º 3
0
        public List <GameObject> BuildAction(List <GameObject> gameObjects, int tiredness)
        {
            if (gameObjects == null || !gameObjects.Any())
            {
                return(gameObjects);
            }

            List <GameObject> leftGameObjects = gameObjects;

            foreach (var ig in ItemGroups.Where(ig => !ig.IsCompleted))
            {
                leftGameObjects = ig.Build(leftGameObjects, tiredness);

                if (!leftGameObjects.Any())
                {
                    break;
                }
            }
            ;

            return(leftGameObjects);
        }