outline attempts

This commit is contained in:
riedel 2023-05-10 16:04:30 +02:00
parent 5601020eb6
commit 240b0b0af4
6 changed files with 42 additions and 1 deletions

View file

@ -124,6 +124,9 @@
<None Update="Resources\Helipad.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\ManholeCover.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\ParkingLot.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View file

@ -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) };

View file

@ -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;

View file

@ -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)
{
}
}
}

View file

@ -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++)
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B