Skip to content

Instantly share code, notes, and snippets.

@Domiii
Domiii / UnityEditorTests.cs
Created March 25, 2017 20:51
UnityEditorTests
using UnityEngine;
using System.Linq;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
[InitializeOnLoad]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Voxelizer : MonoBehaviour {
public int xSlices = 5;
public int ySlices = 5;
public int zSlices = 5;
public GameObject Cube;
/**
* Spawns a wall along the X and Y axes of the WallSpawner, using cubes of given size and materials
*/
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
/**
* Spawns a stack of bricks
*/
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
@Domiii
Domiii / AddCustomEditorMenuItem.cs
Last active May 10, 2022 07:27
Adds a new "Add custom Editor" MenuItem to Script files in the Unity Project view. Explanation: https://stackoverflow.com/questions/50203145/shortcut-to-automatically-add-custom-editor-for-script-in-unity
/// Licensed under the Apache License, Version 2.0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Text.RegularExpressions;
package mouseclicks;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
public class RobotMouseTest {
static Robot bot;
public static void main(String[] args) throws Exception {
Thread.sleep(50);
@Domiii
Domiii / RepeatingBackground.cs
Created May 26, 2018 11:02
Simple horizontal repeating background in Unity (C#)
using UnityEngine;
using System.Collections;
/// <summary>
/// For this to work, you need a background sprite that is
/// 1) cyclical: it's left side connects seam-less with it's right side
/// 2) it must at least span the width of the camera view
/// 3) it must be repeated twice (so you actually have the same thing three times, implying at least three times the camera view width)
///
/// TODO: To make things simpler, you can just mirror a single sprite/texture and repeat it three times
@Domiii
Domiii / RealWorldTerrainRoblox.lua
Last active November 19, 2021 00:10
Import real world terrain into Roblox
--[[
Steps:
1. Download heightmap Bitmap
e.g. from terrain.party: http://terrain.party/api/export?name=guarda&box=10.186055,46.850130,10.080975,46.778264)
e.g. from earthe
Data Sets: NASA LPDAAC Collections -> NASA SRTM (SRTM 3) Collections
2. Use this site to convert BMP to Lua: https://codepen.io/Domiii/pen/oMJvoJ?editors=0010
3. Copy the final Lua code to workspace.TerrainPixels (ModuleScript)
4. Run this script!
--[[
Steps:
1. Use an editor to create a pixel map (e.g. https://www.piskelapp.com/)
1b. If your editor cannot export BMP files, use an online converter to generate a BMP file (e.g. https://image.online-convert.com/convert-to-bmp)
2. Convert BMP to Lua here: https://codepen.io/Domiii/pen/oMJvoJ?editors=0010
3. Copy the final Lua code to workspace.LevelPixels (ModuleScript)
4. Fix configuration below: make sure that colors map to blocks that have been prepared
5. Run this script!
@Domiii
Domiii / 網站開發.md
Last active August 14, 2019 07:42
網站開發 - 紀錄(中文版)

開始學習網站開發的技術

  • JavaScript 的基礎
  • HTML + CSS 的基礎

在本機端專門開發網站的工具

  1. 前提:用終端機來控制電腦~ (英文關鍵字:terminal, command prompt)
  2. 如何在 Windows 上面打開 terminal?