public WithSupportPowerAnimation(ActorInitializer init, WithSupportPowerAnimationInfo info) : base(info) { this.info = info; self = init.Self; supportPowerManager = self.Owner.PlayerActor.Trait <SupportPowerManager>(); powers = supportPowerManager.GetPowersForActor(self); }
public SelectAttackPowerTarget(Actor self, string order, SupportPowerManager manager, string cursor, MouseButton button, AttackBase attack) { // Clear selection if using Left-Click Orders if (Game.Settings.Game.UseClassicMouseStyle) { manager.Self.World.Selection.Clear(); } instance = manager.GetPowersForActor(self).FirstOrDefault(); this.manager = manager; this.order = order; this.cursor = cursor; expectedButton = button; this.attack = attack; cursorBlocked = cursor + "-blocked"; }
float ISelectionBar.GetValue() { var power = spm.GetPowersForActor(self).FirstOrDefault(sp => !sp.Disabled); if (power == null) { return(0); } var viewer = self.World.RenderPlayer ?? self.World.LocalPlayer; if (viewer != null && !info.DisplayStances.HasStance(self.Owner.Stances[viewer])) { return(0); } return(1 - (float)power.RemainingTime / power.TotalTime); }
public WithSupportPowerOverlay(Actor self, WithSupportPowerOverlayInfo info) : base(info) { this.info = info; this.self = self; var rs = self.Trait <RenderSprites>(); var body = self.Trait <BodyOrientation>(); supportPowerManager = self.Owner.PlayerActor.Trait <SupportPowerManager>(); powers = supportPowerManager.GetPowersForActor(self); buildComplete = !self.Info.HasTraitInfo <BuildingInfo>(); // always render instantly for units overlay = new Animation(self.World, rs.GetImage(self)); var anim = new AnimationWithOffset(overlay, () => body.LocalToWorld(WVec.Zero.Rotate(body.QuantizeOrientation(self, self.Orientation))), () => !visible || !buildComplete); rs.Add(anim, info.Palette, info.IsPlayerPalette); }
float ISelectionBar.GetValue() { if (IsTraitDisabled) { return(0); } var power = spm.GetPowersForActor(self).FirstOrDefault(sp => !sp.Disabled); if (power == null) { return(0); } var viewer = self.World.RenderPlayer ?? self.World.LocalPlayer; if (viewer != null && !Info.DisplayRelationships.HasRelationship(self.Owner.RelationshipWith(viewer))) { return(0); } return(1 - (float)power.RemainingTicks / power.TotalTicks); }