コード例 #1
0
ファイル: Tatakau.cs プロジェクト: N1025/Charactopia
    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);
    }