コード例 #1
0
ファイル: ContainerField.cs プロジェクト: Netvon/Baricade
        public override bool AcceptMove(Movable movable)
        {
            if (movable is Pawn)
            {
                if (Child is Movables.Baricade)
                {
                    if (movable.HasMovesLeft)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!IsEmpty)
                    {
                        return(movable.CanHit(Child.Owner));

                        //var pawn = movable as Pawn;
                        //var child = Child as Pawn;
                        //if (pawn.Owner == child.Owner && movable.IsLastMove)
                        //{
                        //    return false;
                        //}
                    }
                }
            }

            if (movable is Movables.Baricade)
            {
                if (Child != null)
                {
                    return(false);
                }
            }

            return(true);
        }