Skip to content

Instantly share code, notes, and snippets.

View gkagm2's full-sized avatar
๐Ÿ˜†
..

Sagacity Jang gkagm2

๐Ÿ˜†
..
View GitHub Profile
@gkagm2
gkagm2 / gist:ab185883d4497e6742669cf490dcdc86
Created April 16, 2020 15:23
Vertices๋“ค์˜ worldPosition ์ขŒํ‘œ ๊ตฌํ•˜๊ธฐ.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test_ModelAnimationPath : MonoBehaviour
{
public string positionName;
public MeshFilter meshFilts;
public List<Vector3> vecList;
@gkagm2
gkagm2 / aniamtor,
Created June 18, 2019 06:41
aniamtor์—์„œ animation์˜ length ์„ค์ •,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UnityChanController06 : MonoBehaviour {
// parameters
public int speed;
@gkagm2
gkagm2 / SimpleJSON ์‚ฌ์šฉ ์˜ˆ์ œ
Last active June 12, 2019 08:36
SimpleJSON์‚ฌ์šฉ์˜ˆ์ œ
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using SimpleJSON;
public class PlayerState : MonoBehaviour
{
public string name;
public int hp;
@gkagm2
gkagm2 / CSV Reader
Created June 12, 2019 02:00
csv ํŒŒ์ผ ๊ฒ€์ถœ
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
public class CSVReader
{
static string SPLIT_RE = @",(?=(?:[^""]*""[^""]*"")*(?![^""]*""))";
static string LINE_SPLIT_RE = @"\r\n|\n\r|\n|\r";
@gkagm2
gkagm2 / 2D ํ”Œ๋ ˆ์ด์–ด x์ถ• ์›€์ง์ž„ ์ œํ•œ ํ•จ์ˆ˜
Created May 30, 2019 17:50
2D ํ”Œ๋ ˆ์ด์–ด x์ถ• ์›€์ง์ž„ ์ œํ•œ ํ•จ์ˆ˜
// 2D ํ”Œ๋ ˆ์ด์–ด x์ถ• ์›€์ง์ž„ ์ œํ•œ
private void ScreenCheck(){
Vector3 worldPos = Camera.WorldToViewportPoint(this.transform.position);
if(worldPos.x < 0.05f) worldPos.x = 0.05f;
if(worldPos.x > 0.95f) worldPos.x = 0.95f;
this.transform.position = Camera.main.ViewportToWorldPoint(worldPos);
}
Shader "Custom/Tex" {
Properties {
///
/// "Albedo (RGB)" : Albedo ํ…์Šค์ณ๋ฅผ ๋„ฃ๋Š” ๊ณณ์ด๊ณ , ์•ŒํŒŒ๋Š” ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  RGB ์ฑ„๋„๋งŒ ์‚ฌ์šฉํ•˜๊ฒ ๋‹ค๋Š” ์˜๋ฏธ.
/// 2D : ์ด ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ 2D ํ…์Šค์ณ๋ฅผ ๋ฐ›๋Š” ๋ถ€๋ถ„์ด๋ผ๋Š” ์˜๋ฏธ.
/// "white"{} : ๋Š” ์ด ํ…์Šค์ณ๊ฐ€ ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ ์ฒ˜์Œ ์ƒ๊ฒจ์„œ ์•„๋ฌด๊ฒƒ๋„ ๋“ค์–ด ์žˆ์ง€ ์•Š์„ ๋•Œ. ํฐ์ƒ‰ ํ…์Šค์ณ๊ฐ€ ๋“ค์–ด์žˆ๋‹ค๊ณ  ์ƒ๊ฐ๋˜๋„๋ก ๋งŒ๋“ค๋ผ๋Š” ์˜๋ฏธ
_MainTex ("Albedo (RGB)", 2D) = "white" {} // ํ…์Šค์ณ๋ฅผ ์ž…๋ ฅ๋ฐ›๋Š” ๋ณ€์ˆ˜.
}
SubShader {
@gkagm2
gkagm2 / Shader
Created May 20, 2019 08:47
ShaderEx
Shader "Custom/NewSurfaceShader" {
Properties { // ์ธ์ŠคํŽ™ํ„ฐ ์ฐฝ์—์„œ ๋ณด์—ฌ์ฃผ๋Š”
_Brightness("Change Brightness!!", Range(0,1)) = 0.5
_TestFloat("Test Float!!", Float) = 0.5
_TestColor("Test Color!!", Color) = (1,1,1,1)
_TestVector("Test Vector", Vector) = (1,1,1,1)
_TestTexture("Test Texture",2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
@gkagm2
gkagm2 / touch screen1
Last active April 25, 2019 16:01
Touch Screen (mobile)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TouchScreenEx : MonoBehaviour {
//์†๊ฐ€๋ฝ์„ ํ™”๋ฉด์— ๋‹ฟ์€ ์ƒํƒœ์—์„œ ์›€์ง์ด๋ฉด ๋ฌผ์ฒด๊ฐ€ ์›€์ง์ธ๋‹ค
void Update () {
if(Input.touchCount > 0 ){
@gkagm2
gkagm2 / UISprite (change icon)
Created April 25, 2019 07:04
UISprite (NGUI)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpriteManager : MonoBehaviour {
public UISprite icon;
// Use this for initialization
void Start () {
@gkagm2
gkagm2 / NGUI Button (GameObject)
Last active April 23, 2019 01:05
NGUI Button์„ ์ด์šฉํ•œ Label control
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ๋ฐฉ๋ฒ• 1
public class ButtonManager : MonoBehaviour {
public bool flag = true;
public GameObject label; //GameObject๋ฅผ ์ด์šฉํ•œ๋‹ค
public void StartBtn()