private void InputHistory_InputAdded()
        {
            HistoricalInput last = InputHistory.History.Last();

            if (last.ActionSelected == ActionSelected.Till)
            {
                foreach (MagicalLifeAPI.GUI.Selectable item in last.Selected)
                {
                    Tile tile = World.GetTile(RenderInfo.Dimension, item.MapLocation.X, item.MapLocation.Y);

                    if (tile is ITillable &&
                        tile.ImpendingAction == ActionSelected.None &&
                        tile.Resources == null)
                    {
                        TillTask task = new TillTask(tile.MapLocation, Guid.NewGuid(), RenderInfo.Dimension);
                        tile.ImpendingAction = ActionSelected.Till;
                        TaskManager.Manager.AddTask(task);
                    }
                }
            }
        }
Example #2
0
        private void InputHistory_InputAdded()
        {
            HistoricalInput last = InputHistory.History.Last();

            if (last.ActionSelected == ActionSelected.Till)
            {
                foreach (HasComponents item in last.Selected)
                {
                    ComponentSelectable selected = item.GetExactComponent <ComponentSelectable>();
                    Tile tile = World.GetTile(RenderInfo.Dimension, selected.MapLocation.X, selected.MapLocation.Y);

                    if (tile.HasComponent <ComponentTillable>() &&
                        tile.ImpendingAction == ActionSelected.None &&
                        tile.MainObject == null)
                    {
                        TillTask task = new TillTask(tile.GetExactComponent <ComponentSelectable>().MapLocation, Guid.NewGuid(), RenderInfo.Dimension);
                        tile.ImpendingAction = ActionSelected.Till;
                        TaskManager.Manager.AddTask(task);
                    }
                }
            }
        }