Beispiel #1
0
        private void CheckSecondCollision(IAliveCreature snake, ICreature creature)
        {
            var cPos = creature.GetPosition();
            var conflictedCreature = map[cPos.X, cPos.Y];

            if (conflictedCreature != null)
            {
                if (conflictedCreature.DeadInConflict(creature))
                {
                    conflictedCreature.ActInConflict(creature, snake, MapWidth, MapHeight);
                    creature.ActInConflict(conflictedCreature, snake, MapWidth, MapHeight);
                    map[cPos.X, cPos.Y] = creature;
                    if (conflictedCreature is Destiny)
                    {
                        Add("destiny");
                    }
                    return;
                }
                isOver        = true;
                finishReason += snake.GetName() + " dead,";
                return;
            }
            map[cPos.X, cPos.Y] = creature;
        }