예제 #1
0
 public GhostShape(World world, Shape shape)
 {
     this.world = world;
     this.shape = shape;
     this.grid = shape.Grid;
     gridCenter = new Vector2(grid.GetLength(0) - 1, grid.GetLength(1) - 1) / 2;
     location = new Point(world.Columns / 2 - 1, (int)gridCenter.Y);
     //If can't spawn. kill world
     if (!CanMove(new Point(0, 0), world, shape.Grid))
         world.Kill();
 }
예제 #2
0
        public Shape(World world, ControlMode controlMode)
        {
            //Select random shape
            switch (GameManager.Random.Next(0, 7))
            {
                case 0:
                    grid = IShape;
                    Color = Color.Red;
                    break;
                case 1:
                    grid = LShape;
                    Color = Color.Blue;
                    break;
                case 2:
                    grid = JShape;
                    Color = Color.Yellow;
                    break;
                case 3:
                    grid = ZShape;
                    Color = Color.Green;
                    break;
                case 4:
                    grid = SShape;
                    Color = Color.Purple;
                    break;
                case 5:
                    grid = TShape;
                    Color = Color.Orange;
                    break;
                case 6:
                    grid = OShape;
                    Color = Color.White;
                    break;
            }

            gridCenter = new Vector2(grid.GetLength(0) - 1, grid.GetLength(1) - 1) / 2;
            location = new Point(world.Columns / 2 - 1, (int)gridCenter.Y);
            this.controlMode = controlMode;
            this.world = world;

            //If can't spawn. kill world
            if (!CanMove(new Point(0, 0), grid))
            {
                world.Kill();
            }

            if (controlMode == ControlMode.Player)
                shadow = new Shadow(world, this);
        }