using System.Collections; using System.Collections.Generic; using Mirror; using UnityEngine; using Valheim; public class PropItem : MonoBehaviour { public int id; public GameObject sparkle; public WeaponType weaponType; public int amount; public int atk; public void Init(WeaponType type) { weaponType = type; } public void Reduce() { transform.localScale=Vector3.zero; sparkle.SetActive(false); } public void Amplify() { transform.localScale=Vector3.one; sparkle.SetActive(true); } private void OnTriggerEnter(Collider other) { if (other.CompareTag("Weapon")) { var weapons=other.transform.parent.GetComponent(); foreach (var item in MRNetworkManager.Ins.roomSlots) { var player = item.GetComponent(); if (weapons.playerId == player.index) { player.PickUpWeapon(weaponType,amount,atk); StartCoroutine(GameManager.Ins.PlayAudio("道具拾取音效",transform,true)); NetworkServer.Destroy(gameObject); } } } } }