Skip to content

Instantly share code, notes, and snippets.

View hang10z's full-sized avatar

Kevin Taylor hang10z

View GitHub Profile
@hang10z
hang10z / powerup.cs
Created July 13, 2015 23:34
This script is attached to a powerup object in a game, it will reduce the count of the total powerup objects in the game, play an audio clip and destroy the object from the game. It is used with another script called GameController.
using UnityEngine;
using System.Collections;
public class PowerUp : MonoBehaviour
{
void OnTriggerEnter(Collider Other)
{
if (Other.CompareTag ("Player"))
{
@hang10z
hang10z / GameController.cs
Created July 13, 2015 23:34
Performs the simple function of finding total amount of power up objects in a game (see powerup script) and displaying a win notification to console when they are all gone. This script is attached to an empty game object in the scene (Unity 3d)
using UnityEngine;
using System.Collections;
public class GameController : MonoBehaviour
{
public int NumPowerUpObjects = 0;
// Use this for initialization
void Start ()
{
using UnityEngine;
using System.Collections;
public class ObjectClicker : MonoBehaviour
{
public GameObject[] ObjectList;
void OnMouseDown()
{
gameObject.SetActive(false);
using UnityEngine;
using System.Collections;
public class Mover : MonoBehaviour
{
private Transform ThisTransform = null;
//Speed (meters per second)
public float Speed = 10;
using UnityEngine;
using System.Collections;
public class Mover : MonoBehaviour
{
private Transform ThisTransform = null;
public float Speed = 0.2f;
// Use this for initialization
using UnityEngine;
using System.Collections;
public class Pin : MonoBehaviour {
//public float standingThreshold = 5f;
// Use this for initialization
void Start () {
}
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(Ball))]
public class DragLaunch : MonoBehaviour {
private Vector3 dragStart;
private Vector3 dragEnd;
private float startTime;
private float endTime;
private Ball ball;
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class PinSetter : MonoBehaviour {
public Text pinCountDisplay;
bool ballEnteredBox = false;
// Use this for initialization
void Start () {
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class PinSetter : MonoBehaviour {
public Text pinCountDisplay;
bool ballEnteredBox = false;
// Use this for initialization
void Start () {
@hang10z
hang10z / Pin.cs
Last active August 29, 2015 14:24
using UnityEngine;
using System.Collections;
public class Pin : MonoBehaviour {
public float standingThreshold = 12f;
// Use this for initialization
void Start () {
}