Skip to content

Commit

Permalink
Added windows system
Browse files Browse the repository at this point in the history
  • Loading branch information
anomalou committed Aug 24, 2019
1 parent 7e097c4 commit 3178afe
Show file tree
Hide file tree
Showing 9 changed files with 366 additions and 180 deletions.
8 changes: 4 additions & 4 deletions Action.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace ConsoleApplication{

class BaseAction:Source{//base action for the most objects
public virtual void Action(int x,int y){}
class BaseAction{//base action for the most objects
public virtual void Action(int x,int y,Source s){}
}
class OpenDoor:BaseAction{//soon with this class you will can open doors
public override void Action(int x,int y){
source.RemoveObj(x,y);
public override void Action(int x,int y,Source s){
s.RemoveObj(x,y);
}
}
}
88 changes: 88 additions & 0 deletions GameplayWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using System;

namespace ConsoleApplication{
class GameplayWindow:IWindow{

int _sizeX;
int _sizeY;
int _positionX;
int _positionY;
char[,] _content;
int tx,ty;
public int sizeX{
get{
return _sizeX;
}
set{
_sizeX = value;
}
}

public int sizeY{
get{
return _sizeY;
}
set{
_sizeY = value;
}
}

public int positionX{
get{
return _positionX;
}
set{
_positionX = value;
}
}

public int positionY{
get{
return _positionY;
}
set{
_positionY = value;
}
}

public char[,] content{
get{
return _content;
}
set{
_content = value;
}
}

public GameplayWindow(){
sizeX = 15;
sizeY = 15;
content = new char[sizeX,sizeY];
}
public void Fill(Source s){
for(int i = 0; i < sizeX; i++){
for(int t = 0; t < sizeY; t++){
tx = s.playerX - sizeX/2 + i;
ty = s.playerY - sizeY/2 + t;
if(tx >= 0 & tx < s.GetDungeonW & ty >= 0 & ty < s.GetDungeonH)
content[i,t] = s.GetMapObj[tx,ty].symbol;
else
content[i,t] = ' ';
}
}
}

public void Update(Source s){
for(int i = 0; i < sizeX; i++){
for(int t = 0; t < sizeY; t++){
tx = s.playerX - sizeX/2 + i;
ty = s.playerY - sizeY/2 + t;
if(tx >= 0 & tx < s.GetDungeonW & ty >= 0 & ty < s.GetDungeonH)
content[i,t] = s.GetMapObj[tx,ty].symbol;
else
content[i,t] = ' ';
}
}
}
}
}
13 changes: 13 additions & 0 deletions IWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace ConsoleApplication{
interface IWindow{
int sizeX{get;set;}
int sizeY{get;set;}
int positionX{get;set;}
int positionY{get;set;}

char[,] content{get;set;}

void Fill(Source s);
void Update(Source s);
}
}
Loading

0 comments on commit 3178afe

Please sign in to comment.