浏览代码

cp

/hh-develop-water-balloon-fight
HH 4 年前
当前提交
542edd22
共有 7 个文件被更改,包括 64 次插入11 次删除
  1. 17
      Project/Assets/ML-Agents/Examples/FPS_Game/Prefabs/Projectile - BALL.prefab
  2. 21
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/DodgeBall.cs
  3. 24
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/DodgeBallAgent.cs
  4. 9
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/DodgeBallGameController.cs
  5. 2
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/ThrowBall.cs
  6. 2
      Project/ProjectSettings/TagManager.asset

17
Project/Assets/ML-Agents/Examples/FPS_Game/Prefabs/Projectile - BALL.prefab


- component: {fileID: 1657024916}
m_Layer: 0
m_Name: TrailRenderer (1)
m_TagString: Untagged
m_TagString: dodgeBallPickup
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0

- component: {fileID: 6779490827046006232}
- component: {fileID: 418425099599415636}
- component: {fileID: 3525145920380393505}
m_Layer: 10
m_Layer: 0
m_TagString: Untagged
m_TagString: dodgeBallPickup
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0

- component: {fileID: 3911029810215854904}
- component: {fileID: 4341296992446652170}
- component: {fileID: 4188137103012002061}
m_Layer: 10
m_Layer: 0
m_TagString: dodgeBall
m_TagString: dodgeBallPickup
m_IsActive: 0
m_IsActive: 1
--- !u!4 &3911029810215854904
Transform:
m_ObjectHideFlags: 0

m_EditorClassIdentifier:
inPlay: 0
rb: {fileID: 0}
BallCollider: {fileID: 4977931146242317046}
--- !u!1 &6461313653667732308
GameObject:
m_ObjectHideFlags: 0

- component: {fileID: 6333385540820070532}
- component: {fileID: 4569169311316799599}
- component: {fileID: 4977931146242317046}
m_Layer: 10
m_Layer: 0
m_TagString: dodgeBall
m_TagString: dodgeBallPickup
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0

21
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/DodgeBall.cs


[HideInInspector]
public Rigidbody rb;
public Collider BallCollider;
// Start is called before the first frame update
void Start()
{

}
//Set ball to either a pickup item or an active ball that is in play
//inPlay = true means the ball can hurt other players
public void BallIsInPlay(bool p)
{
if (p)
{
gameObject.tag = "dodgeBallActive";
BallCollider.gameObject.tag = "dodgeBallActive";
}
else
{
gameObject.tag = "dodgeBallPickup";
BallCollider.gameObject.tag = "dodgeBallPickup";
}
inPlay = p;
}
private void OnCollisionEnter(Collision col)
{
//IF NOT MY TEAM

inPlay = false;
BallIsInPlay(false);
}
}
}

24
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/DodgeBallAgent.cs


public AudioClip TauntVoiceAudioClip;
public AudioClip HurtVoiceAudioClip;
public AudioClip BallImpactAudioClip;
[Header("HIT DAMAGE")] public int NumberOfTimesPlayerCanBeHit = 5;
public int HitPointsRemaining; //how many more times can we be hit
//PLAYER STATE TO OBSERVE
// Start is called before the first frame update
public override void Initialize()
{

input = GetComponent<FPSAgentInput>();
m_GameController = FindObjectOfType<DodgeBallGameController>();
ActiveBallsQueue.Clear();
HitPointsRemaining = NumberOfTimesPlayerCanBeHit;
// Unfreeze();
// Unpoison();
// Unsatiate();

if (db.inPlay) //HIT BY LIVE BALL
{
if (HitPointsRemaining == 1)
{
//RESET ENV
print($"{gameObject.name} Lost.{gameObject.name} was weak:");
//ASSIGN REWARDS
EndEpisode();
}
else
{
HitPointsRemaining--;
//ASSIGN REWARDS
}
HitSoundAudioSource.PlayOneShot(HurtVoiceAudioClip, .2f);
HitSoundAudioSource.PlayOneShot(HurtVoiceAudioClip, 1f);
db.BallIsInPlay(false);
}
else //TRY TO PICK IT UP
{

//add to our inventory
ActiveBallsQueue.Enqueue(db);
db.BallIsInPlay(true);
db.gameObject.SetActive(false);
// ActiveBallsList.Add(db);
}

9
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/DodgeBallGameController.cs


m_Initialized = true;
}
void PlayerWasHit(DodgeBallAgent agent)
{
// var team
}
void ResetScene()
{
m_ResetTimer = 0;

2
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/ThrowBall.cs


public void Throw(DodgeBall db)
{
db.inPlay = true;
db.BallIsInPlay(true);
FireProjectile(db.rb);
}

2
Project/ProjectSettings/TagManager.asset


- purpleGoal
- projectile
- dodgeBall
- dodgeBallPickup
- dodgeBallActive
layers:
- Default
- TransparentFX

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存