Ejemplo n.º 1
0
        //ステージによる押し出し
        private void StagePush(Rectangle rect)
        {
            int cnt = 0;

            do
            {
                cnt++;
                if (cnt > 10)
                {
                    break;
                }
                bool    isZeroVelocity = kaito.GetVelocity().Length() < 0.0001f;
                Vector2 velocityN      = isZeroVelocity ? Vector2.Zero :
                                         Vector2.Normalize(kaito.GetVelocity());
                kaito.AddVelocity(-velocityN);
            }while (IsCollisoin(kaito.GetPlayerRectangle()));
        }
Ejemplo n.º 2
0
 private bool IsCollision()
 {
     return(goal.Intersects(kaito.GetPlayerRectangle()));
 }