コード例 #1
0
        void IResolveOrder.ResolveOrder(Actor self, Order order)
        {
            if (order.OrderString != "PlaceBeacon")
            {
                return;
            }

            var pos = self.World.Map.CenterOfCell(order.TargetLocation);

            self.World.AddFrameEndTask(w =>
            {
                if (playerBeacon != null)
                {
                    self.World.Remove(playerBeacon);
                }

                playerBeacon = new AnimatedBeacon(self.Owner, pos, info.Duration, info.Palette, info.IsPlayerPalette, info.BeaconImage, info.BeaconSequence);
                self.World.Add(playerBeacon);

                if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
                {
                    WarGame.Sound.PlayNotification(self.World.Map.Rules, null, info.NotificationType, info.Notification, self.World.RenderPlayer != null ? self.World.RenderPlayer.Faction.InternalName : null);
                }

                if (radarPings != null)
                {
                    if (playerRadarPing != null)
                    {
                        radarPings.Remove(playerRadarPing);
                    }

                    playerRadarPing = radarPings.Add(() => self.Owner.IsAlliedWith(self.World.RenderPlayer), pos, self.Owner.Color.RGB, info.Duration);
                }
            });
        }
コード例 #2
0
ファイル: RadarPings.cs プロジェクト: hadow/Commander
        public RadarPing Add(Func <bool> isVisible, WPos position, Color color, int duration)
        {
            var ping = new RadarPing(isVisible, position, color, duration, info.FromRadius, info.ToRadius, info.ShrinkSpeed, info.RotationSpeed);

            if (ping.IsVisible())
            {
                LastPingPosition = ping.Position;
            }

            Pings.Add(ping);

            return(ping);
        }
コード例 #3
0
ファイル: RadarPings.cs プロジェクト: hadow/Commander
 public void Remove(RadarPing ping)
 {
     Pings.Remove(ping);
 }