Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Pipe {
- //{ TopWidth = value; Propities[0] = value; }
- private bool exist = false;
- private int _TopWidth;
- private int _TopLength;
- private int _BottomWidth;
- private int _BottomLength;
- public int TopWidth { get { return _TopWidth; } set { _TopWidth = value; PropitiesInit(); Propities[0] = value; } }
- public int TopLength { get { return _TopLength; } set { _TopLength = value; PropitiesInit(); Propities[1] = value; } }
- public int BottomWidth { get { return _BottomWidth; } set { _BottomWidth = value; PropitiesInit(); Propities[2] = value; } }
- public int BottomLength { get { return _BottomLength; } set { _BottomLength = value; PropitiesInit(); Propities[3] = value; } }
- private List<int> Propities;// /{ get; set;}
- // сильно зависим от параметров окна //
- private void PropitiesInit() {
- if (!exist)
- Propities = new List<int>();
- for (var i = 0; i < 4; i++)
- Propities.Add(0);
- exist = true;
- }
- public Pipe (int windowHeight , int windowWidth, int distanceBetweenPipes) // To do make normal params to generate pipe
- {
- PropitiesInit();
- Random random = new Random();
- TopWidth = windowWidth;
- TopLength = random.Next(40, (windowHeight - distanceBetweenPipes)); // refact 40 to pipe length min
- BottomWidth = windowWidth;
- BottomLength = TopLength + distanceBetweenPipes;
- Propities[0] = TopWidth;
- Propities[1] = TopLength;
- Propities[2] = BottomWidth;
- Propities[3] = BottomLength;
- }
- public bool Any()
- {
- return Propities.Any();
- }
- public int this[int i]
- {
- get{return Propities[i];}
- set
- {
- Propities[i] = value;
- switch (i)
- {
- case 0 :
- _TopWidth = value;
- break;
- case 1 :
- _TopLength = value;
- break;
- case 2 :
- _BottomWidth = value;
- break;
- case 3 :
- _BottomLength = value;
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement