示例#1
0
    void shoot()
    {
        timer = 0f;
        shotaudio.Play();
        shotlight.enabled = true;
        shotline.enabled  = true;
        shotline.SetPosition(0, transform.position);
        rayshot.direction = transform.forward;
        // Invoke("attend", 1);
        if (Physics.Raycast(transform.position, transform.forward, out hit))
        {
            enmyhealth eh = hit.collider.GetComponent <enmyhealth>();

            if (eh != null)
            {
                eh.gethurt(shotdamage);

                anim = hit.collider.GetComponent <Animator>();
                anim.SetBool("isFrapp", true);
                Invoke("finanim", 2);

                shotline.SetPosition(1, hit.point);
            }
        }
        else
        {
            shotline.SetPosition(1, transform.position + range * transform.forward);
        }
        //  Invoke("destory", 1f);
    }
示例#2
0
 void Awake()
 {
     anim = GetComponentInChildren <Animator>();
     eh   = enmy.GetComponent <enmyhealth>();
     // pma =GetComponent<UnityEngine.AI.NavMeshAgent>();
     od = door.GetComponent <opendoor>();
 }
示例#3
0
    void Shoot()
    {
        RaycastHit hitInfo;

        if (Physics.Raycast(transform.position, transform.forward, out hitInfo, 50f))
        {
            enmyhealth target = hitInfo.transform.GetComponent <enmyhealth>();
            if (target != null)
            {
                target.gethurt(damage);
                GameObject impactGO = Instantiate(impactEffect, hitInfo.point, Quaternion.LookRotation(hitInfo.normal));
                Destroy(impactGO, 1f);
            }
        }
    }
示例#4
0
 void Start()
 {
     //anim = GetComponent<Animator> ();hg
     anim = GetComponentInChildren <Animator>();
     eh   = GetComponent <enmyhealth> ();
 }