예제 #1
0
    void Start()
    {
        //Human Shuibian = new Human("陳水扁", 58);
        // Human ChiaWei = new Human("林家緯", 25);
        Human Shuibian = new Human("亞洲人", 160, "陳水扁", 58);
        Human ChiaWei  = new Human("亞洲人", 180, "林家緯", 25);
        //ChiaWei.SayMySelf();

        Human Kobe = new Human("北美洲人", 198, "摳逼不萊恩特", 39);


        Human JKRowLing = new Human("JK羅琳");

        Human.PassHeight = 200;



        Kobe.SayMySelf();
        JKRowLing.SayMySelf();

        Debug.Log(ChiaWei.Talk(Shuibian));
        Debug.Log(Shuibian.Talk(ChiaWei));
        Debug.Log(Kobe.Talk(ChiaWei));
        Debug.Log(JKRowLing.Talk(Kobe));


        Debug.Log(Human.SayPassHeight());

        Debug.Log(ChiaWei.name + "的身高是否及格:" + ChiaWei.PassforMyHeight());

        Human.PassHeight = 170;
        Debug.Log(Human.SayPassHeight());
        Debug.Log(ChiaWei.name + "的身高是否及格:" + ChiaWei.PassforMyHeight());

        ABC.ABCC();                       //靜態Class
        Debug.Log(Human.SayThisMethod()); //這個Class裡面的靜態method

        User MyUser = new User("林家緯", "1233334");

        Debug.Log(MyUser.GetUserName());
        Debug.Log(MyUser.GetPassword());

        Debug.Log(MyUser.Username);
        MyUser.Username = "******";//向Set存入
        Debug.Log(MyUser.Username);


        ///練習題目
        Player player = new Player();

        player.pickAGold();
        player.HungerRate += 10; // 餓了,飢餓度上升
        Debug.Log("飢餓度:" + player.HungerRate);

        player.pickASilver();
        player.HungerRate += 10; // 餓了,飢餓度上升
        Debug.Log("飢餓度:" + player.HungerRate);
        player.pickASilver();
        player.HungerRate += 10; // 餓了,飢餓度上升


        Debug.Log("飢餓度:" + player.HungerRate + ",身上物品總值:" + player.TotalValue);

        player.pickACopper();
        player.HungerRate -= 60; // 吃了一個可以減少 60 飢餓度的東西
        Debug.Log("飢餓度:" + player.HungerRate);
        player.pickAGold();
        player.HungerRate -= 60; // 吃了一個可以減少 60 飢餓度的東西


        Debug.Log("飢餓度:" + player.HungerRate + ",身上物品總值:" + player.TotalValue);

        Moster ms = new Moster(75, "大頭怪", 100);

        Debug.Log(ms.HP);
        ms.HP -= 10;
        Debug.Log(ms.HP);
        ms.HP += 90;
        Debug.Log(ms.HP);
        ms.HP -= 56;
        Debug.Log(ms.HP);
        Debug.Log(ms.SayMyname());
        Debug.Log(ms.Walk());



        Bot bt = new Bot(95, "阿諾", 100);

        Debug.Log(bt.HP);
        // bt.InJured(ms.AttAck);
        ms.AttAck(bt);
        Debug.Log(bt.HP);

        ms.SetAttAck = 200;
        //bt.InJured(ms.AttAck);
        ms.AttAck(bt);
        Debug.Log(bt.HP);
        Debug.Log(bt.SayMyname());
        Debug.Log(bt.Walk());
    }