您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

52 行
2.1 KiB

using System;
using UnityEngine;
namespace Unity.Multiplayer.Samples.BossRoom.Server
{
/// <summary>
/// Generic interface for damageable objects in the game. This includes ServerCharacter, as well as other things like
/// ServerBreakableLogic.
/// </summary>
public interface IDamageable
{
/// <summary>
/// Receives HP damage or healing.
/// </summary>
/// <param name="inflicter">The Character responsible for the damage. May be null.</param>
/// <param name="HP">The damage done. Positive value is damage, negative is healing.</param>
void ReceiveHP(ServerCharacter inflicter, int HP);
/// <summary>
/// The NetworkId of this object.
/// </summary>
ulong NetworkObjectId { get; }
/// <summary>
/// The transform of this object.
/// </summary>
Transform transform { get; }
[Flags]
public enum SpecialDamageFlags
{
None = 0,
UnusedFlag = 1 << 0, // does nothing; see comments below
StunOnTrample = 1 << 1,
NotDamagedByPlayers = 1 << 2,
// The "UnusedFlag" flag does nothing. It exists to work around a Unity editor quirk involving [Flags] enums:
// if you enable all the flags, Unity stores the value as 0xffffffff (labeled "Everything"), meaning that not
// only are all the currently-existing flags enabled, but any future flags you added later would also be enabled!
// This is not future-proof and can cause hard-to-track-down problems, when prefabs magically inherit a new flag
// you just added. So we have the Unused flag, which should NOT do anything, and shouldn't be selected on prefabs.
// It's just there so that we can select all the "real" flags and not get it turned into "Everything" in the editor.
}
SpecialDamageFlags GetSpecialDamageFlags();
/// <summary>
/// Are we still able to take damage? If we're broken or dead, should return false!
/// </summary>
bool IsDamageable();
}
}