|
@@ -66,6 +66,8 @@ public class Character : MonoBehaviour
|
|
|
public SearchTrigger searchTrigger;
|
|
public SearchTrigger searchTrigger;
|
|
|
public List<TargetType> targetTypes;
|
|
public List<TargetType> targetTypes;
|
|
|
public bool canHitFly;
|
|
public bool canHitFly;
|
|
|
|
|
+ [HideInInspector]
|
|
|
|
|
+ public float hurtKeepTime;
|
|
|
|
|
|
|
|
public virtual void Init()
|
|
public virtual void Init()
|
|
|
{
|
|
{
|
|
@@ -111,7 +113,7 @@ public class Character : MonoBehaviour
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public virtual void BeHit(int damage, Vector3 force)
|
|
|
|
|
|
|
+ public virtual void BeHit(int damage, Vector3 force, bool changeHurt, float hurtTime)
|
|
|
{
|
|
{
|
|
|
if (invincibleTime > 0)
|
|
if (invincibleTime > 0)
|
|
|
{
|
|
{
|
|
@@ -119,13 +121,15 @@ public class Character : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
hp -= damage;
|
|
hp -= damage;
|
|
|
uiHp.Show(hp, totalHp);
|
|
uiHp.Show(hp, totalHp);
|
|
|
- rb.AddForce(force);
|
|
|
|
|
- if (hp < 0)
|
|
|
|
|
|
|
+ if (hp <= 0)
|
|
|
{
|
|
{
|
|
|
|
|
+ rb.AddForce(force);
|
|
|
ChangeState(CharacterState.Die);
|
|
ChangeState(CharacterState.Die);
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ else if (changeHurt)
|
|
|
{
|
|
{
|
|
|
|
|
+ rb.AddForce(force);
|
|
|
|
|
+ hurtKeepTime = hurtTime;
|
|
|
ChangeState(CharacterState.Hurt);
|
|
ChangeState(CharacterState.Hurt);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -143,13 +147,12 @@ public class Character : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
GameObject bulletObj = PoolManager.Instantiate(bulletPrefab);
|
|
GameObject bulletObj = PoolManager.Instantiate(bulletPrefab);
|
|
|
Bullet bullet = bulletObj.GetComponent<Bullet>();
|
|
Bullet bullet = bulletObj.GetComponent<Bullet>();
|
|
|
- bullet.damage = attackInfo.damage;
|
|
|
|
|
Vector3 attackDir = attackInfo.attackDir.normalized;
|
|
Vector3 attackDir = attackInfo.attackDir.normalized;
|
|
|
if (bodyTrans.localScale.x < 0)
|
|
if (bodyTrans.localScale.x < 0)
|
|
|
{
|
|
{
|
|
|
attackDir.x = -attackDir.x;
|
|
attackDir.x = -attackDir.x;
|
|
|
}
|
|
}
|
|
|
- bullet.BeShoot(this, shootPos[shootId].position, attackDir, attackInfo.damage, attackInfo.force, shootTrack, attackTarget?attackTarget.beSearchTrigger.transform:null);
|
|
|
|
|
|
|
+ bullet.BeShoot(this, shootPos[shootId].position, attackDir, attackInfo.damage, attackInfo.force, attackInfo.changeHurt, attackInfo.hurtTime, shootTrack, attackTarget?attackTarget:null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public virtual Vector3 GetMoveDir()
|
|
public virtual Vector3 GetMoveDir()
|
|
@@ -185,6 +188,8 @@ public class Character : MonoBehaviour
|
|
|
for (int i = 0; i < attack1Infos.Count; i++)
|
|
for (int i = 0; i < attack1Infos.Count; i++)
|
|
|
{
|
|
{
|
|
|
attackTriggers[i].damage = attack1Infos[i].damage;
|
|
attackTriggers[i].damage = attack1Infos[i].damage;
|
|
|
|
|
+ attackTriggers[i].changeHurt = attack1Infos[i].changeHurt;
|
|
|
|
|
+ attackTriggers[i].hurtTime = attack1Infos[i].hurtTime;
|
|
|
Vector3 attackDir = attack1Infos[i].attackDir.normalized;
|
|
Vector3 attackDir = attack1Infos[i].attackDir.normalized;
|
|
|
if (bodyTrans.localScale.x < 0)
|
|
if (bodyTrans.localScale.x < 0)
|
|
|
{
|
|
{
|
|
@@ -228,6 +233,8 @@ public class Character : MonoBehaviour
|
|
|
for (int i = 0; i < attack2Infos.Count; i++)
|
|
for (int i = 0; i < attack2Infos.Count; i++)
|
|
|
{
|
|
{
|
|
|
attackTriggers[i].damage = attack2Infos[i].damage;
|
|
attackTriggers[i].damage = attack2Infos[i].damage;
|
|
|
|
|
+ attackTriggers[i].changeHurt = attack2Infos[i].changeHurt;
|
|
|
|
|
+ attackTriggers[i].hurtTime = attack2Infos[i].hurtTime;
|
|
|
Vector3 attackDir = attack2Infos[i].attackDir.normalized;
|
|
Vector3 attackDir = attack2Infos[i].attackDir.normalized;
|
|
|
if (bodyTrans.localScale.x < 0)
|
|
if (bodyTrans.localScale.x < 0)
|
|
|
{
|
|
{
|