| 1234567891011121314151617181920212223242526272829 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System;
- public class AngryBulletSelf : MonoBehaviour
- {
- public AngryBullet ab;
- private void OnTriggerEnter(Collider other)
- {
- if (other.gameObject.layer == 8 && Array.IndexOf(ab.ens, other.GetComponentInParent<Enemy>()) == -1)
- {
- Enemy en = other.GetComponentInParent<Enemy>();
- ab.ens[ab.curTimes] = en;
- int damage = ab.damage + (int)(ab.realDamage * en.totalHp);
- en.BeHit(damage);
- ab.curTimes++;
- if (ab.curTimes == ab.maxTimes)
- {
- ab.ChangeState(AngryBullet.BulletState.die);
- }
- else
- {
- ab.ChangeState(AngryBullet.BulletState.findTarget);
- }
- }
- }
- }
|