Esempio n. 1
0
        public void ToggleVisibility(Vector3Int position, Tilemap tilemap, bool clear, List <Vector3Int> visited)
        {
            bool nextRevealed = Mathf.Approximately(tilemap.GetColor(position).a, reveal.a);

            if ((nextRevealed && clear) || (!nextRevealed && !clear))
            {
                return;
            }

            visited.Add(position);

            Color c = clear? Color.clear : cover;

            tilemap.SetColor(position, c);



            Vector3Int newPosition = Vector3Int.one;

            for (int x = -1; x <= 1; x++)
            {
                for (int y = -1; y <= 1; y++)
                {
                    newPosition.Set(position.x + x, position.y + y, position.z);

                    if (position.x == x && position.y == y || !tilemap.GetTile <SecretTile>(newPosition) || visited.Contains(newPosition))
                    {
                        continue;
                    }

                    nextRevealed = Mathf.Approximately(tilemap.GetColor(newPosition).a, reveal.a);
                    //Debug.Log("next revealed " + nextRevealed + "[" + next.tint.a + " , " + reveal.a + "] " + "; clear " + clear);
                    if ((nextRevealed && clear) || (!nextRevealed && !clear))
                    {
                        continue;
                    }

                    ToggleVisibility(newPosition, tilemap, clear, ref visited);
                    tilemap.RefreshTile(newPosition);
                }
            }

            tilemap.RefreshTile(position);
        }
Esempio n. 2
0
    static int GetColor(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);

            UnityEngine.Color o = obj.GetColor(arg0);
            ToLua.Push(L, o);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Esempio n. 3
0
 public virtual Color GetColor(Vector3Int position)
 {
     return(m_Tilemap.GetColor(position));
 }