Esempio n. 1
0
        //public DriverCard DriverCard { get; set; }

        public Game(User User)
        {
            this.User   = User;
            BottlePrice = new BottlePrice(new UAH(5));
            USDPrice    = new USDPrice(25);
            MakeMove();
        }
Esempio n. 2
0
        public async void MakeMove()
        {
            User.MakeMove();
            User.CheckLose();
            await Task.Run(() => BottlePrice.Graph());

            await Task.Run(() => USDPrice.Graph());
        }
Esempio n. 3
0
    //10.编写一个函数,传入学校结构体,旅行社结构体及喜翠瓶价格结构体,求出园长妈妈最终的盈亏。
    float Balance(ref School a, ref Agent b, ref BottlePrice c) {
        float margin = Margin(a, b);
        float cost = c.Generation[c.Generation.Length-1] * 0.8f;
        float rate = 0.0638f; // JPY -> CNY

        return margin - cost * rate; 

    }
Esempio n. 4
0
    //9.假设喜翠瓶在第四代之后,每年价值翻倍,编写一个函数,传入参数为喜翠瓶价格结构体,填充结构体数据,打印喜翠瓶在每一代人手中的价格。
    void PrintPrice(ref BottlePrice bp) {

        bp.Generation = new float[14];

        bp.Generation[0] = 4000f; // JPY
        bp.Generation[1] = bp.Generation[0] / 2f; //半价
        bp.Generation[2] = bp.Generation[1] * 10f; //十倍价格 of 典当价

        for (int i = 0; i < 3; i++) {
            Debug.Log("第" + (i+1) + "代价格: " + bp.Generation[i] + "日元");
        }

        for (int i = 3; i < bp.Generation.Length; i++) {
            bp.Generation[i] = bp.Generation[i - 1] * 2f; //每年价值翻倍 - 每代
            Debug.Log("第" + (i+1) + "代价格: " + bp.Generation[i] + "日元");
        }
    }
Esempio n. 5
0
    void Start()
    {
        // Q1 & Q2
        School abcSchool;
        abcSchool.TotalStudent = 108;
        abcSchool.TotalF = 48;
        abcSchool.TotalM = 60;
        abcSchool.Level3 = 30;
        abcSchool.Level2 = 36;
        abcSchool.Level1 = 42;
        abcSchool.Level3M = 30 / 2;
        abcSchool.Level3F = 30 / 2;
        abcSchool.Level2M = (36 / 2) + 4 / 2;
        abcSchool.Level2F = 36 - abcSchool.Level2M;
        abcSchool.Level1M = 60 - abcSchool.Level3M - abcSchool.Level2M;
        abcSchool.Level1F = 48 - abcSchool.Level3F - abcSchool.Level2F;

        PrintLevel1(ref abcSchool);


        // Q3 & Q4
        Agent niwa;
        niwa.Name = "日和";
        niwa.BlackCost = 1900f;
        niwa.WhiteCostL1 = 2500f;
        niwa.WhiteCostL2 = 2200f;
        niwa.WhiteCostL3 = 2000f;

        float margin = Margin(abcSchool, niwa);
        Debug.Log("园长妈妈回扣: " + margin + "元");

        // Q5,Q6
        Weapon redSword;
        redSword.Length = 2.0f;
        redSword.Width = 0.4f;
        redSword.Attack = 80f;
        redSword.Guard = 20f;
        redSword.Color = "red";

        Weapon blueShield;
        blueShield.Length = 1.5f;
        blueShield.Width = 1.5f;
        blueShield.Attack = 30f;
        blueShield.Guard = 90f;
        blueShield.Color = "lightblue";

        float area = SumArea(ref redSword, ref blueShield);
        Debug.Log("两个武器的面积之和: " + area + "平方尺");

        // Q7
        float BadGuyHealth = 1000f;
        AfterAttack(BadGuyHealth, ref redSword, ref blueShield);

        //Q8 & Q9
        BottlePrice xcp = new BottlePrice();
        PrintPrice(ref xcp);

        //Q10
        float balance = Balance(ref abcSchool, ref niwa, ref xcp);
        Debug.Log("园长妈妈最终的盈亏: " + balance + "元");
    }