forked from Serinoxxx/NGOAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServerAuthDamageable.cs
31 lines (28 loc) · 1.02 KB
/
ServerAuthDamageable.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using MalbersAnimations.Reactions;
using Mono.CSharp;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace MalbersAnimations.NetCode
{
public class ServerAuthDamageable : MDamageable
{
[SerializeField] NetworkDamageable networkDamageable;
public override void ReceiveDamage(Vector3 Direction, Vector3 Position, GameObject Damager, StatModifier damage, bool isCritical, bool react, Reaction customReaction, bool pureDamage, StatElement element)
{
//Prevent clients from receiving damage unless it originated from the server
if (!networkDamageable.IsServer && Damager != gameObject)
{
return;
}
base.ReceiveDamage(Direction, Position, Damager, damage, isCritical, react, customReaction, pureDamage, element);
}
}
#if UNITY_EDITOR
[CustomEditor(typeof(ServerAuthDamageable))]
public class ServerAuthDamageableEditor : MDamageableEditor
{
}
#endif
}