Skip to content

cpp-bender/SimpleGrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Grid

Table Of Contents

Details

Introduction

Simple, Scriptable Object based grid creator for puzzle games

What A Grid Looks Like

I am gonna explain how to create a grid in later parts. But, if you want to have an earlier look, go ahead "Window/SimpleGrid/Create Grid" to see what a grid looks like.

Grid Types

  • SimpleGrid consists of two grid types: Quadral and Hexagonal
  • Each type has its own settings

Common Settings

  • Initial Pos: World Pos where the grid is gonna start to shape into
  • Grid Prefab: The object that each grid will represent
  • Width: The width of the grid
  • Height: The height of the grid
  • Width Offset: The width offset of the grid
  • Height Offset: The height offset of the grid

Quadral Settings

1 - Quadral Settings

quadral grid

Hexagonal Settings

1 - Hexagonal Settings

  • Hexagonal Offset: The hexagonal offset between grid objects

hexagonal grid

How to create a grid

create-a-grid.mp4

Getting Data

  • SimpleGrid creates individual objects in the given order and stores them inside a list of cells. Cell is basically a Serializable C# class.
  • You can access SimpleGrid's data like below.
using UnityEngine;

public class LevelManager : MonoBehaviour
{
    public BaseGridSettings gridSettings;

    private void Start()
    {
        gridSettings.Create();
        Debug.Log("First Cell is at: " + gridSettings.Cells[0].worldPos);
    }
}