void AddFeverPoint(PuzzleEventType type, int count) { int feverPoint; int puzzlePoint; GetFeverPoint(type, count, out feverPoint, out puzzlePoint); accumFeverPoint += feverPoint; accumPuzzlePoint += puzzlePoint; if (Constants.Instance.UseCameraMarker) { Debug.Log("puzzle point = " + accumPuzzlePoint); } }
// needs optimization static void GetFeverPoint(PuzzleEventType type, int count, out int feverPoint, out int puzzlePoint) { feverPoint = 0; puzzlePoint = 0; var table = TableLoader.GetTable<PuzzleEventEntity>(); var typedTable = table.GetMany(type).Select(x => x.Value).ToDictionary(x => x.count); int maxKey = typedTable.Keys.Max(); int key = Mathf.Min(count, maxKey); if (typedTable.ContainsKey(key)) { var entity = typedTable[key]; feverPoint = entity.feverPoint; puzzlePoint = entity.puzzlePoint; } }