void BuyItem(int stuffCode) { Stuff stuff = MyTool.GetStuff(stuffCode); if (stuff == null) { Debug.LogError("Not exist stuffCode"); } if (stuff.bOnCoolTime()) { return; } if (!_pm.attackAble && stuff.stuffType == Stuff.StuffType.BOMB) { return; } if (stuff.GetPrice() < _pm.Money) { _pm.CmdAddMoney(-stuff.GetPrice()); _pm.Money -= stuff.GetPrice(); bool successToUse = stuff.Use(); if (successToUse) { switch (stuff.stuffType) { case Stuff.StuffType.ATTACK_SPEED: CmdAddAttackSpeed(); break; case Stuff.StuffType.BOMB: CmdSpawnBomb(); break; case Stuff.StuffType.HP: _pm.CmdAddMaxHp(); break; case Stuff.StuffType.POWER: CmdAddDamage(); break; case Stuff.StuffType.SPEED: CmdAddSpeed(); break; } } } }