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("Prefab/Buttle", 12);
}
private void SkillEvent(SkillState data)
{
PrefabPool.ins.LoadObj("Prefab/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);
obj.GetComponent().SetAttack(data,(int)(data.Attack*(data.Ratio+((float)BattleManager.ins.Buff(data.itemData.Includearms).attack/10000)))
,data.data.Skillmove,BattleManager.ins.Buff(data.itemData.Includearms).piercing+1,BattleManager.ins.Buff(data.itemData.Includearms).criticalStrike);
BattleManager.ins.AddBullets(obj.GetComponent());
});
}
}