Unity3D Enemy Alert System

Advertisemen

Unity3D Enemy Alert System










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

DIRECT DOWNLOAD HERE




THIS IS BACKUP  IN TEXT FORM  TUTORIAL 23/24 Script 1

1. Create New java and name it : Color


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


#pragma strict

// Fade the color from red to green
// back and forth over the defined duration

var colorStart : Color = Color.red;
var colorEnd : Color = Color.green;
var duration : float = 1.0;
var rend: Renderer;


function Start() {
rend = GetComponent.<Renderer>();
}


function Update () {
var lerp: float = Mathf.PingPong(Time.time, duration) / duration;
rend.material.color = Color.Lerp(colorStart, colorEnd, lerp);
}







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









THIS IS BACKUP  IN TEXT FORM  TUTORIAL 23/24 Script 2

1. Create New java and name it : EnableDisableObjectMesh


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


#pragma strict

function Start()
 {
   renderer.enabled = false;
 }

 function OnTriggerStay(Trigger : Collider)
 {
    if (Trigger.collider.tag == "enemy")
    {
         renderer.enabled = true;
         Debug.Log("OK");
           }
 }
         function OnTriggerExit ( other : Collider )
 {
     if ( other.gameObject.tag == "enemy" )
     {
         renderer.enabled = false;
     }
 }







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





















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