- Home /
Question by
aminraven67 · Jan 22, 2019 at 07:41 PM ·
unity5arduinoserialportlockon
unity to serial ports ( blink LED )
hi, i have a video game, that when i start locking on target it makes LED to Blink and when locks on it make LED to be on continuously , this LED could attached the PC with Serial ports , or Arduino or anything u can offer , this is the lock on codes
else
{
lockTarget = Time.time+100;
canShoot = false;
lockOn = false; //set the bool back to false
launcherScript.enabled = false;//we disable the script if it was set to enabled so that we can't shoot
//lockSound.enabled=false;
//trackingSound.enabled = false;
//GetComponent<AudioSource> ().clip = trackingSound;
GetComponent<AudioSource> ().Stop ();
anim.SetBool ("track", false);
anim.SetBool("redLock", false);
Core.Instance.setLightghoflOn (false);
}
if (lockOn && Time.time >= lockTarget) //if we've locked on to our target for the specified time in "lockTarget" then we can shoot
{
canShoot = true;
launcherScript.enabled = true; //enables the script that will be used to launch our missile
Debug.Log ("Hooray you're locked on");
GetComponent<AudioSource> ().clip = lockSound;
GetComponent<AudioSource> ().loop = true;
if (GetComponent<AudioSource> ().isPlaying == false)
GetComponent<AudioSource> ().Play ();
anim.SetBool ("redLock", true);
anim.SetBool ("track", false);
Core.Instance.setLightghoflOn (true);
}
Comment