예제 #1
0
 protected void CollideWith(CollidableObject obj)
 {
     if (obj == null)
     {
         return;
     }
     if (!obj.doSurvey)
     {
         obj.OnCollide(this);
     }
     OnCollide(obj);
 }
예제 #2
0
 protected override void OnCollide(CollidableObject obj)
 {
     //Console.WriteLine(this.collider.Position);
 }
예제 #3
0
 protected virtual void OnCollide(CollidableObject obj)
 {
     //継承先で決定
 }
예제 #4
0
        protected override void OnCollide(CollidableObject obj)
        {
            base.OnCollide(obj);
            if (obj is Mino)
            {
                var mino = (Mino)obj;
                if (Engine.Mouse.GetMouseButtonState(MouseButton.ButtonLeft) == ButtonState.Push)
                {
                }
                if (Engine.Mouse.GetMouseButtonState(MouseButton.ButtonLeft) == ButtonState.Hold)
                {
                    //参照するMinoを登録する
                    Mino = mino;
                    Vector2F moveVector = (Position - prePosition);
                    Console.WriteLine(moveVector);
                    if (moveVector != new Vector2F(0, 0))
                    {
                        prePosition = Position;
                    }
                    //Console.WriteLine(moveVector);
                    foreach (var m in Mino.mino)
                    {
                        m.Position += moveVector;
                    }
                    mino.Position += moveVector;
                    var mainBlock = mino.mino[Mino.mainBlock];
                    Position    = mainBlock.Position + new Vector2F(mainBlock.Texture.Size.X / 2, mainBlock.Texture.Size.Y / 2);
                    prePosition = Position;
                    doHaveMino  = true;
                }
                if (Engine.Mouse.GetMouseButtonState(MouseButton.ButtonLeft) == ButtonState.Release)
                {
                    doHaveMino = false;
                }
            }

/*            if(obj is Block)
 *          {
 *              if(Engine.Mouse.GetMouseButtonState(MouseButton.ButtonLeft) == ButtonState.Hold)
 *              {
 *                  Console.WriteLine("a");
 *                  obj.Position = Engine.Mouse.Position - obj.Texture.Size / 2;
 *                  doHaveMino = true;
 *                  Block = (Block)obj;
 *              }else
 *              {
 *                  doHaveMino = false;
 *              }
 *          }*/
            if (obj is Cell)
            {
/*                if(doHaveMino)
 *              {
 *                  if(Engine.Mouse.GetMouseButtonState(MouseButton.ButtonLeft) == ButtonState.Release)
 *                  {
 *                      Cell cell = (Cell)obj;
 *                      Block.Scale = new Vector2F(2, 2);
 *                      Block.collider.Size = Block.Texture.Size * 2;
 *                      Block.Position = obj.Position;
 *                      Block = null;
 *                      doHaveMino = false;
 *                      cell.isEmpty = false;
 *                  }
 *              }*/
/*                if(doHaveMino)
 *              {
 *                  if(Engine.Mouse.GetMouseButtonState(MouseButton.ButtonLeft) == ButtonState.Release)
 *                  {
 *                      //objをCellであることを明記する
 *                      Cell cell = (Cell)obj;
 *                      Mino.Scale = new Vector2F(2, 2);
 *                      Mino.collider.Size *= new Vector2F(2, 2);
 *                      Mino.Position = cell.Position;
 *                      Mino = null;
 *                      doHaveMino = false;
 *                  }
 *                  else
 *                  {
 *                  }
 *              }*/
            }
        }