Files
Zombie/Assets/_Zombie/Scripts/Prop/ItemProp.cs
2025-09-02 14:46:43 +08:00

43 lines
787 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using DragonLi.Core;
using Mirror;
using UnityEngine;
public enum ItemPropType
{
Hp,
}
public class ItemProp : NetworkBehaviour
{
public Collider box;
[SyncVar] public int addHpIndex;
[SyncVar] public ItemPropType itemPropType;
private void Start()
{
addHpIndex = 40;
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
{
Collider();
}, 15f);
}
[ClientRpc]
public void SetItemProp(ItemPropType type)
{
itemPropType = type;
}
[Server]
public void Collider()
{
box.enabled = false;
transform.gameObject.SetActive(false);
NetworkServer.Destroy(transform.gameObject);
}
}