45 lines
854 B
C#
45 lines
854 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DragonLi.Frame;
|
|
using UnityEngine;
|
|
|
|
public enum DamagePlayerType
|
|
{
|
|
Helmet,
|
|
Armor
|
|
}
|
|
|
|
public class DamagePlayer : MonoBehaviour, IDamagable
|
|
{
|
|
public Player player;
|
|
|
|
public DamagePlayerType damageType;
|
|
|
|
public Collider damageCollider;
|
|
|
|
public bool isServer;
|
|
private void Start()
|
|
{
|
|
if(damageCollider==null)
|
|
damageCollider=GetComponent<Collider>();
|
|
isServer = player.isServer;
|
|
damageCollider.enabled = isServer;
|
|
}
|
|
|
|
public void ApplyDamage(float value, int info, Transform _sender,int score)
|
|
{
|
|
player.ApplyDamage(value, info, _sender,score);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (isServer)
|
|
{
|
|
damageCollider.enabled = !player.isDie;
|
|
}
|
|
}
|
|
|
|
public float Health { get; set; }
|
|
}
|