난을 분류 할 해결 방법 :
1. iDisplay에 인터페이스를 생성하고 생성 Draw(SpriteBatch batch)
2. 표시 핸들 모든 클래스에 추가, Add
, Remove
, Draw
방법과 많은 layers
을 가지고 DisplayManager
(IDisplay 개체 목록) 원하는대로. 개인적으로 중간 레이어는 내가 물건을 정렬하는 레이어입니다. 그래서 정렬 된 객체 뒤에, 그리고 정렬 된 객체 앞에 물건을 넣을 수 있습니다.
3. 도면을 처리하는 Main
클래스에서 함수를 호출하면 layers
(목록) 및 IDisplay
항목을 실행하고 모든 항목에 Draw
함수를 호출합니다. 하기 DisplayManager에서
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
DisplayManager.Draw(spriteBatch);
spriteBatch.End();
: 그리고
public static void Draw(SpriteBatch batch){
for (i = 0; i < bottom.Count; i++)
{
bottom[i].Draw(batch);
}
//Gets the model from the IDisplay item, and then it's Y position, and orders
//the sort layer(list) by that.
sort = sort.OrderBy(o => o.getModel.Position.Y).ToList();
for (i = 0; i < sort.Count; i++)
{
sort[i].Draw(batch);
}
for (i = 0; i < top.Count; i++)
{
top[i].Draw(batch);
}
}
나는 코드는 문제를 보여주는하고 있지만 일반적으로 순수 기반 등각 장면을 그리기 벗어날 수있는 방법을 잘 모르겠어요 뷰포트의 Y 축. 상위 항목이 먼저 그려집니다. 또한 레이어가있을 수도 있지만 레이어 내에서 그대로 유지되어야합니다. 표고가있는 경우에만 어려워 질 것입니다.하지만 레이어로도 처리 될 수 있습니다. – Magus
무엇을 시도 했습니까? 스크린 샷있어? 수행 할 코드는 무엇입니까? – craftworkgames