public void SelectEntity(int index) { if (index >= 0 && index < screen.Layers[0].Entities.Count) { selectedEntityIndex = index; } else { selectedEntityIndex = null; } }