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; [SyncVar] public bool isDeal; [SyncVar] public GameObject item; private void Start() { if (isServer) { box.enabled = true; } addHpIndex = 40; isDeal = false; CoroutineTaskManager.Instance.WaitSecondTodo(() => { if(!isServer|| isDeal) return; NetworkServer.Destroy(gameObject); Collider(); }, 8f); } [ClientRpc] public void SetItemProp(ItemPropType type) { itemPropType = type; } [Server] public void Collider() { if(!isServer) return; if (isDeal) { return; } isDeal = true; box.enabled = false; item.SetActive(false); } }