Ejemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "Player")
     {
         col.GetComponent <Player>().PlayerDamage(m_status.Attack());
     }
 }
Ejemplo n.º 2
0
 protected void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "Player")
     {
         //Debug.Log("敵:えいっ!");
         m_player.GetComponent <Player>().PlayerDamage(m_status.Attack());
     }
 }
Ejemplo n.º 3
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == "Player")
        {
            col.GetComponent <Player>().PlayerDamage(m_status.Attack());
            Destroy(this.gameObject);
        }

        if ((col.gameObject.tag == "Slash" || col.gameObject.tag == "Fist") && !m_counter)
        {
            m_counter = true;
            transform.DOMove(new Vector3(transform.parent.gameObject.transform.position.x, transform.parent.gameObject.transform.position.y), 2.0f);
            transform.parent = null;
        }

        if (col.gameObject.tag == "Enemy" && m_counter)
        {
            m_enemyManager.EnemyDamage(m_status.Attack(), col.gameObject);
            Destroy(this.gameObject);
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 攻撃状態
    /// </summary>
    protected virtual void AttackState()
    {
        LookAtTarget(m_player, m_flip);

        //数秒ごとに攻撃
        m_attackTime += Time.deltaTime;
        if (m_attackTime > 3.0f)
        {
            Debug.Log("敵:えいっ!");
            m_player.GetComponent <Player>().PlayerDamage(m_status.Attack());

            m_attackTime = 0;
        }


        if (Input.GetKeyDown(KeyCode.Z))
        {
            Debug.Log("敵:ぐはっ…");
            m_status.Damage(10);
            //攻撃受けたらフラグ立てて
            //何秒かは攻撃しない
        }
    }