Saturday, 28 February 2015

Unity3D Tutorial: 21 Blinking Materijal

Unity3D Blinking Materijal











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



DIRECT DOWNLOAD HERE


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

THIS IS BACKUP  IN TEXT FORM  TUTORIAL 21
1. Create New java and name it : BlinkingMaterijal

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


//Blinking Material Object//
   
var difMaterial : Material;
var lightMaterial : Material;
var timer : float;
var WaitTime : float = 0.5;
var ResetPoint : float;
   
function Start () {
     
    ResetPoint = WaitTime * 2;
     
    }
       
function Update () {
     
    timer += Time.deltaTime;
     
    if(timer < WaitTime)
    {
    renderer.material = difMaterial;
    }
     
    if(timer > WaitTime)
    {
    renderer.material = lightMaterial;
    }
     
    if(timer > ResetPoint)
    {
    timer = 0;
    }
     
    }




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












0 comments:

Post a Comment