123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class bianpao : MonoBehaviour
- {
- public float benjin = 100000;
- public float gailv = 50;
- public float zhouqi = 10000;
- public float zongtouru = 0;
- public float yinkui = 0;
- public int xunhuan = 0;
- public void Start()
- {
- zongtouru = benjin;
- }
- public void nextzhou()
- {
- for (int i = 0; i < xunhuan; i++)
- {
- bool zf = false;
- int gl = Random.Range(-1, 100);
- if (gailv >= gl)
- {
- zf = true;
- }
- float gl2 = Random.Range(-1f, 10f);
- gl2 = zf ? gl2 / 100 : -gl2 / 100;
- benjin = benjin + benjin * gl2;
- if (!zf)
- {
- zongtouru = zongtouru + zhouqi;
- benjin = benjin + zhouqi;
- }
- else
- {
- zongtouru = zongtouru - zhouqi;
- benjin = benjin - zhouqi;
- }
- yinkui = (benjin - zongtouru) / benjin;
- }
- }
- }
|