here our my codes.
using UnityEngine;
using System.Collections;
public class hit : MonoBehaviour {
public int damage = 10;
public float maxdist = 4.0f;
public float distance = 1.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void hiter() {
RaycastHit hits;
if (Physics.Raycast (transform.position, transform.forward, out hits, distance ))
{
if (hits.collider.gameObject.tag == "enemy")
{
distance = hits.distance;
if (distance < maxdist)
{
SendMessage ("ApplyDamage", 5.0F);
}
}
}
}
}
//endcode 1
using UnityEngine;
using System.Collections;
public class enemydamage : MonoBehaviour {
void start()
{
}
public float health = 20.0f;
void ApplyDamage(int damage)
{
health -= ApplyDamage;
}
}
it keeps giving me diferent errors for whatever i change.