106 lines
3.6 KiB
C#
106 lines
3.6 KiB
C#
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
namespace ET
|
|||
|
{
|
|||
|
public static class PosConst
|
|||
|
{
|
|||
|
static PosConst()
|
|||
|
{
|
|||
|
#if UNITY_EDITOR
|
|||
|
string str = null;
|
|||
|
for (int i = 0; i < 5; i++)
|
|||
|
{
|
|||
|
for (int j = 0; j < 10; j++)
|
|||
|
{
|
|||
|
var pos = ET.PosHelper.GetPlayerPos(i);
|
|||
|
var targetPos = ET.PosHelper.GetMonsterPos(j);
|
|||
|
str += $"{{new PosPair({i},{j}), {UnityEngine.Vector2.Distance(pos, targetPos)}f}},\n";
|
|||
|
}
|
|||
|
}
|
|||
|
ET.Log.Info(str);
|
|||
|
#endif
|
|||
|
}
|
|||
|
public struct PosPair : IComparer<PosPair>, IEquatable<PosPair>
|
|||
|
{
|
|||
|
public int pos1;
|
|||
|
public int pos2;
|
|||
|
|
|||
|
public PosPair(int pos1, int pos2)
|
|||
|
{
|
|||
|
this.pos1 = pos1;
|
|||
|
this.pos2 = pos2;
|
|||
|
}
|
|||
|
|
|||
|
public int Compare(PosPair x, PosPair y)
|
|||
|
{
|
|||
|
return x.pos1 * 10 + pos2.CompareTo(y.pos1 * 10 + pos2);
|
|||
|
}
|
|||
|
|
|||
|
public bool Equals(PosPair other)
|
|||
|
{
|
|||
|
return pos1 == other.pos1 && pos2 == other.pos2;
|
|||
|
}
|
|||
|
public override string ToString()
|
|||
|
{
|
|||
|
return $"({pos1},{pos2})";
|
|||
|
}
|
|||
|
}
|
|||
|
public static Dictionary<PosPair, float> PosDistanceDic = new Dictionary<PosPair, float>
|
|||
|
{
|
|||
|
{new PosPair(0,0), 8.542829f},
|
|||
|
{new PosPair(0,1), 9.741475f},
|
|||
|
{new PosPair(0,2), 10.98947f},
|
|||
|
{new PosPair(0,3), 7.417496f},
|
|||
|
{new PosPair(0,4), 10.97362f},
|
|||
|
{new PosPair(0,5), 9.824953f},
|
|||
|
{new PosPair(0,6), 6.115515f},
|
|||
|
{new PosPair(0,7), 7.306564f},
|
|||
|
{new PosPair(0,8), 8.563179f},
|
|||
|
{new PosPair(0,9), 5.036757f},
|
|||
|
{new PosPair(1,0), 7.417496f},
|
|||
|
{new PosPair(1,1), 8.542828f},
|
|||
|
{new PosPair(1,2), 9.741475f},
|
|||
|
{new PosPair(1,3), 6.404245f},
|
|||
|
{new PosPair(1,4), 9.824953f},
|
|||
|
{new PosPair(1,5), 8.751842f},
|
|||
|
{new PosPair(1,6), 5.036757f},
|
|||
|
{new PosPair(1,7), 6.115514f},
|
|||
|
{new PosPair(1,8), 7.306564f},
|
|||
|
{new PosPair(1,9), 4.158617f},
|
|||
|
{new PosPair(2,0), 9.741475f},
|
|||
|
{new PosPair(2,1), 10.98947f},
|
|||
|
{new PosPair(2,2), 12.27178f},
|
|||
|
{new PosPair(2,3), 8.542828f},
|
|||
|
{new PosPair(2,4), 12.17649f},
|
|||
|
{new PosPair(2,5), 10.97362f},
|
|||
|
{new PosPair(2,6), 7.306564f},
|
|||
|
{new PosPair(2,7), 8.563178f},
|
|||
|
{new PosPair(2,8), 9.860321f},
|
|||
|
{new PosPair(2,9), 6.115514f},
|
|||
|
{new PosPair(3,0), 6.404246f},
|
|||
|
{new PosPair(3,1), 7.417496f},
|
|||
|
{new PosPair(3,2), 8.542829f},
|
|||
|
{new PosPair(3,3), 5.564643f},
|
|||
|
{new PosPair(3,4), 8.751843f},
|
|||
|
{new PosPair(3,5), 7.785601f},
|
|||
|
{new PosPair(3,6), 4.158618f},
|
|||
|
{new PosPair(3,7), 5.036757f},
|
|||
|
{new PosPair(3,8), 6.115515f},
|
|||
|
{new PosPair(3,9), 3.629746f},
|
|||
|
{new PosPair(4,0), 10.98947f},
|
|||
|
{new PosPair(4,1), 12.27178f},
|
|||
|
{new PosPair(4,2), 13.57867f},
|
|||
|
{new PosPair(4,3), 9.741475f},
|
|||
|
{new PosPair(4,4), 13.41899f},
|
|||
|
{new PosPair(4,5), 12.17649f},
|
|||
|
{new PosPair(4,6), 8.563178f},
|
|||
|
{new PosPair(4,7), 9.860321f},
|
|||
|
{new PosPair(4,8), 11.1839f},
|
|||
|
{new PosPair(4,9), 7.306563f},
|
|||
|
};
|
|||
|
}
|
|||
|
}
|