public void Update() { if (Parent.Scene.ServiceProvider.GetService <ITimeService>().TimeScale == 0) { return; } if (Parent.GetComponent <OwnerComponent>().Owner != 0) { return; } if (!Parent.GetComponent <SelectComponent>().Selected) { ClearBuyButtons(); return; } IGameObjectService gameObjectService = Parent.Scene.ServiceProvider.GetService <IGameObjectService>(); foreach (var entity in gameObjectService.GetEntities()) { if (!entity.HasComponent <BuyArmyComponent>()) { continue; } // return if other entity with BuyArmyComponent is selected if (entity != Parent && entity.GetComponent <SelectComponent>().Selected) { ClearBuyButtons(); return; } } CreateBuyButtons(); }