This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This work is licensed under a Creative Commons Attribution 3.0 Unported License. | |
// http://creativecommons.org/licenses/by/3.0/deed.en_GB | |
// | |
// You are free: | |
// | |
// to copy, distribute, display, and perform the work | |
// to make derivative works | |
// to make commercial use of the work | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Setup: | |
* Create an empty GameObject and add the EventManager script to it. | |
* Create custom event classes that extend the CustomEvent. | |
* | |
* Restrictions & Tips: | |
* DO NOT add event listeners in the Awake() method! | |
* This is used by the EventManager to initialize. | |
* Change this class' Execution Order to before default time if you need to work around this. | |
* Use the Start() method to setup your events. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Written by Cassius Adams for the Super Space Trooper video game. http://www.SuperSpaceTrooper.com */ | |
// Find the distance between weapon and Player so we can anticipate where Player will be | |
distance = Vector3.Distance(player.transform.position, transform.position); | |
// Divide distance by weaponSpeed to see how long it will take to get from Enemy to Player | |
var travelTime = distance / (Mathf.Abs(weaponSpeed) + playerSpeed); | |
// Multiply the amount of time by the speed the Player moves at | |
var futurePosition = travelTime * playerSpeed; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Playlist Object for the jPlayer Plugin | |
* http://www.jplayer.org | |
* | |
* Copyright (c) 2009 - 2013 Happyworm Ltd | |
* Dual licensed under the MIT and GPL licenses. | |
* - http://www.opensource.org/licenses/mit-license.php | |
* - http://www.gnu.org/copyleft/gpl.html | |
* | |
* Author: Mark J Panaghiston |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Converted from UnityScript to C# at http://www.M2H.nl/files/js_to_c.php - by Mike Hergaarden | |
// Do test the code! You usually need to change a few small bits. | |
using UnityEngine; | |
using System.Collections; | |
public class lightController : MonoBehaviour { | |
public bool flicker = false; | |
public float onTime = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class OnCollideExplode : MonoBehaviour | |
{ | |
// A grenade | |
// - instantiates a explosion prefab when hitting a surface | |
// - then destroys itself | |
public GameObject explosionPrefab; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class OnExplosionEffect : MonoBehaviour { | |
public float radius = 5; | |
public float power = 5; | |
public float upwardForce = 0; | |
private float radiusUsed = 0.5F; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arcAngle = 180.0; | |
var numLines = 181; | |
var maxDist = 8.0; | |
var scansPerSec = 3; | |
private var ranges : float[]; | |
private var timer = 0.0; | |
function LateUpdate(){ | |
DoScan2(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System; | |
var date = DateTime.Now; | |
var timeDisplay : GUIText; | |
function Start() { | |
InvokeRepeating("Increment", 1.0, 1.0); | |
} | |
function Update () { | |
var seconds : float = date.TimeOfDay.Ticks / 10000000; | |
transform.rotation = Quaternion.LookRotation(Vector3.up); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var updateFreq = 1.0; | |
private var heading = 0.0; | |
private var gpsRef : Transform; | |
private var gpsRefN : int; | |
private var sender : Sender; | |
private var timer = 0.0; | |
function Start(){ | |
Init(); | |
} |