Skip to content

Instantly share code, notes, and snippets.

View gegagome's full-sized avatar

German Garces gegagome

  • Santa Barbara, CA
View GitHub Profile
using UnityEngine.EventSystems;
using UnityEngine;
public class Stem : MonoBehaviour, IPointerDownHandler, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerClickHandler
{
Vector3 _pos;
Vector3 _posOffset;
RectTransform _thisRectTransform;
RectTransform _parentRectTransform;
Rigidbody2D _rb;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DragRigidbody : MonoBehaviour {
Vector3 screenPoint;
Vector3 offset;
void Update () {
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using DG.Tweening;
using UnityEngine.EventSystems;
public class SettingsPanel : MonoBehaviour {
RectTransform _aRect;
bool _isHidden = true;
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
// set these so purchase is fulfilled or fails
// OnPurchaseComplete > FullAppUnlock ()
// OnPurchaseFailed > ParentalGate.FailPurchase();
@gegagome
gegagome / SpritesController.cs
Last active April 29, 2018 04:15
How to handle multiple animations/animators
using System.Collections.Generic;
using UnityEngine;
public class SpritesController : MonoBehaviour {
public SpriteRenderer[] _sprites;
List<Animator> _anims = new List<Animator>();
AnimatorStateInfo _stateInfo;
int _animAudioTrack1HashActive;
void Checker (int i)
{
if (_silenceSprites[i].enabled != true)
{
_silenceSprites[i].enabled = true;
}
else
{
_silenceSprites[i].enabled = false;
}
static int[] usernameDisparity(string[] inputs)
{
// store results
int[] result = new int[inputs.Length];
// store results for array
List<int> resultInt = new List<int>();
for (int i = 0; i < inputs.Length; i++)
{
@gegagome
gegagome / Events.cs
Last active March 5, 2019 20:03
Unity - Adding events in C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class Events : MonoBehaviour/*, IPointerUpHandler, IPointerEnterHandler, IPointerClickHandler*/
{
void Start()
{
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using System.Text;
using System.Collections.Generic;
public class FindDuplicates : MonoBehaviour
{
List<string> results = new List<string>();
@gegagome
gegagome / sort.js
Last active October 2, 2019 16:14
Sort in javascript
[[2, 37], [1, 40], [3, 39], [0, 36]].sort(([,a],[,b]) => {
count;
console.log(count + " a: " + a + ", b: " + b);
count++;
return a-b})
/*
0 a: 40, b: 37
1 a: 39, b: 40