public void EnableMainUI(bool active, GameObject unit) { m_Builder = unit.GetComponent <BuilderUnit>(); UIManager.Instance.SetUnitStatsInfo(m_Data); if (active) { BindBuilderButtons(); } m_Image.SetActive(active); if (!active) { MenuButtons.Instance.UnBindMenuButtons(); } }
public BuilderUnitBuildingOrderGenerator(BuilderUnit queue, string name, WorldRenderer worldRenderer) { var world = queue.Actor.World; this.queue = queue; viewport = worldRenderer.Viewport; placeBuildingInfo = queue.Actor.Owner.PlayerActor.Info.TraitInfo <PlaceBuildingInfo>(); // Clear selection if using Left-Click Orders if (Game.Settings.Game.UseClassicMouseStyle) { world.Selection.Clear(); } var map = world.Map; var tileset = world.Map.Tileset.ToLowerInvariant(); actorInfo = map.Rules.Actors[name]; footprintPlaceBuildingPreviewInfo = actorInfo.TraitInfo <FootprintPlaceBuildingPreviewInfo>(); buildingInfo = actorInfo.TraitInfo <BuildingInfo>(); centerOffset = buildingInfo.CenterOffset(world); topLeftScreenOffset = -worldRenderer.ScreenPxOffset(centerOffset); var buildableInfo = actorInfo.TraitInfo <BuildableInfo>(); var mostLikelyProducer = queue.MostLikelyProducer(); faction = buildableInfo.ForceFaction ?? (mostLikelyProducer.Trait != null ? mostLikelyProducer.Trait.Faction : queue.Actor.Owner.Faction.InternalName); if (map.Rules.Sequences.HasSequence("overlay", "build-valid-{0}".F(tileset))) { buildOk = map.Rules.Sequences.GetSequence("overlay", "build-valid-{0}".F(tileset)).GetSprite(0); } else { buildOk = map.Rules.Sequences.GetSequence("overlay", "build-valid").GetSprite(0); } buildBlocked = map.Rules.Sequences.GetSequence("overlay", "build-invalid").GetSprite(0); }
public virtual void Start(BuilderUnit owner) { Owner = owner; Started = true; }