Exemple #1
0
    public override bool Do(Blackboard state)
    {
        Pawn actor  = state.Get <Pawn>("Actor");
        Cell target = state.Get <Cell>("Cell");

        CellContentRestriction restriction = new CellContentRestriction()
        {
            Content = Content
        };

        return(restriction.IsTargetValid(actor, target));
    }
    public override void Setup(IBattleActionElement element)
    {
        // By default, hide all the bits
        ShowAll(false);

        CellContentRestriction cellRestriction = element as CellContentRestriction;
        TargetableCellContent  content         = cellRestriction.Content;

        // Everything!
        if (content.HasFlag(TargetableCellContent.All))
        {
            all.SetActive(true);
        }

        else
        {
            // Allies
            if (content.HasFlag(TargetableCellContent.Ally))
            {
                ally.SetActive(true);
            }

            // Enemies
            if (content.HasFlag(TargetableCellContent.Enemy))
            {
                enemy.SetActive(true);
            }

            // Self
            if (content.HasFlag(TargetableCellContent.Self))
            {
                self.SetActive(true);
            }
        }

        // Empty cells?
        if (content.HasFlag(TargetableCellContent.All) ||
            content.HasFlag(TargetableCellContent.Empty))
        {
            empty.SetActive(true);
        }
    }