2021-04-12 23:38:54 +08:00
|
|
|
|
using Cal.DataTable;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public class AddPetIntimacyGoodsEffect: GoodsEffect
|
|
|
|
|
{
|
|
|
|
|
public override string Init(Unit unit, GoodsBase goodsBase, bool isLock = false)
|
|
|
|
|
{
|
|
|
|
|
base.unit = unit;
|
|
|
|
|
GoodsBase = goodsBase;
|
|
|
|
|
return Run();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string Run()
|
|
|
|
|
{
|
|
|
|
|
PlayerData data = this.unit.GetComponent<PlayerData>();
|
|
|
|
|
if (data.petEatCount <= 0)
|
|
|
|
|
{
|
|
|
|
|
return "喂养次数达到上限";
|
|
|
|
|
}
|
2021-04-15 00:12:07 +08:00
|
|
|
|
Pet pet = this.unit.GetComponent<Pet>();
|
|
|
|
|
if (pet.petState is not (Pet.PetState.Idle or Pet.PetState.Follow))
|
|
|
|
|
{
|
|
|
|
|
return "行动中不能喂养";
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-12 23:38:54 +08:00
|
|
|
|
|
|
|
|
|
data.petEatCount--;
|
2021-06-29 11:28:15 +08:00
|
|
|
|
UnitHelper.SaveComponenet(data);
|
2021-04-12 23:38:54 +08:00
|
|
|
|
pet.AddIntimacy(this.GoodsBase.CommonIncrease);
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override async ETVoid Execute()
|
|
|
|
|
{
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|