Ejemplo n.º 1
0
    public override bool Equals(object obj)
    {
        if (!(obj is MoveContext))
        {
            return(false);
        }
        MoveContext other   = (MoveContext)obj;
        bool        isEqual = true;

        isEqual &= move.Equals(other.move);
        isEqual &= source.Equals(other.source);
        if (!(allies == null && other.allies == null))
        {
            foreach (BattlefieldPosition bc in allies)
            {
                isEqual &= other.allies.Contains(bc);
            }
        }
        if (!(enemies == null && other.enemies == null))
        {
            foreach (BattlefieldPosition bc in enemies)
            {
                isEqual &= other.enemies.Contains(bc);
            }
        }
        if (!(targets == null && other.targets == null))
        {
            foreach (BattlefieldPosition bc in targets)
            {
                isEqual &= other.targets.Contains(bc);
            }
        }

        return(base.Equals(obj));
    }