91 lines
2.0 KiB
C#
91 lines
2.0 KiB
C#
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Reflection;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
|
|||
|
public class Palye : Fun
|
|||
|
{
|
|||
|
[Header("Ѫ<><D1AA>")] public float hp = 100f;//Ѫ<><D1AA>
|
|||
|
[Header("<22><><EFBFBD><EFBFBD>")] public float gold = 10f;
|
|||
|
public float Hp
|
|||
|
{
|
|||
|
get => hp;
|
|||
|
set
|
|||
|
{
|
|||
|
hp = value;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")] public int physicalArmor = 10;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
[Header("ħ<><C4A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")] public int magicArmor = 5;//ħ<><C4A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
public List<BUff> buffList = new List<BUff>();
|
|||
|
|
|||
|
|
|||
|
//public List<>;
|
|||
|
// Start is called before the first frame update
|
|||
|
async void Start()
|
|||
|
{
|
|||
|
UpdateBuff();
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// <20><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
public virtual void die()
|
|||
|
{
|
|||
|
Debug.Log(gameObject.name + "<22><><EFBFBD><EFBFBD>");
|
|||
|
Destroy(gameObject);
|
|||
|
Debug.Log("<22><><EFBFBD><EFBFBD>");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>buff
|
|||
|
/// </summary>
|
|||
|
async void UpdateBuff()//<2F><>λbuff<66><66><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
while (true)
|
|||
|
{
|
|||
|
List<BUff> deleteArr = new List<BUff>();
|
|||
|
foreach (BUff buffItem in buffList)
|
|||
|
{
|
|||
|
if (buffItem.executionInterval <= 0)
|
|||
|
{
|
|||
|
buffItem.executionInterval = buffItem.executionInterval_max;
|
|||
|
buffItem.Funaction.Invoke(buffItem.value);
|
|||
|
}
|
|||
|
|
|||
|
buffItem.executionInterval -= 0.1f;
|
|||
|
buffItem.timeLeft -= 0.1f;
|
|||
|
if (buffItem.timeLeft <= 0)
|
|||
|
{
|
|||
|
deleteArr.Add(buffItem);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
foreach (BUff item in deleteArr)
|
|||
|
{
|
|||
|
buffList.Remove(item);
|
|||
|
}
|
|||
|
await Task.Delay(100);//buff<66><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Сʱ<D0A1><CAB1>0.1<EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
// Update is called once per frame
|
|||
|
void Update()
|
|||
|
{
|
|||
|
if (hp <= 0)
|
|||
|
{
|
|||
|
die();
|
|||
|
if(Progress_Display.Instance==null) return;
|
|||
|
|
|||
|
Progress_Display.Instance.huadongClick(gold);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|