Unity3d Tutorial Slow Motion

Advertisemen

Unity3d Tutorial Slow Motion

Easter video series !










THIS IS Java# script: GOOD 4 2D GAMES AND 3D GAMES !
----------------------------------------­­­­­­­----------------------------------­-­-­-­-­-­-­------

DIRECT DOWNLOAD HERE




THIS IS BACKUP  IN TEXT FORM  TUTORIAL SlowMotion

1. Create New java and name it : SlowMotion


2. Copy & Past this text and save java :
----------------------------------------­­­­­------------------------------------­-­-­-­-­-


var slowMoIn : AudioClip;
var slowMoOut : AudioClip;   
   
function Update(){
if (Input.GetKeyDown (KeyCode.S)) {
if (Time.timeScale == 1.0){ 
Time.timeScale = 0.3;
}else{
Time.timeScale = 1.0;
Time.fixedDeltaTime = 0.02 * Time.timeScale;
}
var aSources = FindObjectsOfType(AudioSource);
for (aSource in aSources)
aSource.pitch = Time.timeScale;
if (Time.timeScale == 1.0) PlayAudioClip(slowMoOut, transform.position, 1.0);
else PlayAudioClip(slowMoIn, transform.position, 1.0);
    }
}

function PlayAudioClip (clip : AudioClip, position : Vector3, volume : float) {
    var go = new GameObject ("One shot audio");
    go.transform.position = position;
    var source : AudioSource = go.AddComponent (AudioSource);
    source.clip = clip;
    source.volume = volume;
source.pitch = 1.0;
    source.Play ();
    Destroy (go, clip.length);
    return source;
}







 ----------------------------------------­­­­­------------------------------------­-­-­-­-­-

Advertisemen

Disclaimer: Gambar, artikel ataupun video yang ada di web ini terkadang berasal dari berbagai sumber media lain. Hak Cipta sepenuhnya dipegang oleh sumber tersebut. Jika ada masalah terkait hal ini, Anda dapat menghubungi kami disini.

Tidak ada komentar:

Posting Komentar

© Copyright 2017 Tutorial Unity 3D