浏览代码

add health controller

/hh-develop-fps_game_project
HH 4 年前
当前提交
3f05d962
共有 3 个文件被更改,包括 33 次插入7 次删除
  1. 2
      Project/Assets/ML-Agents/Examples/FPS_Game/Prefabs/Projectile.prefab
  2. 25
      Project/Assets/ML-Agents/Examples/FPS_Game/Scenes/FPS_Game.unity
  3. 13
      Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/AgentHealth.cs

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


- component: {fileID: 7844766926972049869}
m_Layer: 10
m_Name: Projectile
m_TagString: Untagged
m_TagString: projectile
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0

25
Project/Assets/ML-Agents/Examples/FPS_Game/Scenes/FPS_Game.unity


m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1828481691}
m_LocalRotation: {x: -8.9741037e-10, y: 0.99454474, z: -0.104311325, w: -0.000000008556258}
m_LocalRotation: {x: 8.9741037e-10, y: 0.99454474, z: -0.104311325, w: 0.000000008556258}
m_LocalPosition: {x: 9.70142, y: 1.9999999, z: 6.4973907}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []

m_EditorClassIdentifier:
shieldKey: 105
shieldGO: {fileID: 6056307872597931691}
--- !u!114 &5337721584620702657
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5337721584620702655}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9227871cd6ab8429d90afa4a5160924e, type: 3}
m_Name:
m_EditorClassIdentifier:
currentHealth: 100
damagePerHit: 5
--- !u!4 &5337721585805735587 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5337721585805735587, guid: 0058b366f9d6d44a3ba35beb06b0174b,

propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5337721584620702660, guid: 0058b366f9d6d44a3ba35beb06b0174b,
type: 3}
propertyPath: Settings.UseLocalSpaceLinearVelocity
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6056307872132108554, guid: 0058b366f9d6d44a3ba35beb06b0174b,
type: 3}
propertyPath: m_ScreenY

- target: {fileID: 6056307872446210073, guid: 0058b366f9d6d44a3ba35beb06b0174b,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.000000008556258
value: -0.000000008556258
value: -8.9741037e-10
value: 8.9741037e-10
objectReference: {fileID: 0}
- target: {fileID: 6056307872446210073, guid: 0058b366f9d6d44a3ba35beb06b0174b,
type: 3}

13
Project/Assets/ML-Agents/Examples/FPS_Game/Scripts/AgentHealth.cs


using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public float currentHealth;
public float currentHealth = 100;
public float damagePerHit;
public float damagePerHit = 5;
// Start is called before the first frame update
void Start()

}
private void OnCollisionEnter(Collision col)
{
if (col.transform.CompareTag("projectile"))
{
currentHealth -= damagePerHit;
}
}
}
正在加载...
取消
保存