37 lines
982 B
C#
37 lines
982 B
C#
using DragonLi.Frame;
|
|
using Mirror;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class NormalBullet : Bullet
|
|
{
|
|
|
|
|
|
|
|
|
|
public override void OnApplyDamage(IDamagable damagable)
|
|
{
|
|
int id = (int)BulletType.Normal;
|
|
int[] damages = GameManager.Ins.BulletDescInfos[id].Damage;
|
|
|
|
int randomDamage = Random.Range(damages[0], damages[1]);
|
|
bool IsCriticalHit = false;
|
|
if (randomDamage > (damages[1] - (damages[1] - damages[0]) * 0.35f))
|
|
{
|
|
IsCriticalHit = true;
|
|
}
|
|
|
|
float resultDamage = randomDamage * GameManager.Ins.buffAtk + randomDamage;
|
|
|
|
damagable.ApplyDamage(resultDamage, IsCriticalHit, transform);
|
|
// damagable.ApplyDamage(3000, IsCriticalHit, transform);
|
|
|
|
if (ownerIndex != -1)
|
|
{
|
|
StatisticManager.Ins.AddScore(ownerIndex, resultDamage);
|
|
StatisticManager.Ins.AddHitRate(ownerIndex);
|
|
}
|
|
}
|
|
}
|