Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class vidaEdificioScratch : MonoBehaviour {
- // a posiçao para onde ir
- public float goX ;
- public float goY ;
- public float goZ ;
- //Privado so pode mexer isto
- private float X;
- private float Y;
- private float Z;
- //vida do edificio
- public int getVida;
- private int setVida;
- //a ser atacado ou n
- public bool atacado;
- void Start () {
- getVida = setVida;
- setVida = 100;
- goX = X;
- goY = Y;
- goX = Z;
- X = transform.position.x;
- Y = transform.position.y;
- Z = transform.position.z;
- }
- void Alerta1(){
- if (atacado == true) {
- if (getVida != 0) {
- atacado = true;
- }else{
- if (getVida == 0) {
- atacado = false;
- }
- }
- }
- }
- void Update () {
- if (Input.GetKey ("a")) {
- setVida = setVida - 20;
- atacado = true;
- Alerta1 ();
- } else {
- if (getVida == 0) {
- Debug.Log ("MORRI");
- DestroyObject (this);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement