浏览代码
Character health system (#34)
Character health system (#34)
This PR implements full character lifecycle with the following states: Alive Fainted - PCs go into this state upon reaching 0 HP Dead - NPCs just die Along with these states ReviveAction has been added, which restores a Fainted character back to life. Player inputs now differentiate between friends and foes and tries to revive fainted allies on right click. Commits have been arranged in a readable order and contain additional implementation details./main
GitHub
4 年前
当前提交
d4a3dbbf
共有 10 个文件被更改,包括 506 次插入 和 166 次删除
-
294Assets/BossRoom/Models/CharacterSetController.controller
-
55Assets/BossRoom/Scripts/Client/ClientCharacterVisualization.cs
-
56Assets/BossRoom/Scripts/Client/ClientInputSender.cs
-
1Assets/BossRoom/Scripts/Server/Game/Action/Action.cs
-
43Assets/BossRoom/Scripts/Server/Game/Character/ServerCharacter.cs
-
34Assets/BossRoom/Scripts/Shared/Game/Action/ActionRequestData.cs
-
12Assets/BossRoom/Scripts/Shared/NetworkCharacterState.cs
-
122ProjectSettings/GraphicsSettings.asset
-
52Assets/BossRoom/Scripts/Server/Game/Action/ReviveAction.cs
-
3Assets/BossRoom/Scripts/Server/Game/Action/ReviveAction.cs.meta
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!30 &1 |
|||
GraphicsSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 13 |
|||
m_Deferred: |
|||
m_Mode: 1 |
|||
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_DeferredReflections: |
|||
m_Mode: 1 |
|||
m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_ScreenSpaceShadows: |
|||
m_Mode: 1 |
|||
m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_LegacyDeferred: |
|||
m_Mode: 1 |
|||
m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_DepthNormals: |
|||
m_Mode: 1 |
|||
m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_MotionVectors: |
|||
m_Mode: 1 |
|||
m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_LightHalo: |
|||
m_Mode: 1 |
|||
m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_LensFlare: |
|||
m_Mode: 1 |
|||
m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_VideoShadersIncludeMode: 2 |
|||
m_AlwaysIncludedShaders: |
|||
- {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} |
|||
- {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} |
|||
- {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} |
|||
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} |
|||
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} |
|||
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_PreloadedShaders: [] |
|||
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_CustomRenderPipeline: {fileID: 0} |
|||
m_TransparencySortMode: 0 |
|||
m_TransparencySortAxis: {x: 0, y: 0, z: 1} |
|||
m_DefaultRenderingPath: 1 |
|||
m_DefaultMobileRenderingPath: 1 |
|||
m_TierSettings: |
|||
- serializedVersion: 5 |
|||
m_BuildTarget: 1 |
|||
m_Tier: 0 |
|||
m_Settings: |
|||
standardShaderQuality: 2 |
|||
renderingPath: 3 |
|||
hdrMode: 1 |
|||
realtimeGICPUUsage: 25 |
|||
useReflectionProbeBoxProjection: 1 |
|||
useReflectionProbeBlending: 1 |
|||
useHDR: 1 |
|||
useDetailNormalMap: 1 |
|||
useCascadedShadowMaps: 1 |
|||
prefer32BitShadowMaps: 0 |
|||
enableLPPV: 1 |
|||
useDitherMaskForAlphaBlendedShadows: 1 |
|||
m_Automatic: 0 |
|||
- serializedVersion: 5 |
|||
m_BuildTarget: 1 |
|||
m_Tier: 1 |
|||
m_Settings: |
|||
standardShaderQuality: 2 |
|||
renderingPath: 3 |
|||
hdrMode: 1 |
|||
realtimeGICPUUsage: 25 |
|||
useReflectionProbeBoxProjection: 1 |
|||
useReflectionProbeBlending: 1 |
|||
useHDR: 1 |
|||
useDetailNormalMap: 1 |
|||
useCascadedShadowMaps: 1 |
|||
prefer32BitShadowMaps: 0 |
|||
enableLPPV: 1 |
|||
useDitherMaskForAlphaBlendedShadows: 1 |
|||
m_Automatic: 0 |
|||
- serializedVersion: 5 |
|||
m_BuildTarget: 1 |
|||
m_Tier: 2 |
|||
m_Settings: |
|||
standardShaderQuality: 2 |
|||
renderingPath: 3 |
|||
hdrMode: 1 |
|||
realtimeGICPUUsage: 50 |
|||
useReflectionProbeBoxProjection: 1 |
|||
useReflectionProbeBlending: 1 |
|||
useHDR: 1 |
|||
useDetailNormalMap: 1 |
|||
useCascadedShadowMaps: 1 |
|||
prefer32BitShadowMaps: 0 |
|||
enableLPPV: 1 |
|||
useDitherMaskForAlphaBlendedShadows: 1 |
|||
m_Automatic: 0 |
|||
m_LightmapStripping: 0 |
|||
m_FogStripping: 0 |
|||
m_InstancingStripping: 0 |
|||
m_LightmapKeepPlain: 1 |
|||
m_LightmapKeepDirCombined: 1 |
|||
m_LightmapKeepDynamicPlain: 1 |
|||
m_LightmapKeepDynamicDirCombined: 1 |
|||
m_LightmapKeepShadowMask: 1 |
|||
m_LightmapKeepSubtractive: 1 |
|||
m_FogKeepLinear: 1 |
|||
m_FogKeepExp: 1 |
|||
m_FogKeepExp2: 1 |
|||
m_AlbedoSwatchInfos: [] |
|||
m_LightsUseLinearIntensity: 0 |
|||
m_LightsUseColorTemperature: 0 |
|||
m_DefaultRenderingLayerMask: 1 |
|||
m_LogWhenShaderIsCompiled: 0 |
|||
version https://git-lfs.github.com/spec/v1 |
|||
<<<<<<< HEAD |
|||
oid sha256:a06b62f70a65345f430b10b6241693d1e969fbecffb1c158ac330169470fab52 |
|||
size 3569 |
|||
======= |
|||
oid sha256:442894020eebc9cfeddc7b95f3e637fdcf033513a507e0fbe231a8e0e4f7d60b |
|||
size 2230 |
|||
>>>>>>> 4459f56 (LFS is terrorising me) |
|
|||
using MLAPI.Spawning; |
|||
using UnityEngine; |
|||
|
|||
namespace BossRoom.Server |
|||
{ |
|||
public class ReviveAction : Action |
|||
{ |
|||
private bool m_ExecFired; |
|||
private ServerCharacter m_TargetCharacter; |
|||
|
|||
public ReviveAction(ServerCharacter parent, ref ActionRequestData data, int level) : base(parent, ref data, level) |
|||
{ |
|||
} |
|||
|
|||
public override bool Start() |
|||
{ |
|||
if (m_Data.TargetIds == null || m_Data.TargetIds.Length == 0 || !SpawnManager.SpawnedObjects.ContainsKey(m_Data.TargetIds[0])) |
|||
{ |
|||
Debug.Log("Failed to start ReviveAction. The target entity wasn't submitted or doesn't exist anymore"); |
|||
return false; |
|||
} |
|||
|
|||
var targetNeworkedObj = SpawnManager.SpawnedObjects[m_Data.TargetIds[0]]; |
|||
m_TargetCharacter = targetNeworkedObj.GetComponent<ServerCharacter>(); |
|||
m_Parent.NetState.ServerBroadcastAction(ref Data); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
public override bool Update() |
|||
{ |
|||
if (!m_ExecFired && Time.time - TimeStarted >= Description.ExecTime_s) |
|||
{ |
|||
m_ExecFired = true; |
|||
|
|||
if (m_TargetCharacter.NetState.NetworkLifeState.Value == LifeState.FAINTED) |
|||
{ |
|||
m_TargetCharacter.Revive(m_Parent, (int) m_Data.Amount); |
|||
} |
|||
else |
|||
{ |
|||
//cancel the action if the target is alive!
|
|||
Cancel(); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
|
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1122d1ad1a0b437c8a0e586ecb64449d |
|||
timeCreated: 1610045410 |
撰写
预览
正在加载...
取消
保存
Reference in new issue