Ejemplo n.º 1
0
    public void tatakau3()
    {
        GameObject gameObject = GameObject.Find("戦闘処理");

        getStatus = gameObject.GetComponent <GetStatus>();
        Debug.Log(getStatus.Getpact1());
        gameObject = transform.GetChild(0).gameObject;
        slider     = gameObject.GetComponent <Slider>();
        prefab     = (GameObject)Resources.Load("Damage");
        Debug.Log(prefab);
        string name = this.name;

        Debug.Log(name);
        Skill.KindOfDamage KOD    = skill.GetKindOfDamage();
        string             strVal = Enum.GetName(typeof(KindOfDamage), KOD);

        if (strVal == "ブツリ")
        {
            atk = getStatus.Getpatk1();
            if (name == "Enemy1")
            {
                gur  = getStatus.Getedef1();
                name = getStatus.GeteName1();
            }
            else if (name == "Enemy2")
            {
                gur  = getStatus.Getedef2();
                name = getStatus.GeteName2();
            }
            else if (name == "Enemy3")
            {
                gur  = getStatus.Getedef3();
                name = getStatus.GeteName3();
            }
            else if (name == "Enemy4")
            {
                gur  = getStatus.Getedef4();
                name = getStatus.GeteName4();
            }
        }
        else if (strVal == "セイシン")
        {
            atk = getStatus.Getpinc1();
            if (name == "Enemy1")
            {
                gur  = getStatus.Getemtl1();
                name = getStatus.GeteName1();
            }
            else if (name == "Enemy2")
            {
                gur  = getStatus.Getemtl2();
                name = getStatus.GeteName2();
            }
            else if (name == "Enemy3")
            {
                gur  = getStatus.Getemtl3();
                name = getStatus.GeteName3();
            }
            else if (name == "Enemy4")
            {
                gur  = getStatus.Getemtl4();
                name = getStatus.GeteName4();
            }
        }
        int damage = atk + Mathf.CeilToInt(skill.Getpow()) - gur;

        if (damage < 0)
        {
            damage = 0;
        }

        Debug.Log(damage);
        slider.value = slider.value - damage;
        coment.text  = name + "に" + damage + "のダメージ!";

        gameObject = GameObject.Find("コマンドパネル");
        Select select = gameObject.GetComponent <Select>();

        select.move--;
        Debug.Log("行動数" + select.move + "/" + select.smove);
        select.Move();
        //Instantiate(prefab);
        //new WaitForSeconds(1);
        //Destroy(prefab.gameObject);
    }
Ejemplo n.º 2
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);
    }