Skip to content

Instantly share code, notes, and snippets.

View Kurukshetran's full-sized avatar

Kurukshetran Kurukshetran

View GitHub Profile
///
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude (quill18@quill18.com)
/// Latest Version: https://gist.github.com/quill18/5a7cfffae68892621267
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// 2015-04-16: Changed Pool to use a Stack generic.
///
/// Usage:
///
using UnityEngine;
public class FastForwardButton : MonoBehaviour
{
void Update()
{
if(Application.isEditor && Input.GetKeyDown(KeyCode.F))
{
if(Time.timeScale == 1)
Time.timeScale = 7;
using UnityEngine;
using System.Collections;
public class PingPongTransformAnimation : MonoBehaviour
{
public enum Easing { None, Hermite, Sinerp, Coserp, Berp, SmoothStep,
CircleLerp };
public Easing easing = Easing.None;
public Vector3 positionChangePerSecond;
using UnityEngine;
using System.Collections;
public class PrefabGenerator : MonoBehaviour
{
public GameObject prefab;
public Transform position;
public string triggerTag;
void OnTriggerEnter(Collider other)
using UnityEngine;
using System.Collections;
public class AnimateTransform : MonoBehaviour
{
public float speed = 1;
public Vector3 positionChangePerSecond;
public Vector3 rotationChangePerSecond;
public Vector3 scaleChangePerSecond;
@Kurukshetran
Kurukshetran / PickUpObject.cs
Created November 4, 2015 02:54 — forked from jakevsrobots/PickUpObject.cs
Script for picking up objects in Unity.
using UnityEngine;
using System.Collections;
public class PickUpObject : MonoBehaviour {
public Transform player;
public float throwForce = 10;
bool hasPlayer = false;
bool beingCarried = false;
void OnTriggerEnter(Collider other)
@Kurukshetran
Kurukshetran / FadePageTransformer.java
Created August 19, 2016 15:33 — forked from sababado/FadePageTransformer.java
An Android PageTransformer. Use it on a ViewPager (3.0+) to see the pages fade in and out on top of each other.
/*
* Copyright (C) 2014 Robert Szabo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Kurukshetran
Kurukshetran / MainActivity.java
Created August 19, 2016 15:34
PageTransformer
public class MainActivity extends FragmentActivity {
/**
* The {@link android.support.v4.view.PagerAdapter} that will provide fragments for each of the sections. We use a
* {@link android.support.v4.app.FragmentPagerAdapter} derivative, which will keep every loaded fragment in memory.
* If this becomes too memory intensive, it may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
SectionsPagerAdapter mSectionsPagerAdapter;
@Kurukshetran
Kurukshetran / round-robin.java
Created August 24, 2016 10:22 — forked from Makistos/round-robin.java
This is a round-robin algorithm implemented in Java. #round-robin #scheduling #algorithm #java
import java.util.*;
public class Scheduler {
/** The schedule list. */
private Matches matches = new Matches();
public Scheduler(Teams participants) {
createSchedule(participants);
}
@Kurukshetran
Kurukshetran / ImageDownloader
Created August 25, 2016 09:36 — forked from maxivak/ImageDownloader
Android ImageDownloader
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software