Sunday, 30 September 2018

Unity 3D Steering Wheel Car control





car steering wheel controller in unity

Saturday, 21 July 2018

Unity Count Down Timer with circular progressbar

Watch Video Tutorial On My Channel

Assets:



White Dotted image is here

Script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Loading : MonoBehaviour {

public Image loading;
public Text timeText;
public int minutes;
public int sec;
int totalSeconds = 0;
int TOTAL_SECONDS = 0;
float fillamount;

void Start ()
{
timeText.text = minutes + " : " + sec;
if (minutes > 0)
totalSeconds += minutes * 60;
if (sec > 0)
totalSeconds += sec;
TOTAL_SECONDS = totalSeconds;
StartCoroutine (second ());
}

void Update ()
{
if (sec == 0 && minutes == 0) {
timeText.text = "Time's Up!";
StopCoroutine (second ());
}
}
IEnumerator second()
{
yield return new WaitForSeconds (1f);
if(sec > 0)
sec--;
if (sec == 0 && minutes != 0) {
sec = 60;
minutes--;
timeText.text = minutes + " : " + sec;
fillLoading ();
StartCoroutine (second ());
}

void fillLoading()
{
totalSeconds--;
float fill = (float)totalSeconds/TOTAL_SECONDS;
loading.fillAmount = fill;
}
}

Sunday, 15 July 2018

How to Make a Wheel of Fortune in Unity 2018 [ free code + assets ]

Watch Video Tutorial On Youtube

Spinner Script


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class spinner : MonoBehaviour {

public float reducer;
public float multiplier = 1;
bool round1 = false;
public bool isStoped = false;


void Start ()
{
reducer = Random.Range (0.01f, 0.5f);
}
// Update is called once per frameQ
void FixedUpdate () {

if (Input.GetKey (KeyCode.Space)) 
{
Reset ();
}

if (multiplier > 0)
{
transform.Rotate (Vector3.forward, 1 * multiplier);
} else
{
isStoped = true;
}

if (multiplier < 20 && !round1) 
{
multiplier += 0.1f;
} else 
{
round1 = true;
}

if (round1 && multiplier > 0)
{
multiplier -= reducer;
}


void Reset()
{
multiplier = 1;
reducer = Random.Range (0.01f, 0.5f);
round1 = false;
isStoped = false;
}
}

Needle Script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class needle : MonoBehaviour {
public spinner _spinner;
public Text scoretext;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}

void OnTriggerStay2D(Collider2D col){
if (!_spinner.isStoped)
return;
scoretext.text = col.gameObject.name;

}

}

Saturday, 7 July 2018

Unity 3d Play sound on trigger and particle effect [HINDI/URDU]



unity 3d play sound on Trigger c# and particle system tutorial.

in this video  i will show you how to play win sound when player reaches a finish point or stage is cleared in hindi urdu.