赞
踩
五星效果图
以上为展示,没做优化
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.Video;
-
-
- public class OneGifi : Pond
- {
- public void OneGift()
- {
- //抽奖即加一
- wuFloor += 1;
- siFloor += 1;
-
-
-
- //五星出货区
- int wuI = 0;
- //默认出奖值
- if (wuFloor < 40)
- Random_rewards = Random.Range(10, 999);
- else if (wuFloor < 73) Random_rewards = Random.Range(8, 1000);
- R = (int)Random_rewards; Debug.Log(R);
- //判断五星是否出了
- if (Withdraw == true)
- {
- wuFloor = 0;
- Withdraw = false;
- }
- if (wuFloor < 73)
- {
- while (wuI < 6)
- {
- if (R == wuRewards[wuI])
- {
-
- Withdraw = true;
- wuFloor = 0;
- }
- wuI++;
-
- }
- }
-
-
- //当五星保底到73后用新算法
- else if (wuFloor < 90)
- {
- //从新定义wurewards的范围,将随机出来的数放入The_Current_Probability_wu数组中,依次判断出奖值是否与出奖区对应
- int[] Temp_Data_wu = new int[1000];
- int The_Current_Probability_wu = 6 + 53 * (wuFloor - 73);
- Random_rewards = Random.Range(0, 1000);
- R = (int)Random_rewards;
- int new_min = The_Current_Probability_wu / 2;
- int new_max = 1000 - The_Current_Probability_wu / 2;
- //创建集中池
- for (int i = 0, j = 1000; i < new_min && j > new_max; i++, j--)
- {
- Temp_Data_wu[i] = i + 1;
- Temp_Data_wu[j - 1] = j - 1;
- }
- int new_wu = 0;
- while (new_wu < 1000)
- {
- if (R == Temp_Data_wu[new_wu])
- {
- Withdraw = true;
- break;
- }
- new_wu++;
- }
- }
- else
- {
- Withdraw = true;
- }
-
-
-
-
-
-
- //判断四星
- if (The_Purple == true&&Withdraw!=true)
- {
- The_Purple = false;
- siFloor = 0;
- }
- //判断四星是否出了
- int[] Temp_Data_si = new int[1000];
- int The_Current_Probability_si = 561;
-
-
- //定义wurewards的范围,将出奖值出来的数放入The_Current_Probability_wu数组中,依次判断出奖值是否与出奖区对应
- if (siFloor < 9)
- {
- Random_rewards = Random.Range(15, 980);
- R = (int)Random_rewards;
- int new_min = 26;
- int new_max = 1000 - 25;
- //创建集中池
- for (int i = 0, j = 1000; i < new_min && j > new_max; i++, j--)
- {
- Temp_Data_si[i] = i + 1;
- Temp_Data_si[j - 1] = j - 1;
- }
- int new_si = 14;
- while (new_si < 26 || (new_si > 975 && new_si < 1000))
- {
- if (new_si > 26)
- new_si += 949;
- if (R == Temp_Data_si[new_si])
- {
- The_Purple = true;
- break;
- }
- new_si++;
- }
- }
-
-
-
-
- else if (siFloor < 10)
- {
-
- Random_rewards = Random.Range(0, 1000);
- R = (int)Random_rewards;
- int new_min = The_Current_Probability_si / 2;
- int new_max = 1000 - The_Current_Probability_si / 2;
- //创建集中池
- for (int i = 0, j = 1000; i < new_min && j > new_max; i++, j--)
- {
- Temp_Data_si[i] = i + 1;
- Temp_Data_si[j - 1] = j - 1;
- }
- int new_si = 0;
- while (new_si < new_min || (new_si > new_max && new_si < 1000))
- {
- if (new_si > new_min)
- new_si += 1000 - new_max;
- if (R == Temp_Data_si[new_si])
- {
- The_Purple = true;
- break;
- }
- new_si++;
- }
- }
-
- if(siFloor==9)
- {
- The_Purple = true;
- }
-
- //没有的话出三星
-
-
-
-
-
- //抽中后判定
-
- if(The_Purple==true)
- {
- //判定是否定轨,如果已经定轨成功则取消定轨
- /*if (Fix_The_Track_wu==true)
- {
- Fix_The_Track_wu = false;
- }*/
- Random_rewards = Random.Range(0, 11);
- R = (int)Random_rewards;
- if (R > 0 && R < 6)
- Out_wu = 1;
- else if (R == 6)
- Out_wu = 2;
- else if (R == 7)
- Out_wu = 3;
- else if (R == 8)
- Out_wu = 4;
- else if (R == 9)
- Out_wu = 5;
- else
- Out_wu = 6;
- }
-
-
-
- //
- if (Withdraw == true)
- {
- //判定是否定轨,如果已经定轨成功则取消定轨
- /* if (Fix_The_Track_si == true)
- {
- Fix_The_Track_si = false;
- }
- else Fix_The_Track_si = true;*/
-
-
- Random_rewards = Random.Range(0, 511);
- double R = Random_rewards;
- //角色池
- if(R<255)
- {
- double R_min = 12.75;
- Out_si = 1;
- while ((R_min + 12.75) <= R)
- {
- R_min += 12.75;
- Out_si++;
- }
- }
- //武器池
- else
- {
- double R_min=14.16;
- Out_si = 1;
- while((R_min + 14.16)<=R)
- {
- R_min += 14.16;
- Out_si++;
- }
- }
-
-
-
-
- }
-
-
-
- }
-
- }
-
-
以上为“简易(没有原本精细)"算法,我借鉴了b站一颗平衡树大佬对原神抽卡机制研究
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。