1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using KairoEngine.Grids;
- using KairoEngine.Utility;
- public class GridTest : MonoBehaviour
- {
- public bool debugGrid = false;
- public Vector2Int gridSize;
- public float cellSize = 10f;
- public GridPlane gridPlane = GridPlane.XY;
- public Vector3 gridPosition = new Vector3();
- private Grid<HeatMapGridObject> grid;
- [SerializeField] private HeatMapVisual heatMapVisual;
- void Start()
- {
- grid = new Grid<HeatMapGridObject>(gridSize.x, gridSize.y, cellSize, gridPosition, (Grid<HeatMapGridObject> g, int x, int y) => new HeatMapGridObject(g, x, y),
- gridPlane, debugGrid);
- heatMapVisual.SetGrid(grid);
- }
- private void Update()
- {
- if(Input.GetMouseButtonDown(0))
- {
- Vector3 mousePos = Utilities.GetMouseWorldPosition();
- //int value = grid.GetValue(mousePos);
- //value += 10;
- //value = Mathf.Clamp(value, HeatMapVisual.HEAT_MAP_MIN_VALUE, HeatMapVisual.HEAT_MAP_MAX_VALUE);
- //grid.SetValue(Utilities.GetMouseWorldPosition(), value);
- heatMapVisual.AddValue(mousePos, 100, 0, 5);
- }
- if(Input.GetMouseButtonDown(1))
- {
- Debug.Log(grid.GetObject(Utilities.GetMouseWorldPosition()));
- }
- }
- }
|