From e8ee7b69663a95d97b226266ebe3ccc95e13c309 Mon Sep 17 00:00:00 2001 From: "ivaylo.zhelev" Date: Sun, 31 Jan 2021 16:42:30 +0200 Subject: Major Business Logic Implementation * Added GameHub * Added Back-End Game Loop and Game Mechanics * Added End Game and Result message --- src/Web/PUSG.Web/Models/Shell.cs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Web/PUSG.Web/Models/Shell.cs (limited to 'src/Web/PUSG.Web/Models/Shell.cs') diff --git a/src/Web/PUSG.Web/Models/Shell.cs b/src/Web/PUSG.Web/Models/Shell.cs new file mode 100644 index 0000000..f005423 --- /dev/null +++ b/src/Web/PUSG.Web/Models/Shell.cs @@ -0,0 +1,40 @@ +using System; + +namespace PUSG.Web.Models +{ + public class Shell : BaseGameObject + { + public string Id { get; set; } = Guid.NewGuid().ToString(); + + public string Direction { get; set; } + + public string Color { get; set; } + + public bool IsDestroyable { get; set; } = false; + + public void Update() + { + if(this.Direction == "up") + { + this.Y -= 7; + } + else if(this.Direction == "right") + { + this.X += 7; + } + else if(this.Direction == "down") + { + this.Y += 7; + } + else if(this.Direction == "left") + { + this.X -= 7; + } + + if(this.Y < 0 || this.Y > 1366 || this.X < 0 || this.X > 1366) + { + this.IsDestroyable = true; + } + } + } +} -- cgit v1.3.1-26-gb76a