Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Web / PUSG.Web / Models / Shell.cs
blob: f005423bf9f64d0b7dfe709462ab4a86659af98a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
            }
        }
    }
}