示例#1
0
    public float setDamage(int argsInt, int argsCharaIndex)
    {
        //戻り値で経験値を返す
        grantExpChara.Add(argsCharaIndex);

        //defenceMagnification

        float tmpVal  = argsInt * defenceMagnification;
        int   calcVal = Mathf.RoundToInt(tmpVal);

        GameObject retObj = Instantiate(bitmapFontBasePrefab, this.transform.position, this.transform.rotation) as GameObject;

        retObj.GetComponentInChildren <common_damage> ().showDamage(this.transform, calcVal);

        thisEnemyStat.nowHP -= calcVal;

        if (thisEnemyStat.nowHP <= 0)
        {
            this.destoryF = true;

            gmS.grantExp_forAllChara(grantExpChara, thisEnemyStat.grantExp);

            sMB.playOneShotSound(enm_oneShotSound.attack03);

            Instantiate(removeEnemyPrefab, this.transform.position, Quaternion.identity);
            Destroy(this.gameObject);
            return(0);
        }
        else
        {
            sMB.playOneShotSound(enm_oneShotSound.enemyHit);
            hpBar.setHP(thisEnemyStat.nowHP);
            return(0);
        }
    }
示例#2
0
    //
    //ダメージ処理
    public void setDamage(float argsInt)
    {
        GameObject retObj = Instantiate(bitmapFontBasePrefab, this.transform.position, this.transform.rotation) as GameObject;

        //
        //todo : 無敵時の挙動の実装
        if (thisCharaUnbreakable == true)
        {
            sMB.playOneShotSound(enm_oneShotSound.metal);
            return;
        }

        float damage = argsInt * thisChara.battleStatus.getDamage_CalCharaMode();

        if (thisChara.flyingFlag == true)
        {
            damage = damage * thisChara.flyingDefMagn;
        }

        // ここまでにダメージ計算
        retObj.GetComponentInChildren <common_damage> ().showDamage(this.transform, damage, Color.red);
        thisAnimeter.SetTrigger("gotoDamage");

        thisChara.nowHP -= damage;

        hpBar.setHP(thisChara.nowHP);

        if (thisChara.nowHP < 1)
        {
            this.destroyF = true;
            this.removedMe(this.transform);
        }
        else
        {
            sMB.playOneShotSound(enm_oneShotSound.playerDamage);
        }
    }