该项目的目的是同时测试和演示来自 Unity DOTS 技术堆栈的多个新包。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

36 行
988 B

using System;
[Serializable]
public struct SplashDamageSettings
{
public float radius;
public float falloffStartRadius;
public float damage;
public float minDamage;
public float impulse;
public float minImpulse;
public float ownerDamageFraction;
public void Calculate(float distance, bool selfDamage, out float damageResult, out float impulseResult)
{
if (distance > radius)
{
damageResult = 0;
impulseResult = 0;
return;
}
damageResult = damage;
impulseResult = impulse;
if (distance > falloffStartRadius)
{
var falloffFraction = (distance - falloffStartRadius) / (radius - falloffStartRadius);
damageResult -= (damage - minDamage) * falloffFraction;
impulseResult -= (impulse - minImpulse) * falloffFraction;
}
if (selfDamage)
damageResult = damageResult * ownerDamageFraction;
}
}