Skip to content

Instantly share code, notes, and snippets.

@emiremen
Created August 25, 2023 19:52
Show Gist options
  • Save emiremen/7eef479644349934d014b5dcd3922f1f to your computer and use it in GitHub Desktop.
Save emiremen/7eef479644349934d014b5dcd3922f1f to your computer and use it in GitHub Desktop.
TechCareer.net ilk ödev.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DersScript : MonoBehaviour
{
int puan;
float mesafe;
string mesaj;
void Start()
{
YildizGoster(puan);
mesafe = transform.position.x;
MesafeYazdir(mesafe);
KarsilamaMesaji(3);
}
void Update()
{
}
void MesafeYazdir(float _mesafe)
{
switch (_mesafe)
{
case 1.5f:
Debug.Log("Yakın");
break;
case 2.5f:
Debug.Log("Orta");
break;
case 5f:
Debug.Log("Uzak");
break;
case 7.5f:
Debug.Log("Çok Uzak");
break;
default:
Debug.Log("O Kadar Uzak Ki Görünmüyor");
break;
}
}
void YildizGoster(int _puan)
{
if (_puan >= 0 && _puan < 30)
{
Debug.Log("★");
}
else if (_puan > 30 && _puan < 50)
{
Debug.Log("★★");
}
else if (_puan >= 50)
{
Debug.Log("★★★");
}
}
void KarsilamaMesaji(int mesajAdedi)
{
mesaj = "Merhaba Oyunumuza Hoşgeldiniz";
while (mesajAdedi > 0)
{
Debug.Log(mesaj);
mesajAdedi--;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment