浏览代码

Fix compile error, increase rotation speed

/develop/dodgeball-tests
Ervin Teng 4 年前
当前提交
28b7392c
共有 2 个文件被更改,包括 20 次插入17 次删除
  1. 34
      Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/DodgeBallAgent.cs
  2. 3
      Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/PlayBackgroundAudio.cs

34
Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/DodgeBallAgent.cs


{
// sensor.AddObservation((float)StepCount / (float)MaxStep); //Helps with credit assign?
sensor.AddObservation(ThrowController.coolDownWait); //Held DBs Normalized
sensor.AddObservation((float)currentNumberOfBalls/4); //Held DBs Normalized
sensor.AddObservation((float)HitPointsRemaining/(float)NumberOfTimesPlayerCanBeHit); //Remaining Hit Points Normalized
sensor.AddObservation((float)currentNumberOfBalls / 4); //Held DBs Normalized
sensor.AddObservation((float)HitPointsRemaining / (float)NumberOfTimesPlayerCanBeHit); //Remaining Hit Points Normalized
// // sensor.AddObservation(localVelocity.x);
// // sensor.AddObservation(localVelocity.z);
// // sensor.AddObservation(m_Frozen);
// // sensor.AddObservation(m_ShootInput);
// // sensor.AddObservation(localVelocity.x);
// // sensor.AddObservation(localVelocity.z);
// // sensor.AddObservation(m_Frozen);
// // sensor.AddObservation(m_ShootInput);
}
// else if (useVectorFrozenFlag)
// {

m_DashInput = act[4];
//HANDLE ROTATION
m_CubeMovement.Look(m_Rotate);
m_CubeMovement.Look(10 * m_Rotate);
//HANDLE XZ MOVEMENT
var moveDir = transform.TransformDirection(new Vector3(m_InputH, 0, m_InputV));

ActiveBallsQueue.Dequeue();
currentNumberOfBalls--;
SetActiveBalls(currentNumberOfBalls);
// Give a small (< 1-gamma) reward for throwing a ball
// AddReward(0.005f);
}
}

public void PlayHitFX()
{
ThrowController.impulseSource.GenerateImpulse();
// HitSoundAudioSource.Play();
HitSoundAudioSource.PlayOneShot(BallImpactAudioClip, 1f);
HitSoundAudioSource.PlayOneShot(HurtVoiceAudioClip, 1f);
HitByParticles.Play();
if (AnimateEyes)
{
StartCoroutine(ShowHitFace());
}
ThrowController.impulseSource.GenerateImpulse();
// HitSoundAudioSource.Play();
HitSoundAudioSource.PlayOneShot(BallImpactAudioClip, 1f);
HitSoundAudioSource.PlayOneShot(HurtVoiceAudioClip, 1f);
HitByParticles.Play();
if (AnimateEyes)
{
StartCoroutine(ShowHitFace());
}
}
private void OnCollisionEnter(Collision col)

3
Project/Assets/ML-Agents/Examples/Dodgeball/Scripts/PlayBackgroundAudio.cs


using System.Collections;
using System.Collections.Generic;
using UnityEditor.SceneManagement;
// using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
using UnityEngine;

正在加载...
取消
保存