﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;

namespace Rimworld_Animations
{
    public abstract class BaseGroupAnimationContext
    {
        public int actorShift = 0;
        public int priority = 0;

        public List<BasePawnTest> whitelist;
        public List<BasePawnTest> blacklist;

        public virtual bool CanAnimationBeUsed(List<Pawn> actors, int numActors)
        {

            if (numActors != actors.Count)
            {
                return false;
            }

            if (!whitelist.NullOrEmpty())
            {
                for (int i = 0; i < whitelist.Count; i++)
                {
                    // check whitelist to make sure pawn can be in this act
                    //for each whitelist item, pawntest must hold true for that pawn
                    if (!whitelist[i].PawnTest(actors[i]))
                    {
                        return false;
                    }

                }
            }

            if (!blacklist.NullOrEmpty())
            {
                for (int i = 0; i < blacklist.Count; i++)
                {
                    // check blacklist to make sure pawn can be in this act
                    // for each blacklist item, pawntest must hold false for that pawn
                    if (blacklist[i].PawnTest(actors[i]))
                    {
                        return false;
                    }

                }
            }

            return true;
        }
        public virtual int AnimationReorder()
        {
            return actorShift;
        }
        public virtual int AnimationPriority()
        {
            return priority;
        }
        public abstract string DebugMessage();

        //cool class for designating contexts for animations
        // configure CanAnimationBeUsed to test whether it can be used
    }
}

1.5/Source/Animations/GroupAnimations/GroupAnimationContexts/BaseGroupAnimationContext.cs