| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using Sirenix.OdinInspector;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Photosphere : MonoBehaviour
- {
- //组件
- public ConductController conductController;
-
- [LabelText("有停留时间")]public bool haveStayTime;
- [ShowIf("haveStayTime")][LabelText("停留时间")]public float stayTime;
- [LabelText("破碎特效")]public GameObject breakEffect;
- private float time;
- [LabelText("大小差值")] public float offset;
- public int hp;
- public int id;
- public GameObject bulletPrefab;
- [Header("反伤率")] public float rate;
-
- private void Update()
- {
- if (hp <= 0)
- {
- conductController.photospheres.Remove(this);
- Transform trans = PoolManager.Instantiate(breakEffect).transform;
- trans.position = transform.position;
- conductController.RefreshBarrierScale();
- gameObject.SetActive(false);
- }
- if (haveStayTime)
- {
- time += Time.deltaTime;
- if (time >= stayTime)
- {
- conductController.photospheres.Remove(this);
- conductController.RefreshBarrierScale();
- gameObject.SetActive(false);
- }
- }
- }
- public void Reflex(BeHitTrigger beHitTrigger,int damage)
- {
- hp -= damage;
- GameObject obj =PoolManager.Instantiate(bulletPrefab);
- Vector3 attackDir = (beHitTrigger.owner.beSearchTrigger.transform.position - transform.position).normalized;
- //obj.GetComponent<Bullet>().BeShoot(beHitTrigger.owner, transform.position, attackDir, true, true, beHitTrigger.owner);
- //obj.GetComponent<MagicBullet>().Reflex(damage,beHitTrigger.owner,transform.position, attackDir,owner);
- if (hp <= 0)
- {
- gameObject.SetActive(false);
- }
- }
- }
|