Beispiel #1
0
    void Update()
    {
        if (!ready)
        {
            return;
        }

        if (targetObject == null)
        {
            Destroy(gameObject);
            return;
        }

        transform.LookAt(targetObject.transform.position);
        transform.position = Vector3.MoveTowards(transform.position, targetObject.transform.position, 10 * Time.deltaTime);
        if (Vector3.Distance(targetObject.transform.position, transform.position) < 0.5f)
        {
            HPController hpc = targetObject.GetComponent <HPController>();
            hpc.DealDamage(hpc.MaxHp / 5);
            Destroy(gameObject);
        }
    }
Beispiel #2
0
 public void DealDamage(float dmg)
 {
     hpC.DealDamage(dmg);
 }