From 240b0b0af423c5c9cebfa951bf8b8d73191c9da2 Mon Sep 17 00:00:00 2001 From: riedel Date: Wed, 10 May 2023 16:04:30 +0200 Subject: [PATCH] outline attempts --- CityGame/CityGame.csproj | 3 +++ CityGame/Classes/Entities/Car.cs | 1 + CityGame/Classes/Entities/Entity.cs | 2 +- CityGame/Classes/Entities/GasPipe.cs | 30 +++++++++++++++++++++++++++ CityGame/MainWindow.xaml.cs | 7 +++++++ CityGame/Resources/ManholeCover.png | Bin 0 -> 377 bytes 6 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 CityGame/Classes/Entities/GasPipe.cs create mode 100644 CityGame/Resources/ManholeCover.png diff --git a/CityGame/CityGame.csproj b/CityGame/CityGame.csproj index 94368f5..739ee12 100644 --- a/CityGame/CityGame.csproj +++ b/CityGame/CityGame.csproj @@ -124,6 +124,9 @@ PreserveNewest + + Always + PreserveNewest diff --git a/CityGame/Classes/Entities/Car.cs b/CityGame/Classes/Entities/Car.cs index 790154b..f666b06 100644 --- a/CityGame/Classes/Entities/Car.cs +++ b/CityGame/Classes/Entities/Car.cs @@ -49,6 +49,7 @@ namespace CityGame.Classes.Entities { OCanvas canvas = new OCanvas(); Image car = new SourcedImage(PNGFile); + car.Effects.Add(new OutlineEffect()); canvas.Children.Add(car); var light = new LightSource { Radius = 128, Angle = 64, Intensity = 2, Color = Color.White, Type = LightSourceType.Spotlight, Rotation = -90, RotationOrigin = new Point(MainWindow.TileSize / 2, MainWindow.TileSize / 2) }; diff --git a/CityGame/Classes/Entities/Entity.cs b/CityGame/Classes/Entities/Entity.cs index 8726c61..116d29d 100644 --- a/CityGame/Classes/Entities/Entity.cs +++ b/CityGame/Classes/Entities/Entity.cs @@ -17,7 +17,7 @@ namespace CityGame.Classes.Entities public float Rotation { get; set; } public long Time { get; set; } public OCanvas Object { get; set; } - + public bool SingleSelect { get; set; } public OCanvas GetImage() { return Object; diff --git a/CityGame/Classes/Entities/GasPipe.cs b/CityGame/Classes/Entities/GasPipe.cs new file mode 100644 index 0000000..a1ec760 --- /dev/null +++ b/CityGame/Classes/Entities/GasPipe.cs @@ -0,0 +1,30 @@ +using CityGame.Classes.Rendering; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using WPFGame; + +namespace CityGame.Classes.Entities +{ + public class GasPipe : Entity + { + public int Exploded { get; set; } + public GasPipe() + { + if (MainWindow.random.Next(0, 2) == 0) Rotation += 180; + SingleSelect = true; + } + + public override OCanvas Render() + { + return new SourcedImage("ManholeCover.png"); + } + + public override void Tick(long deltaTime) + { + + } + } +} diff --git a/CityGame/MainWindow.xaml.cs b/CityGame/MainWindow.xaml.cs index 5262c0e..265c178 100644 --- a/CityGame/MainWindow.xaml.cs +++ b/CityGame/MainWindow.xaml.cs @@ -427,6 +427,13 @@ namespace CityGame Entities.Add(new PoliceCar { X = x, Y = y }); } + var roads = SourcedImage.GetObjectsBySourceFile("Road1.png", "Road2.png", "Road2c.png", "Road3c.png", "Road4c.png"); + var pipeCount = NPCCount; + var pipeRoads = roads.OrderBy(x => random.Next(0, roads.Count)).Take(pipeCount).ToArray(); + foreach (Image image in pipeRoads) + { + Entities.Add(new GasPipe { X = (float)Canvas.GetLeft(image.Parent), Y = (float)Canvas.GetTop(image.Parent), Rotation = image.Rotation }); + } for (int n = 0; n < NPCCount; n++) { diff --git a/CityGame/Resources/ManholeCover.png b/CityGame/Resources/ManholeCover.png new file mode 100644 index 0000000000000000000000000000000000000000..d143609a79a5f3f33b8683a5e7ec5f05f5f48d69 GIT binary patch literal 377 zcmV-<0fzpGP)Px$Gf6~2RCr$Pmq7}{Fbo8pQ=z};8~Xnz^bP$*p{Eud0>(H5WI=>>atsK2N4rw8 zHSuQ?*WUnu1H=gs0dWH`1c?9<5GOzc#0|g}AOb`{oB$CJHvn6J2oM2r0z^RE0I^%( z`Dnix(APWmoXDnyMZm=0Z}Y2tzO7}25CUKnZ-VXVfnOkA;3Ze34hK}}q*n(H@RF-i zhXbl~(yIdpc*#|%!vR$~>D7S)yyU9X;eaZg^y