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
//List.ToArray(). | |
// Converting Builtin Array to Generic List | |
// https://answers.unity.com/questions/630494/converting-builtin-array-to-generic-list-1.html | |
using UnityEngine; | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
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 class clampAngle : MonoBehaviour | |
{ | |
static float ClampAngle(float angle, float min, float max) | |
{ | |
if (min < 0 && max > 0 && (angle > max || angle < min)) | |
{ | |
angle -= 360; | |
if (angle > max || angle < min) | |
{ | |
if (Mathf.Abs(Mathf.DeltaAngle(angle, min)) < Mathf.Abs(Mathf.DeltaAngle(angle, max))) return min; |
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 SmoothCamera2D : MonoBehaviour { | |
public float dampTime = 0.15f; | |
private Vector3 velocity = Vector3.zero; | |
public Transform target; | |
// Update is called once per frame |
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine.UI; | |
using UnityEngine; | |
public class Drag : MonoBehaviour { | |
public bool isPlayer = false; | |
Vector3 diff, targetDir; | |
Transform[] trans = new Transform[5]; |
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 AndroidGoogleAdsExample : MonoBehaviour { | |
public static AndroidGoogleAdsExample instance; | |
void Awake() | |
{ | |
if(instance == null) { |
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public static class AudioFade { | |
public static bool isPlaying = false; | |
public static IEnumerator FadeOut (AudioSource audioSource_1, float FadeTime) { | |
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class CharacterJump : MonoBehaviour { | |
public CharacterController controller; | |
public float vertical_Velocity; | |
public float gravity = 14; |
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
// Array 'a' contains 100 list | |
List<int>[] a = new List<int>[100]; | |
// You still would have to allocate each individual list in the array before you can use it though: | |
// Initialize each list in the array 'a' | |
for (int i = 0; i < a.Length; i++) { | |
a[i] = new List<int>(); | |
} |
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class DataManager : MonoBehaviour { | |
public float player_Run; | |
public int volume; | |
public float best = 0; |
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
http://math.stackexchange.com/questions/51509/how-to-calculate-percentage-of-value-inside-arbitrary-range | |
[min, max] = [174, 224] | |
curent value n = 230 | |
target range [min_target, max_target] | |
value to be find x = ? | |
percentage p = (n - min/max - min) * 100; |
NewerOlder