Example #1
0
 // Start is called before the first frame update
 void Start()
 {
     won          = FindObjectOfType <win>();
     health       = GetComponent <enemyheath>();
     navmeshagent = GetComponent <NavMeshAgent>();
     GetComponent <Animator>().SetTrigger("idle");
 }
    private void raycastprocss()
    {
        RaycastHit hit;

        if (Physics.Raycast(fpcam.transform.position, fpcam.transform.forward, out hit, range))
        {
            Debug.Log("i hit something " + hit.transform.name);
            createhitimpact(hit);
            enemyheath target = hit.transform.GetComponent <enemyheath>();
            if (target == null)
            {
                return;
            }
            target.health(damage);
        }
        else
        {
            return;
        }
    }
Example #3
0
 // Start is called before the first frame update
 void Start()
 {
     k = 0;
     canvas.enabled = false;
     health         = GetComponentInChildren <enemyheath>();
 }