static void Prefix(Role __instance, int classId) { if (!_settings.InfPromoteBuy) { return; } CharacterClassData classInfo = __instance.getClassInfo(); if (__instance.lv < classInfo.maxLevel) { return; } int i = 0; while (i < classInfo.promotionDatas.Count) { if (classInfo.promotionDatas[i].promotionClassId == classId) { ClassPromotionData classPromotionData = classInfo.promotionDatas[i]; if (PlayerData.Money < (long)classPromotionData.money || PlayerData.GetCreditPoint(classPromotionData.creditType) < classPromotionData.creditPoint) { return; } PlayerData.ModifyCreditPoint(classPromotionData.creditType, classPromotionData.creditPoint); } else { i++; } } }
private void Awake() { if (instance != null) { Destroy(this); } else { instance = this; } character = GetComponent <Character>(); if (GameManager.instance != null) { data = GameManager.instance.currentSelectedClass; } DamagedEnemy = new UnityEvent <Health>(); // DamagedEnemy.AddListener((health) => Debug.Log("Event fired")); }