Skip to content

Instantly share code, notes, and snippets.

@uruskan
Created January 20, 2017 21:46
Show Gist options
  • Save uruskan/44ef301812ae0d51497eaabc980003c8 to your computer and use it in GitHub Desktop.
Save uruskan/44ef301812ae0d51497eaabc980003c8 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Can : MonoBehaviour {
public int hp = 100;
public int simdikiCan;
public Slider hpslider;
// Use this for initialization
void Start () {
}
public void hasarAl(int saldırıGücü) {
simdikiCan = hp - saldırıGücü;
hp = simdikiCan;
hpslider.value = simdikiCan;
if (simdikiCan <= 0) {
Debug.Log("Öldüm Çıktım !");
Destroy(gameObject);
}
if (simdikiCan > 0) {
Debug.Log(simdikiCan +"Canım Kaldı.");
}
}
// Update is called once per frame
void Update () {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment