static public int constructor(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); UnityEngine.Vector3Int o; if (argc == 4) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); o = new UnityEngine.Vector3Int(a1, a2, a3); pushValue(l, true); pushValue(l, o); return(2); } else if (argc <= 2) { o = new UnityEngine.Vector3Int(); pushValue(l, true); pushValue(l, o); return(2); } return(error(l, "New object failed.")); } catch (Exception e) { return(error(l, e)); } }
// Psudo command void move(Int3Type diff) { while (diff.y != 0) { Int3Type lld = int3(0, longestLLD(diff.y), 0); diff -= lld; smove(lld); } while (Math.Abs(diff.x) > 5) { Int3Type lld = int3(longestLLD(diff.x), 0, 0); diff -= lld; smove(lld); } while (Math.Abs(diff.z) > 5) { Int3Type lld = int3(0, 0, longestLLD(diff.z)); diff -= lld; smove(lld); } if (diff.x != 0 && diff.z != 0) { lmove(int3(diff.x, 0, 0), int3(0, 0, diff.z)); } else if (diff.x != 0) { smove(int3(diff.x, 0, 0)); } else if (diff.z != 0) { smove(int3(0, 0, diff.z)); } }
public override void GetTileData(UnityEngine.Vector3Int position, ITilemap tilemap, ref TileData tileData) { // Maybe this is needed // base.GetTileData (position, tilemap, ref tileData); tileData.sprite = _sprites.RandomItem(); tileData.gameObject = gameObject; }
static int _CreateUnityEngine_Vector3Int(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 1); int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); int arg2 = (int)LuaDLL.luaL_checknumber(L, 3); UnityEngine.Vector3Int obj = new UnityEngine.Vector3Int(arg0, arg1, arg2); ToLua.PushValue(L, obj); return(1); } else if (count == 0) { UnityEngine.Vector3Int obj = new UnityEngine.Vector3Int(); ToLua.PushValue(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Vector3Int.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public override void RefreshTile(Vec3I gridPos, TM.ITilemap tilemap) { Vec2I pos = GridToTile(gridPos); Vec2I subTile = GridToSubTile(gridPos); Map.BBTile tile = GetTile(pos); if (!disableRefresh || HasSprite(tile, pos, subTile)) { tilemap.RefreshTile(gridPos); } if (disableRefresh) { return; } for (int tx = 0; tx < 2; ++tx) { for (int ty = 0; ty < 2; ++ty) { Vec2I t = pos + new Vec2I(tx + subTile.x - 1, ty + subTile.y - 1); if (t != pos) { t *= 2; for (int i = 0; i < 4; ++i) { tilemap.RefreshTile(new Vec3I(t.x + (i >> 1), t.y + (i % 2), 0)); } } } } }
static int GetBoundsLocal(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2) { UnityEngine.GridLayout obj = (UnityEngine.GridLayout)ToLua.CheckObject <UnityEngine.GridLayout>(L, 1); UnityEngine.Vector3Int arg0 = StackTraits <UnityEngine.Vector3Int> .Check(L, 2); UnityEngine.Bounds o = obj.GetBoundsLocal(arg0); ToLua.Push(L, o); return(1); } else if (count == 3) { UnityEngine.GridLayout obj = (UnityEngine.GridLayout)ToLua.CheckObject <UnityEngine.GridLayout>(L, 1); UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); UnityEngine.Vector3 arg1 = ToLua.ToVector3(L, 3); UnityEngine.Bounds o = obj.GetBoundsLocal(arg0, arg1); ToLua.Push(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.GridLayout.GetBoundsLocal")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Equals(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes <UnityEngine.Vector3Int>(L, 2)) { UnityEngine.Vector3Int obj = (UnityEngine.Vector3Int)ToLua.CheckObject(L, 1, typeof(UnityEngine.Vector3Int)); UnityEngine.Vector3Int arg0 = StackTraits <UnityEngine.Vector3Int> .To(L, 2); bool o = obj.Equals(arg0); LuaDLL.lua_pushboolean(L, o); ToLua.SetBack(L, 1, obj); return(1); } else if (count == 2 && TypeChecker.CheckTypes <object>(L, 2)) { UnityEngine.Vector3Int obj = (UnityEngine.Vector3Int)ToLua.CheckObject(L, 1, typeof(UnityEngine.Vector3Int)); object arg0 = ToLua.ToVarObject(L, 2); bool o = obj.Equals(arg0); LuaDLL.lua_pushboolean(L, o); ToLua.SetBack(L, 1, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Vector3Int.Equals")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int ToString(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { UnityEngine.Vector3Int obj = (UnityEngine.Vector3Int)ToLua.CheckObject(L, 1, typeof(UnityEngine.Vector3Int)); string o = obj.ToString(); LuaDLL.lua_pushstring(L, o); return(1); } else if (count == 2) { UnityEngine.Vector3Int obj = (UnityEngine.Vector3Int)ToLua.CheckObject(L, 1, typeof(UnityEngine.Vector3Int)); string arg0 = ToLua.CheckString(L, 2); string o = obj.ToString(arg0); LuaDLL.lua_pushstring(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.Vector3Int.ToString")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void ParseUnityScene() { var meshFilters = Object.FindObjectsOfType <MeshFilter>(); var vertexOffset = 0; foreach (var mf in meshFilters) { Debug.Log(mf.name); var mesh = mf.sharedMesh; // mesh.vertices, mesh.triangles, localToWorldMatrix是属性 // 在一个循环数很大的for里面会产生巨大开销 var verts = mesh.vertices; var norms = mesh.normals; uv0s.AddRange(mesh.uv); if (mesh.uv.Length < verts.Length) { Vector2[] dummyFix = new Vector2[verts.Length - mesh.uv.Length]; uv0s.AddRange(dummyFix); } Debug.Log(verts.Length); Debug.Log(norms.Length); Debug.Log(mesh.uv.Length); var matWorld = mf.transform.localToWorldMatrix; for (int i = 0; i < verts.Length; i++) { //Vector3 worldPos = matWorld.MultiplyPoint(mesh.vertices[i]); // Bad idea. Vector3 worldPos = matWorld.MultiplyPoint(verts[i]); vertices.Add(worldPos); Vector3 worldNormal = matWorld.MultiplyVector(norms[i]); normals.Add(worldNormal); } var renderer = mf.GetComponent <Renderer>(); var material = ParseMaterial(renderer); materials.Add(material); var matIdx = materials.Count - 1; var tris = mesh.triangles; for (int i = 0; i < tris.Length; i += 3) { var tri = new BVHTriangle(vertexOffset + tris[i], vertexOffset + tris[i + 1], vertexOffset + tris[i + 2]); triangles.Add(tri); matIndices.Add(matIdx); } vertexOffset += mesh.vertices.Length; } builded = true; Debug.Log("Tracer: totally materials count:" + materials.Count); Debug.Log("Tracer: totally diffuse textures count:" + diffuseTextures.Count); }
public void UpdateTile(Vec2I v) { Vec3I gridPos = (v * 2).Vec3(); var vtilePrev = tilemap.GetTile(gridPos) as T; var vtile = vtilePrev == vtileA ? vtileB : vtileA; for (int i = 0; i < 4; ++i) { tilemap.SetTile(gridPos + new Vec3I(i % 2, i >> 1, 0), vtile); } }
private void ParseMapBottomRow(Internal.CommunicationStream message) { UnityEngine.Vector3Int position = WorldMapStorage.Position; position.y++; WorldMapStorage.Position = position; MiniMapStorage.Position = position; WorldMapStorage.ScrollMap(0, -1); WorldMapStorage.InvalidateOnscreenMessages(); ProtocolGameExtentions.ReadArea(message, 0, Constants.MapSizeY - 1, Constants.MapSizeX - 1, Constants.MapSizeY - 1); WorldMapStorage.CacheRefresh = true; }
static public int ctor_s(IntPtr l) { try { UnityEngine.Vector3Int o; o = new UnityEngine.Vector3Int(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
private void ParseMapTopRow(Internal.CommunicationStream message) { UnityEngine.Vector3Int position = WorldMapStorage.Position; position.y--; //NewGameManager.inst.RenderGroundRow(NewGameManager.rowType.top); WorldMapStorage.Position = position; MiniMapStorage.Position = position; WorldMapStorage.ScrollMap(0, 1); WorldMapStorage.InvalidateOnscreenMessages(); ProtocolGameExtentions.ReadArea(message, 0, 0, Constants.MapSizeX - 1, 0); WorldMapStorage.CacheRefresh = true; }
public GridPlaneOrientation( UnityEngine.Vector2Int size = default, UnityEngine.Vector3Int offset = default, float normalOffset = 0f, int subdivisions = 1 ) { this.enabled = true; this.size = size; this.offset = offset; this.normalOffset = normalOffset; this.subdivisions = subdivisions; }
private void ParseMapBottomFloor(Internal.CommunicationStream message) { UnityEngine.Vector3Int position = WorldMapStorage.Position; position.x--; position.y--; position.z++; WorldMapStorage.Position = position; MiniMapStorage.Position = position; if (position.z > Constants.GroundLayer + 1) { WorldMapStorage.ScrollMap(0, 0, 1); if (position.z <= Constants.MapMaxZ - Constants.UndergroundLayer) { ProtocolGameExtentions.ReadFloor(message, 2 * Constants.UndergroundLayer, 0); } } else if (position.z == Constants.GroundLayer + 1) { WorldMapStorage.ScrollMap(0, 0, Constants.UndergroundLayer + 1); int skip = 0; for (int zposition = Constants.UndergroundLayer; zposition >= 0; zposition--) { skip = ProtocolGameExtentions.ReadFloor(message, zposition, skip); } } Player.StopAutowalk(true); WorldMapStorage.InvalidateOnscreenMessages(); var mapPosition = WorldMapStorage.ToMap(position); for (int x = 0; x < Constants.MapSizeX; x++) { for (int y = 0; y < Constants.MapSizeY; y++) { mapPosition.x = x; mapPosition.y = y; var absolutePosition = WorldMapStorage.ToAbsolute(mapPosition); WorldMapStorage.UpdateMiniMap(mapPosition); uint color = WorldMapStorage.GetMiniMapColour(mapPosition); int cost = WorldMapStorage.GetMiniMapCost(mapPosition); MiniMapStorage.UpdateField(absolutePosition, color, cost, false); } } WorldMapStorage.CacheRefresh = true; }
private void ParseFullMap(Internal.CommunicationStream message) { UnityEngine.Vector3Int position = message.ReadPosition(); Player.StopAutowalk(true); CreatureStorage.MarkAllOpponentsVisible(false); MiniMapStorage.Position = position; WorldMapStorage.ResetMap(); WorldMapStorage.InvalidateOnscreenMessages(); WorldMapStorage.Position = position; ProtocolGameExtentions.ReadArea(message, 0, 0, Constants.MapSizeX - 1, Constants.MapSizeY - 1); WorldMapStorage.Valid = true; WorldMapStorage.CacheRefresh = true; }
// Psudo command void flipFillMark(Int3Type botPos, Int3Type fillPos) { bool ground = willGround(fillPos); if (ground) { flipIfPossible(); } else if (!high) { flip(); } markFill(fillPos); fill(fillPos - botPos); }
static int RoundToInt(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 1); UnityEngine.Vector3Int o = UnityEngine.Vector3Int.RoundToInt(arg0); ToLua.PushValue(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int RefreshTile(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Tilemaps.Tilemap obj = (UnityEngine.Tilemaps.Tilemap)ToLua.CheckObject(L, 1, typeof(UnityEngine.Tilemaps.Tilemap)); UnityEngine.Vector3Int arg0 = StackTraits <UnityEngine.Vector3Int> .Check(L, 2); obj.RefreshTile(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetHashCode(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.Vector3Int obj = (UnityEngine.Vector3Int)ToLua.CheckObject(L, 1, typeof(UnityEngine.Vector3Int)); int o = obj.GetHashCode(); LuaDLL.lua_pushinteger(L, o); ToLua.SetBack(L, 1, obj); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int op_UnaryNegation(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Vector3Int arg0 = StackTraits <UnityEngine.Vector3Int> .Check(L, 1); UnityEngine.Vector3Int o = -arg0; ToLua.PushValue(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int LookAt(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); FirClient.View.RoleView obj = (FirClient.View.RoleView)ToLua.CheckObject <FirClient.View.RoleView>(L, 1); UnityEngine.Vector3Int arg0 = StackTraits <UnityEngine.Vector3Int> .Check(L, 2); obj.LookAt(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int WorldToCell(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.GridLayout obj = (UnityEngine.GridLayout)ToLua.CheckObject <UnityEngine.GridLayout>(L, 1); UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); UnityEngine.Vector3Int o = obj.WorldToCell(arg0); ToLua.PushValue(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public override bool GetTileAnimationData(Vec3I gridPos, TM.ITilemap tilemap, ref TM.TileAnimationData tileAnimationData) { Vec2I pos = GridToTile(gridPos); Terrain terrain = GetTile(pos).terrain; if (!terrain.animated) { return(false); } tileAnimationData.animatedSprites = terrain.GetAnimationSprites(map, pos, GridToSubTile(gridPos)); tileAnimationData.animationSpeed = 2; tileAnimationData.animationStartTime = 0; return(true); }
static int Scale(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Vector3Int obj = (UnityEngine.Vector3Int)ToLua.CheckObject(L, 1, typeof(UnityEngine.Vector3Int)); UnityEngine.Vector3Int arg0 = StackTraits <UnityEngine.Vector3Int> .Check(L, 2); obj.Scale(arg0); ToLua.SetBack(L, 1, obj); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int op_Division(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Vector3Int arg0 = StackTraits <UnityEngine.Vector3Int> .Check(L, 1); int arg1 = (int)LuaDLL.luaL_checknumber(L, 2); UnityEngine.Vector3Int o = arg0 / arg1; ToLua.PushValue(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_sqrMagnitude(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.Vector3Int obj = (UnityEngine.Vector3Int)o; int ret = obj.sqrMagnitude; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index sqrMagnitude on a nil value")); } }
static int _get_this(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Vector3Int obj = (UnityEngine.Vector3Int)ToLua.CheckObject(L, 1, typeof(UnityEngine.Vector3Int)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int o = obj[arg0]; LuaDLL.lua_pushinteger(L, o); ToLua.SetBack(L, 1, obj); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int CellToLocal(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.GridLayout obj = (UnityEngine.GridLayout)ToLua.CheckObject <UnityEngine.GridLayout>(L, 1); UnityEngine.Vector3Int arg0 = StackTraits <UnityEngine.Vector3Int> .Check(L, 2); UnityEngine.Vector3 o = obj.CellToLocal(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetCellCenterWorld(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.Grid obj = (UnityEngine.Grid)ToLua.CheckObject(L, 1, typeof(UnityEngine.Grid)); UnityEngine.Vector3Int arg0 = StackTraits <UnityEngine.Vector3Int> .Check(L, 2); UnityEngine.Vector3 o = obj.GetCellCenterWorld(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }