using System; using System.Collections; using System.Collections.Generic; using cfg.BlacksmithData; using UnityEngine; using Random = UnityEngine.Random; using Vector3 = System.Numerics.Vector3; /// /// 玩家战斗预制体资源 /// public class PlayerItem : MonoBehaviour { private BattleEquipment _battleEquipment; [SerializeField] private List _gameObjects = new List(); public void SetData(BattleEquipment battleData) { _battleEquipment = battleData; if (_battleEquipment.Weapon!=null) { _battleEquipment.Weapon.AddAction(SkillEvent); } if (_battleEquipment.Weapon2!=null) { _battleEquipment.Weapon2.AddAction(SkillEvent); } if (_battleEquipment.Armor!=null) { _battleEquipment.Armor.AddAction(SkillEvent); } if (_battleEquipment.AudioUniversal!=null) { _battleEquipment.AudioUniversal.AddAction(SkillEvent); } if (_battleEquipment.AudioWeapon!=null) { _battleEquipment.AudioWeapon.AddAction(SkillEvent); } if (_battleEquipment.AudioWeapon2!=null) { _battleEquipment.AudioWeapon2.AddAction(SkillEvent); } PrefabPool.ins.AddPond("Battle_Buttle", 12); } private void SkillEvent(SkillState data) { BDebug.LogWarning(data.Name); PrefabPool.ins.LoadObj("Battle_Buttle", (GameObject obj) => { obj.transform.parent = transform; obj.transform.localPosition = UnityEngine.Vector3.zero; BattleManager.ins.AxisLookAt(obj.transform, BattleManager.ins.Mousters[Random.Range(0, BattleManager.ins.MousterCount)].transform.position); BDebug.Log(data.Attack + " "+data.Ratio); obj.GetComponent().SetAttack(data.itemData,(int)(data.Attack*data.Ratio),10,1); BattleManager.ins.AddBullets(obj.GetComponent()); }); } }