Ejemplo n.º 1
0
    //private void Update()
    //{
    //	if( Input.GetKeyDown(KeyCode.I ) ) {
    //		TakeDamage( new DamagableData() {
    //			damage = 1000000,
    //			attacker = c.gameObject
    //		} );

    //		Log.to.I( "Cheat" );
    //	}
    //}

    public bool TakeDamage(DamagableData data)
    {
        if (c.stat.isDivine)
        {
            Log.to.I("무적으로 피해안입음");
            return(false);
        }

        if (c.stat.isDie)
        {
            return(false);
        }

        AudioController.Play("PlayerHit");

        c.stat.hp -= data.damage;
        if (c.stat.hp <= 0)
        {
            AudioController.Play("PlayerDie");
            c.moveCon.Transition(PlayerState.die, true);
            //StageMan.In.GameOver();
            return(true);
        }
        else
        {
            c.moveCon.Transition(PlayerState.hit, false);
        }
        return(false);
    }
Ejemplo n.º 2
0
    public bool TakeDamage(DamagableData data)
    {
        if (!gameObject.activeInHierarchy)
        {
            return(false);
        }
        if (curHp <= 0)
        {
            return(false);
        }

        curHp -= data.damage;

        hpBar.fillAmount = (curHp / initHp);
        StartCoroutine(InBeatTime());

        if (curHp > 0f && curHp <= 0.4f)
        {
            rageboss = true;
        }
        else if (curHp <= 0.0f)
        {
            CoinDrop();
            BossDie();

            return(true);
        }
        return(false);
    }
Ejemplo n.º 3
0
    public bool TakeDamage(DamagableData data)
    {
        if (!gameObject.activeInHierarchy)
        {
            return(false);
        }

        if (currHp <= 0f)
        {
            return(false);
        }

        //if(!this.gameObject.activeSelf)
        //{
        //    return false;
        //}
        currHp -= data.damage;

        hpBar.fillAmount = (currHp / initHp);

        if (hitCo != null)
        {
            StopCoroutine(hitCo);
        }
        hitCo = StartCoroutine(InBeatTime());

        if (currHp <= 0f)
        {
            //CoinDrop();
            MonsterDie();
            return(true);
        }
        return(false);
    }
Ejemplo n.º 4
0
    public bool TakeDamage(DamagableData data)
    {
        //데미지량이 넘어서면 리사이클로 나중에 변경.
        hp -= data.damage;
        if (hp <= 0)
        {
            Recycle();
        }

        if (nextBall != null)
        {
            Gen(nextBall.name, rb.position + Vector2.right / 4f, new Vector2(2f, 5f));
            Gen(nextBall.name, rb.position + Vector2.left / 4f, new Vector2(-2f, 5f));
            return(false);
        }
        else
        {
            StageMan.In.MonsterDie();
        }
        return(true);
    }