|
@@ -18,12 +18,9 @@ public class Bullet : MonoBehaviour
|
|
|
|
|
|
|
|
[Header("组件")]
|
|
[Header("组件")]
|
|
|
public Character owner;
|
|
public Character owner;
|
|
|
|
|
+ public AttackInfo attackInfo;
|
|
|
public Rigidbody rb;
|
|
public Rigidbody rb;
|
|
|
public List<BeHitTrigger> trigedObjs;
|
|
public List<BeHitTrigger> trigedObjs;
|
|
|
- public int damage;
|
|
|
|
|
- public float force;
|
|
|
|
|
- public bool changeHurt;
|
|
|
|
|
- public float repelValue;
|
|
|
|
|
public BulletType bulletType;
|
|
public BulletType bulletType;
|
|
|
public bool isGetTarget = false;
|
|
public bool isGetTarget = false;
|
|
|
public float speed;
|
|
public float speed;
|
|
@@ -69,10 +66,10 @@ public class Bullet : MonoBehaviour
|
|
|
dis2.z = dis1.z;
|
|
dis2.z = dis1.z;
|
|
|
if (Vector3.Distance(dis1,dis2) < 0.1)
|
|
if (Vector3.Distance(dis1,dis2) < 0.1)
|
|
|
{
|
|
{
|
|
|
- trackTarget.BeHit(damage, Vector3.zero, false, 0);
|
|
|
|
|
|
|
+ trackTarget.BeHit(attackInfo, transform.position.x < trackTarget.transform.position.x?-1:1) ;
|
|
|
if (trackTarget.debugAttackFrom)
|
|
if (trackTarget.debugAttackFrom)
|
|
|
{
|
|
{
|
|
|
- trackTarget.DebugAttackFrom(owner.name, damage);
|
|
|
|
|
|
|
+ trackTarget.DebugAttackFrom(owner.name, attackInfo.damage);
|
|
|
}
|
|
}
|
|
|
gameObject.SetActive(false);
|
|
gameObject.SetActive(false);
|
|
|
}
|
|
}
|
|
@@ -104,7 +101,7 @@ public class Bullet : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void BeShoot(Character own, Vector3 shootPos, Vector3 dir, int dmg, float fc, bool hurt, float repel, bool aim = false, bool alwaysTrack = false, Character target = null)
|
|
|
|
|
|
|
+ public void BeShoot(Character own, Vector3 shootPos, Vector3 dir, bool aim = false, bool alwaysTrack = false, Character target = null)
|
|
|
{
|
|
{
|
|
|
transform.position = shootPos;
|
|
transform.position = shootPos;
|
|
|
transform.right = -dir;
|
|
transform.right = -dir;
|
|
@@ -121,12 +118,9 @@ public class Bullet : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
gameObject.SetActive(true);
|
|
gameObject.SetActive(true);
|
|
|
isGetTarget = false;
|
|
isGetTarget = false;
|
|
|
- damage = dmg;
|
|
|
|
|
- force = fc;
|
|
|
|
|
- changeHurt = hurt;
|
|
|
|
|
- repelValue = repel;
|
|
|
|
|
canAlwaysTrack = alwaysTrack;
|
|
canAlwaysTrack = alwaysTrack;
|
|
|
flyTime = 0;
|
|
flyTime = 0;
|
|
|
|
|
+ attackInfo = own.attackController.attackInfo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
private void OnTriggerEnter(Collider other)
|
|
@@ -139,7 +133,7 @@ public class Bullet : MonoBehaviour
|
|
|
if (photosphere && Util.CheckCanHit(owner.tag, "Player"))
|
|
if (photosphere && Util.CheckCanHit(owner.tag, "Player"))
|
|
|
{
|
|
{
|
|
|
isInVain = true;
|
|
isInVain = true;
|
|
|
- photosphere.Reflex(owner.beHitTrigger, damage);
|
|
|
|
|
|
|
+ photosphere.Reflex(owner.beHitTrigger, owner.attackController.attackInfo.damage);
|
|
|
gameObject.SetActive(false);
|
|
gameObject.SetActive(false);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -161,7 +155,7 @@ public class Bullet : MonoBehaviour
|
|
|
if (Util.CheckCanHit(owner.tag, hitTrigger.owner.tag) && !hitTrigger.owner.isDie)
|
|
if (Util.CheckCanHit(owner.tag, hitTrigger.owner.tag) && !hitTrigger.owner.isDie)
|
|
|
{
|
|
{
|
|
|
//计算护甲减免
|
|
//计算护甲减免
|
|
|
- int curDamage = damage;
|
|
|
|
|
|
|
+ int curDamage = owner.attackController.attackInfo.damage;
|
|
|
int am = hitTrigger.owner.armor;
|
|
int am = hitTrigger.owner.armor;
|
|
|
if (am > 0)
|
|
if (am > 0)
|
|
|
{
|
|
{
|
|
@@ -173,10 +167,11 @@ public class Bullet : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
curDamage = (int)(curDamage * (100f / (100 + c)) + 0.5f);
|
|
curDamage = (int)(curDamage * (100f / (100 + c)) + 0.5f);
|
|
|
}
|
|
}
|
|
|
|
|
+ float dir = transform.position.x < hitTrigger.transform.position.x ? -1 : 1;
|
|
|
switch (bulletType)
|
|
switch (bulletType)
|
|
|
{
|
|
{
|
|
|
case BulletType.Single:
|
|
case BulletType.Single:
|
|
|
- hitTrigger.BeHit(curDamage, force * (-transform.right), changeHurt, repelValue);
|
|
|
|
|
|
|
+ hitTrigger.BeHit(attackInfo, dir);
|
|
|
if (hitTrigger.owner.debugAttackFrom)
|
|
if (hitTrigger.owner.debugAttackFrom)
|
|
|
{
|
|
{
|
|
|
hitTrigger.owner.DebugAttackFrom(owner.name, curDamage);
|
|
hitTrigger.owner.DebugAttackFrom(owner.name, curDamage);
|
|
@@ -206,7 +201,7 @@ public class Bullet : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case BulletType.Penetrate:
|
|
case BulletType.Penetrate:
|
|
|
- hitTrigger.BeHit(curDamage, force * (-transform.right), changeHurt, repelValue);
|
|
|
|
|
|
|
+ hitTrigger.BeHit(attackInfo,dir);
|
|
|
if (hitTrigger.owner.debugAttackFrom)
|
|
if (hitTrigger.owner.debugAttackFrom)
|
|
|
{
|
|
{
|
|
|
hitTrigger.owner.DebugAttackFrom(owner.name, curDamage);
|
|
hitTrigger.owner.DebugAttackFrom(owner.name, curDamage);
|