Beispiel #1
0
 // Main update method
 public void Update()
 {
     if (parent != null)
     {
         position.Y = parent.Position.Y;
         position.X = parent.Position.X + (parent.IndexOfBlock(this)) * BlockWidth;
     }
 }
Beispiel #2
0
        //
        // Constructor
        //

        public Block(Row parent, BlockType type = BlockType.Empty)
        {
            // Assign parent
            this.parent = parent;

            // Assign block type
            this.type = type;

            // Set default position based on parent
            position.Y = parent.Position.Y;
            position.X = (parent.IndexOfBlock(this)) * BlockWidth;
        }
        //
        // Constructor
        //

        public Block(Row parent, BlockType type = BlockType.Empty)
        {
            // Assign parent
            this.parent = parent;

            // Assign block type
            this.type = type;

            // Assign BlockStateTimer
            blockStateTimer             = new Timer();
            blockStateTimer.OnComplete += SetStateDisappearing;
            blockStateTimer.SetTimer(1f);

            // Set default position based on parent
            position.Y = parent.Position.Y;
            position.X = (parent.IndexOfBlock(this)) * BlockWidth;
        }