Esempio n. 1
0
    //----------------------------------------------------------------------------------------------------
    /// <summary>
    /// ダメージ
    /// </summary>
    /// <param name="attack">攻撃</param>
    void Damage(MyAttack attack)
    {
        m_hp -= attack.Power;

        //死亡
        if (m_hp <= 0)
        {
            Destroy(gameObject, m_timeToDie);
            m_behaviorState = EnemyBehaviorStatus.Die;
        }
    }
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.J) || Input.GetMouseButtonDown(0))
        {
            if (HasWeapon)
            {
                MyAttack.Hit();
            }
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            TakeDamage(Damage);
        }

        if (Input.GetKeyDown(KeyCode.H))
        {
            AddNewLife(AddLife);
        }
    }