public override void Eat() { Debug.Log("Eat Seed"); PlayerData.Buff b = new PlayerData.Buff(); b.id = item.id; b.num = 1; PlayerData.AddBuff(b, 0); //物品的id和buffid一一对应 PlayerData.RemoveItem(item.id); }
public override void Eat() { Debug.Log("Eat Apple"); PlayerData.P_hungery += 10; //需要放到PlayerData中一个方法,会受其他状态影响 PlayerData.Buff b = new PlayerData.Buff(); b.id = item.id; b.num = 1; PlayerData.AddBuff(b, 0); //物品的id和buffid一一对应,0是物品buff PlayerData.RemoveItem(item.id); }
public void Illcheck() { int rnd = Random.Range(0, carryIll.Length); //随机出疾病 Debug.Log(carryIll.Length); if (carryIll[rnd] != -1) //不为-1就感染 { PlayerData.Buff ill = new PlayerData.Buff(); ill.id = carryIll[rnd]; ill.num = 1; PlayerData.AddBuff(ill, 1); } }
void OnCollisionEnter2D(Collision2D col) { Splash(); Splash(); Splash(); //湿度增加 if (col.gameObject.name == "Player") { PlayerData.Buff ill = new PlayerData.Buff(); ill.id = (int)GameData.illType.cold; ill.num = 1; PlayerData.AddBuff(ill, 1); } die(); //} //Invoke ("die", dietime); }