-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hole.cs
38 lines (36 loc) · 938 Bytes
/
Hole.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Numerics;
using System.Windows.Shapes;
namespace BouncingBalls02
{
public class Hole
{
public Ellipse sprite;
public Vector2 m_c;
public static float m_r = 50;
int hole;
public static IGameEvents gameEvents = null;
public Hole(Ellipse sprite, int hole)
{
this.sprite = sprite;
this.hole = hole;
}
public bool is_in_hole(Ball ball)
{
/*
* Vector r = b.m_p - m_c;
LONG d = (LONG)r.modulo();
return d < m_r - b.m_r;
*/
Vector2 r = ball.m_p - m_c;
float d = r.Length();
bool debug = d < m_r - Ball.m_radius;
if (debug)
{
ball.m_gone = true;
//gameEvents.OnBallInHole(ball.m_i);
}
return debug;
}
}
}