Commit 15049a13 authored by lijin's avatar lijin

屏蔽散弹枪

parent 1fa1ae97
...@@ -128,28 +128,29 @@ public class GameMgr : MonoBehaviour ...@@ -128,28 +128,29 @@ public class GameMgr : MonoBehaviour
} }
public void UseGun(Vector2 v) public void UseGun(Vector2 v)
{ {
List<Vector2> list = new List<Vector2>(); OnClickPixel(v);
for (int i = 0; i < gunSize; i++) //List<Vector2> list = new List<Vector2>();
{ //for (int i = 0; i < gunSize; i++)
for (int j = 0; j < gunSize; j++) //{
{ // for (int j = 0; j < gunSize; j++)
Vector2 temp = new Vector2((int)v.x + (i - gunSize / 2) * 5, (int)v.y + (j - gunSize / 2) * 5); // {
list.Add(temp); // Vector2 temp = new Vector2((int)v.x + (i - gunSize / 2) * 5, (int)v.y + (j - gunSize / 2) * 5);
} // list.Add(temp);
} // }
list.Sort((a, b) => //}
{ //list.Sort((a, b) =>
float d_a = Vector2.Distance(a, v); //{
float d_b = Vector2.Distance(b, v); // float d_a = Vector2.Distance(a, v);
return d_a.CompareTo(d_b); // float d_b = Vector2.Distance(b, v);
}); // return d_a.CompareTo(d_b);
for (int i = 0; i < list.Count; i++) //});
{ //for (int i = 0; i < list.Count; i++)
if (OnClickPixel(list[i])) //{
{ // if (OnClickPixel(list[i]))
return; // {
} // return;
} // }
//}
} }
public bool OnClickPixel(float x, float y) public bool OnClickPixel(float x, float y)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment