浏览代码

Cooldown timer for laser

/develop/battlefoodcollector
Ervin Teng 4 年前
当前提交
798a5613
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 8
      Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/BattleFoodAgent.cs

8
Project/Assets/ML-Agents/Examples/FoodCollector/Scripts/BattleFoodAgent.cs


bool m_Shoot;
float m_FrozenTime;
float m_EffectTime;
float m_CooldownTime;
Rigidbody m_AgentRb;
float m_LaserLength;
// Speed of agent rotation.

// Speed of agent movement.
public float moveSpeed = 2;
public float cooldownTime = 0.5f;
public Material normalMaterial;
public Material badMaterial;
public Material goodMaterial;

sensor.AddObservation(localVelocity.z);
sensor.AddObservation(m_Frozen);
sensor.AddObservation(m_Shoot);
sensor.AddObservation((Time.time - m_CooldownTime) / cooldownTime);
sensor.AddObservation((Time.time - m_CooldownTime) / cooldownTime);
}
}

m_AgentRb.velocity *= 0.95f;
}
if (m_Shoot)
if (m_Shoot && (Time.time > m_CooldownTime + cooldownTime))
{
var myTransform = transform;
//m_Laser.transform.localScale = new Vector3(1f, 1f, m_LaserLength);

}
}
}
m_CooldownTime = Time.time;
}
else
{

正在加载...
取消
保存