浏览代码

continuous flame damage

/develop/cubewars/splashdamage
Ervin Teng 4 年前
当前提交
8022d413
共有 1 个文件被更改,包括 13 次插入7 次删除
  1. 20
      Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs

20
Project/Assets/ML-Agents/Examples/CubeWars/Scripts/LargeCubeAgent.cs


public float moveSpeed;
public float fireDamage = 0.25f;
public float burnDamage = 0.01f;
public float flameWidth = 7f;
public Material normalMaterial;
public Material weakMaterial;
public Material deadMaterial;

m_AgentRb = GetComponent<Rigidbody>();
m_MyArea = area.GetComponent<CubeWarArea>();
m_CubeWarSettings = FindObjectOfType<CubeWarSettings>();
myLaser.width = flameWidth;
SetResetParameters();
}

float checkTime = Time.time;
if (m_Shoot)
{
myLaser.isFired = true;
}
if (myLaser.isFired)
{
float damage = m_Shoot ? fireDamage : burnDamage;
myLaser.isFired = true;
if (Physics.SphereCast(transform.position, 10f, rayDir, out hit, 120f))
if (Physics.SphereCast(transform.position, flameWidth, rayDir, out hit, 120f))
if (hit.collider.gameObject.GetComponent<SmallCubeAgent>().HitAgent(fireDamage))
if (hit.collider.gameObject.GetComponent<SmallCubeAgent>().HitAgent(damage))
//AddReward(.1f);
Debug.DrawRay(transform.position, hit.point - transform.position, Color.green, 0.3f, false);
else if (checkTime > m_ShootTime + .5f)
if (checkTime > m_ShootTime + .5f)
{
myLaser.isFired = false;
}

for (int i = 0; i < casts; i++)
{
var rayDir = Quaternion.AngleAxis(angleRotation * i, Vector3.up) * myTransform.forward * 10f;
Debug.DrawRay(myTransform.position, rayDir, Color.green, 0f, true);
if (Physics.SphereCast(transform.position, 3f, rayDir, out hit, 7f))
{
if (hit.collider.gameObject.CompareTag("StrongSmallAgent") || hit.collider.gameObject.CompareTag("WeakSmallAgent"))

正在加载...
取消
保存