51 lines
929 B
C#
51 lines
929 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;
|
|
|
|
[SyncVar] public bool isDeal;
|
|
private void Start()
|
|
{
|
|
addHpIndex = 40;
|
|
isDeal = false;
|
|
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
|
{
|
|
Collider();
|
|
}, 15f);
|
|
}
|
|
|
|
[ClientRpc]
|
|
public void SetItemProp(ItemPropType type)
|
|
{
|
|
itemPropType = type;
|
|
}
|
|
|
|
[Server]
|
|
public void Collider()
|
|
{
|
|
if (isDeal)
|
|
{
|
|
return;
|
|
}
|
|
isDeal = true;
|
|
box.enabled = false;
|
|
transform.gameObject.SetActive(false);
|
|
NetworkServer.Destroy(transform.gameObject);
|
|
}
|
|
}
|