Skip to content

Instantly share code, notes, and snippets.

View leventeren's full-sized avatar
🤘
I love to code and can do it all day long ;)

Levent EREN leventeren

🤘
I love to code and can do it all day long ;)
View GitHub Profile
@leventeren
leventeren / JoystickController.cs
Created July 9, 2020 22:10
Unity Joystick Controller Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class JoystickController : MonoBehaviour {
public RectTransform center;
public RectTransform knob;
public float range;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Arrays : MonoBehaviour {
public string[] familyMembers = new string[]{"Dharma","Greg","Zen","Karma","Serenity"};
public int[] numbers;
public static GameObject FindChild(Transform trans , string childName)
{
Transform child = trans.Find(childName);
if (child != null)
{
return child.gameObject;
}
int count = trans.childCount;
GameObject go = null;
for(int i = 0 ; i < count ; ++i)
public static string GetMinuteTime(float time)
{
int mm,ss;
string stime = "0:00";
if (time<=0) return stime;
mm = (int)time/60;
ss = (int)time%60;
if(mm>60)
stime = "59:59";
else if (mm <10 && ss >=10)
using System;
using System.Collections.Generic;
class ArrayHelper
{
static public void OrderBy<T, TKey>(T[] array, SelectHandler<T, TKey> handler)
where TKey : IComparable,IComparable<TKey>
{
for (int i = 0; i < array.Length - 1; i++)
{
using UnityEngine;
using System.Collections.Generic;
using System;
public static class CollectionHelper
{
public delegate bool FindHandler<T>(T item);
public delegate TKey SelectHandler<TSource, TKey>(TSource source);
public static void OrderBy<T, TKey>(T[] array, SelectHandler<T, TKey> handler)
using UnityEngine;
using System.Collections;
public class TransformHelper
{
public static Transform FindChild(Transform parent, string goName)
{
var child = parent.Find(goName);
if (child != null) return child;
using UnityEngine;
public class RayController : MonoBehaviour{
public bool debug;
RaycastHit hit;
public Transform from;
public Transform to;
public Ray Ray{
get
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
//For general object operations
public class PoolObjectInfo : MonoBehaviour
{
//Resource Type
public string Type { get { return _Type; } private set { _Type = value; } }
[SerializeField]
@leventeren
leventeren / ResizeArray.cs
Created September 8, 2021 19:11
Array Resize
public void GroupResize (int Size, ref GameObject[] Group)
{
GameObject[] temp = new GameObject[Size];
for (int c = 1; c < Mathf.Min(Size, Group.Length); c++ ) {
temp [c] = Group [c];
}
Group = temp;
}