65 lines
2.0 KiB
C#
Raw Normal View History

2024-12-09 11:19:14 +08:00
using System;
2024-12-04 17:26:27 +08:00
using System.Collections;
using System.Collections.Generic;
2024-12-09 11:19:14 +08:00
using cfg.BlacksmithData;
2024-12-04 17:26:27 +08:00
using UnityEngine;
2024-12-09 11:19:14 +08:00
using Random = UnityEngine.Random;
using Vector3 = System.Numerics.Vector3;
/// <summary>
/// 玩家战斗预制体资源
/// </summary>
2024-12-04 17:26:27 +08:00
public class PlayerItem : MonoBehaviour
{
private BattleEquipment _battleEquipment;
2024-12-09 11:19:14 +08:00
[SerializeField]
private List<GameObject> _gameObjects = new List<GameObject>();
2024-12-04 17:26:27 +08:00
public void SetData(BattleEquipment battleData)
2024-12-04 17:26:27 +08:00
{
_battleEquipment = battleData;
2024-12-09 11:19:14 +08:00
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<Bullet>().SetAttack(data.itemData,(int)(data.Attack*data.Ratio),10,1);
BattleManager.ins.AddBullets(obj.GetComponent<Bullet>());
});
2024-12-04 17:26:27 +08:00
}
2024-12-09 11:19:14 +08:00
2024-12-04 17:26:27 +08:00
}