This file contains 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; | |
using System.Collections.Generic; | |
using System.IO; | |
using System; | |
public static class UnityShortcuts | |
{ |
This file contains 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
if (!isWallInFront (moveDirection)) { | |
this.rigidbody.MovePosition (this.rigidbody.position + this.transform.right * xAxis * xFacing); | |
} | |
private bool isWallInFront (Vector3 direction) | |
{ | |
if (UnityShortcuts.castRay (this.rigidbody.position, this.transform.right, rayCastLength, moveAlignLayer)) { | |
//Debug.Log ("got wall hit!"); |
This file contains 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
// copy & past from see: https://www.youtube.com/watch?v=VH0ZfEv_ouc | |
using UnityEngine; | |
using System.Collections; | |
public class Player : MonoBehaviour | |
{ | |
//attach 2 weapon prefabs to weapon1 and weapon2 | |
//attach a bone Transform (head, foot, hand etc..) from your |
This file contains 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
public IEnumerator ImpactVibration (float enemyDirection) | |
{ | |
float vibTime = 0.5f; | |
float impVibStart = 0.1f; | |
float impVibStrength = 0.35f; | |
doVibrate = true; | |
StartCoroutine (DoVibrate ()); | |
if (enemyDirection > 0) { | |
StartCoroutine (setVibrate (0, vibTime, impVibStart, impVibStrength, "setLeftVibrate")); |
This file contains 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
private AudioSource playlistSource; | |
playlistCont = PlayListController.Instance; | |
playlistSource = playlistCont.CurrentPlaylistSource; | |
if (usePitchAddtion) { | |
checkAddPitch (); | |
} else { | |
checkPitchChange (); |
This file contains 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 EnemyAnimationControl : MonoBehaviour | |
{ | |
private Animator animControl; | |
private GameObject attackCollider; | |
private GameObject checkCollider; |
This file contains 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; | |
// script according to the talk at unit2013 : https://www.youtube.com/watch?v=Ozc_hXzp_KU | |
public class ValidateMe05 : MonoBehaviour | |
{ | |
private const float minFloatValue = 0.1f; | |
private const float maxFloatValue = 15f; |
This file contains 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
/// <summary> | |
/// Gets a sprite from any path | |
/// </summary> | |
/// <returns>The sprite from WW.</returns> | |
/// <param name="fullPath">Full path.</param> | |
public static Sprite getSpriteFromWWW (string fullPath, bool packTight = false) | |
{ | |
fullPath = "file:///" + fullPath; | |
WWW wwwLoader = new WWW (fullPath); | |
//Debug.Log ("loading texture " + fullPath + " via www, loaded: " + www); |
This file contains 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
private Color getAverageRGB (Texture2D tex) | |
{ | |
Color[] allPixels = tex.GetPixels (0, 0, tex.width, tex.height); | |
float r = 0; | |
float g = 0; | |
float b = 0; | |
int interationSteps = 1; | |
for (int i = 0; i < allPixels.Length; i += interationSteps) { |
This file contains 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
Vector3 clickPos = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 0); | |
Ray camRay = Camera.main.ScreenPointToRay (clickPos); | |
RaycastHit hit; | |
if (Physics.Raycast (camRay.origin, camRay.direction, | |
out hit, rayLength, fieldMask)) { | |
// do awesome stuff here | |
} |
OlderNewer