protected override void GenerateActions(TurnContext context, AvailableActions addTo)
 {
     if (ActionFactory != null)
     {
         ActionFactory.GenerateActions(context, addTo);
     }
     //TODO: Always allow cancelling?
 }
Exemple #2
0
        protected override void GenerateActions(TurnContext context, AvailableActions addTo)
        {
            MapData mD = context.Element?.GetData <MapData>();

            if (mD != null && mD.MapCell != null)
            {
                // Are there any pickable-uppable items in this cell?
                Element item = mD.MapCell.Contents.FirstWithDataComponent <PickUp>(context.Element);
                if (item != null)
                {
                    addTo.Actions.Add(new PickUpAction(item));
                }
                // TODO: Deal with multiple possible items to pick up?
            }
        }
        /// <summary>
        /// Generate actions given the specified context and add them to the available actions.
        /// Basic implementation that provides the boilerplate for setting up different directions
        /// </summary>
        /// <param name="context"></param>
        /// <param name="addTo"></param>
        public override void GenerateActions(TurnContext context, AvailableActions addTo)
        {
            MapData mD = context.Element?.GetData <MapData>();

            if (mD != null && mD.MapCell != null)
            {
                IList <MapCell> adjacent = context.Stage?.Map?.AdjacentCells(mD.MapCell.Index);
                foreach (var cell in adjacent)
                {
                    Vector     position  = mD.MapCell.Position;
                    Vector     direction = cell.Position - position;
                    GameAction action    = ActionForDirection(position, direction, cell, context);
                    if (action != null)
                    {
                        addTo.Actions.Add(action);
                    }
                }
            }
        }
Exemple #4
0
        protected override void GenerateActions(TurnContext context, AvailableActions addTo)
        {
            // Movement:
            Element self = context.Element;
            MapData mD   = self?.GetData <MapData>();

            if (mD != null && mD.MapCell != null)
            {
                IList <MapCell> adjacent = context.Stage?.Map?.AdjacentCells(mD.MapCell.Index);
                //TODO: Diagonal?
                foreach (var cell in adjacent)
                {
                    if (context.Element.GetData <MapCellCollider>()?.CanEnter(cell) ?? true)
                    {
                        addTo.Actions.Add(new MoveCellAction(self, cell));
                    }
                }
            }
        }
Exemple #5
0
        protected override void GenerateActions(TurnContext context, AvailableActions addTo)
        {
            // Movement:
            Element self = context.Element;
            MapData mD   = self?.GetData <MapData>();

            if (mD != null && mD.MapCell != null)
            {
                IList <MapCell> adjacent = context.Stage?.Map?.AdjacentCells(mD.MapCell.Index);
                foreach (var cell in adjacent)
                {
                    foreach (var element in cell.Contents)
                    {
                        var exit = element.GetData <StageExit>();
                        if (exit != null)
                        {
                            addTo.Actions.Add(new ExitStageAction(cell, exit));
                        }
                    }
                }
            }
        }
Exemple #6
0
        protected override void GenerateActions(TurnContext context, AvailableActions addTo)
        {
            // Bump attack:
            MapData mD = context.Element?.GetData <MapData>();

            if (mD != null && mD.MapCell != null)
            {
                IList <MapCell> adjacent = context.Stage?.Map?.AdjacentCells(mD.MapCell.Index);
                //TODO: Diagonal?
                foreach (var cell in adjacent)
                {
                    Vector  direction = cell.Position - mD.MapCell.Position;
                    Element target    = context.Element.GetData <MapCellCollider>()?.Blocker(cell);
                    if (target != null)
                    {
                        if (context.Element?.GetData <Faction>()?.IsEnemy(target?.GetData <Faction>()) ?? false)
                        {
                            // Only allow bump attacks on elements of an opposing faction?
                            addTo.Actions.Add(new BumpAttackAction(target, cell, direction));
                        }
                    }
                }
            }
        }
Exemple #7
0
        protected override void GenerateActions(TurnContext context, AvailableActions addTo)
        {
            Element  actor    = context.Element;
            Equipped equipped = actor?.GetData <Equipped>();

            if (equipped != null)
            {
                foreach (EquipmentSlot slot in equipped.Slots)
                {
                    if (slot.Item != null)
                    {
                        var iA = slot.Item.GetData <ItemActions>();
                        if (iA?.Prototype != null)
                        {
                            var action = iA.Prototype.Duplicate();
                            action.Trigger = new ActionInputTrigger(slot.HotKey);
                            addTo.Actions.Add(action);
                        }
                    }
                }
            }
            //TODO: Base on items
            //addTo.Actions.Add(new WindUpAction(InputFunction.Ability_1));
        }
Exemple #8
0
 protected abstract void GenerateActions(TurnContext context, AvailableActions addTo);
Exemple #9
0
 protected override void GenerateActions(TurnContext context, AvailableActions addTo)
 {
     //TODO: Add extra effects
     addTo.Actions.Add(new WaitAction());
 }
Exemple #10
0
 /// <summary>
 /// Generate actions given the specified context and add them to the available actions
 /// </summary>
 /// <param name="context"></param>
 /// <param name="addTo"></param>
 public abstract void GenerateActions(TurnContext context, AvailableActions addTo);