Skip to content

Instantly share code, notes, and snippets.

arun02139

Block or report user

Report or block arun02139

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arun02139
arun02139 / OffsetCoordinate.cs
Last active Mar 15, 2017
This struct is losing it's values; it should be serialized (private member marked [Serializable] in MyHexagon.cs)
View OffsetCoordinate.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// NOTE: this struct is assumed to be column ordered, i.e. compatable with even-q and odd-q offset coordinate layouts
public struct OffsetCoordinate
{
public int col { get { return _col; } }
public int row { get { return _row; } }
int _col;
@arun02139
arun02139 / MyHexagonInspector.cs
Created Mar 15, 2017
Custom inspector to look at the coordinate values (that should be getting serialized but aren't)
View MyHexagonInspector.cs
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(MyHexagon))]
public class MyHexagonInspector : Editor
{
public override void OnInspectorGUI()
{
var myHex = (MyHexagon)target;
@arun02139
arun02139 / MyHexagon.cs
Created Mar 15, 2017
Script attached to my hexagonal cell prefab, inherits from Hexagon
View MyHexagon.cs
using UnityEngine;
public class MyHexagon : Hexagon
{
public void Start()
{
SetColor(Color.white);
SetOutlineColor(Color.black);
}
@arun02139
arun02139 / Hexagon.cs
Created Mar 15, 2017
Abstract class (inheriting from Cell) for all types of hexagonal cells
View Hexagon.cs
using System.Collections.Generic;
using UnityEngine;
using System;
// for now, let's simplify our possible representations to match the core examples
// in the link below; full set of layout options is: odd_r, even_r, odd_q, even_q
public enum HexGridType { odd_q }
// implementation of hexagonal cell
// helpful link: http://www.redblobgames.com/grids/hexagons/
@arun02139
arun02139 / Cell.cs
Created Mar 15, 2017
Abstract base class for a generic 'cell'
View Cell.cs
using UnityEngine;
using UnityEngine.Networking;
using System;
using System.Collections.Generic;
public abstract class Cell : NetworkBehaviour, IGraphNode, ITouchable
{
public OffsetCoordinate offsetCoord
{
get { return _offsetCoord; }
@arun02139
arun02139 / HexCellUI.cs
Created Mar 15, 2017
Single ui to display various cell coordinate systems
View HexCellUI.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Assertions;
public enum CoordinateType { Off, Cube, Offset, Index } // NOTE: offset coordinates are type 'even-q'
public class HexCellUI : MonoBehaviour
{
@arun02139
arun02139 / CellUIsMenu.cs
Created Mar 15, 2017
Menu options to add, remove, and alter cell ui settings
View CellUIsMenu.cs
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Assertions;
public class CellUIsMenu : MonoBehaviour
{
[MenuItem ("Window/CellUIs/Add")]
static void Add()
{
@arun02139
arun02139 / BattleInspector.cs
Created Mar 9, 2017
Custom inspector trying to expose 'state' of battle at any time
View BattleInspector.cs
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(Battle))]
public class BattleInspector : Editor
{
public override void OnInspectorGUI()
{
var battle = (Battle)target;
View LocalHostBootstrap.cs
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.Assertions;
using System.Collections;
public class LocalHostBootstrap : MonoBehaviour
{
string _debugString;
View EditorStartup.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using UnityEngine.Assertions;
using UnityEditor;
[InitializeOnLoad]
class EditorStartup
{
You can’t perform that action at this time.