private void CreateNewObject(Vector3 position)
        {
            // Get Floor height before generating a new Tile object
            position.y = GridUtility.FloorHeight(position);

            if (GridBase.Instance.alignY)
            {
                position.y = GridUtility.CheckVerticalAlignment(position.y);
            }
            AddTile(position);
        }
        private void MoveBrush()
        {
            RaycastHit hitInfo = RaycastGUIToFloor(Event.current.mousePosition);

            if (hitInfo.collider != null)
            {
                Vector3 position = GridUtility.GetAlignedPosition(hitInfo.point);
                position.y = GridUtility.FloorHeight(position);
                brush.transform.position = position + offset + BRUSH_OFFSET;

                float scale = gridBase.tileSize * brushScales[brushIndex.intValue];
                brush.transform.localScale = new Vector3(scale, scale, scale);
            }
        }
Exemple #3
0
        private void CreateTile(Vector3 position)
        {
            // Get Floor height before generating a new Tile object
            position.y = GridUtility.FloorHeight(position);

            if (GridBase.Instance.alignY)
            {
                position.y = GridUtility.CheckVerticalAlignment(position.y);
            }

            if (!gridBase.ContainsTileAt(position))
            {
                TilePositionsProperty.arraySize++;
                TilePositionsProperty.serializedObject.ApplyModifiedProperties();
                TilePositionsProperty.GetArrayElementAtIndex(gridBase.storage.tilePositions.Count - 1).vector3Value = position;
                TilePositionsProperty.serializedObject.ApplyModifiedProperties();
                meshPainter.DrawTile(position);
            }
        }