示例#1
0
 public bool MapEmpty(Vector2Int direction)
 {
     foreach (var collisionArea in directionCollisionCheckMap[direction])
     {
         if (mapController.map.GetMapUnit(Vector2Util.RoundToInt(LocalToMap(collisionArea))) != null)
         {
             return(false);
         }
     }
     return(true);
 }
 public void Update()
 {
     if (mapController != null)
     {
         mapPosition = mapController.map.WorldToMapPoint(Position);
         if (clamped)
         {
             mapPosition = mapController.map.ClampPosition(mapPosition);
         }
         if (rounded)
         {
             mapPosition = Vector2Util.RoundToInt(mapPosition);
         }
         Position = mapController.map.MapToWorldPoint(mapPosition);
     }
 }
示例#3
0
 public Vector2Int MapToLocalInt(Vector2 pos)
 {
     return(Vector2Util.RoundToInt(pos) - unitController.mapUnit.GetOriginPointInt());
 }
示例#4
0
 public Vector2Int GetOriginPointInt()
 {
     return(Vector2Util.RoundToInt(ActualOriginPosition));
 }
示例#5
0
 public void SetPositionInt(Vector2Int originPoint)
 {
     SetPosition(Vector2Util.RoundToInt(originPoint));
 }
示例#6
0
    public Vector2Int WorldToMapPointClampedRounded(Vector2 worldPoint)
    {
        Vector2 result = WorldToMapPointClamped(worldPoint);

        return(Vector2Util.RoundToInt(result));
    }