示例#1
0
    private void ProcessRaycast()
    {
        RaycastHit hit;

        if (Physics.Raycast(FPCamera.transform.position, FPCamera.transform.forward, out hit, range))
        {
            CreateHitImpact(hit);
            EnemyHealthVM target = hit.transform.GetComponent <EnemyHealthVM>();
            if (target == null)
            {
                return;
            }
            target.TakeDamage(damage);
        }
        else
        {
            return;
        }
    }
示例#2
0
 void Start()
 {
     navMeshAgent = GetComponent <NavMeshAgent>();
     health       = GetComponent <EnemyHealthVM>();
     target       = FindObjectOfType <PlayerHealthVM>().transform;
 }