public void RegisterComponent(GameFrameworkComponent gameFrameworkComponent) { if (gameFrameworkComponent == null) { return; } if (IsHaveComponent(gameFrameworkComponent)) { Debuger.LogError("error Repeat addition component type = " + gameFrameworkComponent.GetType().FullName); return; } LinkedListNode <GameFrameworkComponent> current = GameFrameworkComponents.First; while (current != null) { if (gameFrameworkComponent.Priority > current.Value.Priority) { break; } current = current.Next; } if (current != null) { GameFrameworkComponents.AddBefore(current, gameFrameworkComponent); } else { GameFrameworkComponents.AddLast(gameFrameworkComponent); } }
public bool IsHaveComponent(GameFrameworkComponent gameFrameworkComponent) { Type type = gameFrameworkComponent.GetType(); LinkedListNode <GameFrameworkComponent> current = GameFrameworkComponents.First; while (current != null) { if (current.Value.GetType() == type) { Debuger.LogError("Game Framework component type '{0}' is already exist.", LogColor.Red, type.FullName); return(true); } current = current.Next; } return(false); }