Ejemplo n.º 1
0
    public int EAI(int x)
    {
        Debug.Log("point" + x);
        string name;
        int    y;
        int    ai;
        int    eatk;
        int    pdef;
        int    damage;
        Slider slider;
        Text   text;

        if (x == 1)
        {
            ai   = getStatus.Geteai1();
            name = getStatus.GeteName1();
            Debug.Log("point2" + ai);
        }
        else if (x == 2)
        {
            ai   = getStatus.Geteai2();
            name = getStatus.GeteName2();
        }
        else if (x == 3)
        {
            ai   = getStatus.Geteai3();
            name = getStatus.GeteName3();
        }
        else
        {
            ai   = getStatus.Geteai4();
            name = getStatus.GeteName4();
        }
        switch (ai)
        {
        case 1:    //ブツリ攻撃
            if (x == 1)
            {
                eatk = getStatus.Geteatk1();
                Debug.Log("point3");
            }
            else if (x == 2)
            {
                eatk = getStatus.Geteatk2();
            }
            else if (x == 3)
            {
                eatk = getStatus.Geteatk3();
            }
            else
            {
                eatk = getStatus.Geteatk4();
            }
            pdef   = getStatus.Getpdef1();
            damage = eatk - pdef;
            Debug.Log(damage);
            if (damage < 0)
            {
                damage = 0;
            }
            b = GameObject.Find("HP player1");
            Debug.Log(b);
            slider       = b.GetComponent <Slider>();
            slider.value = slider.value - damage;
            coment.text  = name + "の攻撃!" + getStatus.GetpName1() + "に" + damage + "のダメージ!";
            string hpnow = (slider.value).ToString();
            string hpmax = (getStatus.Getphp1()).ToString();
            b         = GameObject.Find("HP player1/Fill Area/Text");
            text      = b.GetComponent <Text>();
            text.text = "HP                       " + hpnow + "/" + hpmax;

            break;
        }
        y = 1;
        return(y);
    }