I was creating a survival game and when I was editing for when I hit the tree she fell gave this error
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeleeSystem : MonoBehaviour {
private Arvere Arvore;
public int tamanhoDoBracoDoRapaz = 4;
// Use this for initialization
void Start () {
}
// Update is called once per frame
private void Update () {
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if(Physics.Raycast (ray, out hit, 15) {
if(hit.distance <= tamanhoDoBracoDoRapaz){
if (Input.GetMouseButtonDown (0)) {
if (hit.collider.tag == "Arvore") {
Arvore = hit.collider.GetComponentInParent ();
Dano ();
}
}
}
}
}
void Dano(){
Arvore.ArvoHP -= 1;
Debug.Log (Arvore.ArvoHP);
}
}
,I was creating a survival game and when I was editing for when I hit the tree she fell gave this error
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeleeSystem : MonoBehaviour {
private Arvere Arvore;
public int tamanhoDoBracoDoRapaz = 4;
// Use this for initialization
void Start () {
}
// Update is called once per frame
private void Update () {
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if(Physics.Raycast (ray, out hit, 15) {
if(hit.distance <= tamanhoDoBracoDoRapaz){
if (Input.GetMouseButtonDown (0)) {
if (hit.collider.tag == "Arvore") {
Arvore = hit.collider.GetComponentInParent ();
Dano ();
}
}
}
}
}
void Dano(){
Arvore.ArvoHP -= 1;
Debug.Log (Arvore.ArvoHP);
}
}
↧