Beispiel #1
0
    //----------------------------------------------------------------------------------------------------
    /// <summary>
    /// 当たり判定
    /// </summary>
    private void OnTriggerEnter(Collider other)
    {
        if (!myAiBoss)
        {
            return;
        }

        if (other.gameObject.name == myAiBoss.PlayerObjectName)
        {
            //頂点の位置
            Vector3 vLDB = new Vector3(gameObject.transform.position.x - m_cubeLength, gameObject.transform.position.y - m_cubeLength, gameObject.transform.position.z - m_cubeLength);
            Vector3 vLDF = new Vector3(gameObject.transform.position.x - m_cubeLength, gameObject.transform.position.y - m_cubeLength, gameObject.transform.position.z + m_cubeLength);
            Vector3 vLUB = new Vector3(gameObject.transform.position.x - m_cubeLength, gameObject.transform.position.y + m_cubeLength, gameObject.transform.position.z - m_cubeLength);
            Vector3 vLUF = new Vector3(gameObject.transform.position.x - m_cubeLength, gameObject.transform.position.y + m_cubeLength, gameObject.transform.position.z + m_cubeLength);
            Vector3 vRDB = new Vector3(gameObject.transform.position.x + m_cubeLength, gameObject.transform.position.y - m_cubeLength, gameObject.transform.position.z - m_cubeLength);
            Vector3 vRDF = new Vector3(gameObject.transform.position.x + m_cubeLength, gameObject.transform.position.y - m_cubeLength, gameObject.transform.position.z + m_cubeLength);
            Vector3 vRUB = new Vector3(gameObject.transform.position.x + m_cubeLength, gameObject.transform.position.y + m_cubeLength, gameObject.transform.position.z - m_cubeLength);
            Vector3 vRUF = new Vector3(gameObject.transform.position.x + m_cubeLength, gameObject.transform.position.y + m_cubeLength, gameObject.transform.position.z + m_cubeLength);

            //当たり判定発生
            MyCube explosionRange = new MyCube(vLDB, vRDB, vLDF, vRDF, vLUB, vRUB, vLUF, vRUF);
            myAttackManager.EnemyAttack(explosionRange, MaskAttribute.Non, myAiBoss.Attack, 0.1f);

            //削除
            Destroy(this.gameObject);
        }
    }
Beispiel #2
0
    //----------------------------------------------------------------------------------------------------
    /// <summary>
    /// 爆発本体
    /// </summary>
    public void Explosion()
    {
        //エフェクトプレファブ
        GameObject bombEffect = GameObject.Instantiate(m_bombEffect) as GameObject;

        bombEffect.transform.position = m_effectPoint.position;

        //当たり判定Cube
        explosionPoint = this.gameObject.transform.position;

        //頂点の位置
        Vector3 vLDB = new Vector3(explosionPoint.x - m_bombPower, explosionPoint.y - m_bombPower, explosionPoint.z - m_bombPower);
        Vector3 vLDF = new Vector3(explosionPoint.x - m_bombPower, explosionPoint.y - m_bombPower, explosionPoint.z + m_bombPower);
        Vector3 vLUB = new Vector3(explosionPoint.x - m_bombPower, explosionPoint.y + m_bombPower, explosionPoint.z - m_bombPower);
        Vector3 vLUF = new Vector3(explosionPoint.x - m_bombPower, explosionPoint.y + m_bombPower, explosionPoint.z + m_bombPower);
        Vector3 vRDB = new Vector3(explosionPoint.x + m_bombPower, explosionPoint.y - m_bombPower, explosionPoint.z - m_bombPower);
        Vector3 vRDF = new Vector3(explosionPoint.x + m_bombPower, explosionPoint.y - m_bombPower, explosionPoint.z + m_bombPower);
        Vector3 vRUB = new Vector3(explosionPoint.x + m_bombPower, explosionPoint.y + m_bombPower, explosionPoint.z - m_bombPower);
        Vector3 vRUF = new Vector3(explosionPoint.x + m_bombPower, explosionPoint.y + m_bombPower, explosionPoint.z + m_bombPower);

        //当たり判定発生
        MyCube explosionRange = new MyCube(vLDB, vRDB, vLDF, vRDF, vLUB, vRUB, vLUF, vRUF);

        myAttackManager.EnemyAttack(explosionRange, MaskAttribute.Non, myAiBoss.Attack, 1);

        //爆弾削除
        Destroy(this.gameObject);

        //SEの再生
        MySoundManager.Instance.Play(SeCollection.Explosion, true, transform.position.x, transform.position.y, transform.position.z);
    }
Beispiel #3
0
    //----------------------------------------------------------------------------------------------------
    ///<summary>
    ///攻撃当たり範囲作成//
    ///</summary>
    void MakeAttackRange()
    {
        Vector3 attackPoint = GameObject.Find(m_myObjectName).transform.position;

        float cubeLength = 1f;
        //頂点の位置
        Vector3 vLDB = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z - cubeLength);
        Vector3 vLDF = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z + cubeLength);
        Vector3 vLUB = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z - cubeLength);
        Vector3 vLUF = new Vector3(attackPoint.x - cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z + cubeLength);
        Vector3 vRDB = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z - cubeLength);
        Vector3 vRDF = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y - cubeLength, attackPoint.z + cubeLength);
        Vector3 vRUB = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z - cubeLength);
        Vector3 vRUF = new Vector3(attackPoint.x + cubeLength, 1 + attackPoint.y + cubeLength, attackPoint.z + cubeLength);

        //当たり判定発生
        MyCube attackRange = new MyCube(vLDB, vRDB, vLDF, vRDF, vLUB, vRUB, vLUF, vRUF);

        myAttackManager.EnemyAttack(attackRange, MaskAttribute.Non, m_attack, 1);
    }
Beispiel #4
0
    //----------------------------------------------------------------------------------------------------
    /// <summary>
    /// 攻撃
    /// </summary>
    void Attack()
    {
        //ワールド座標で自分の原点と方向
        m_matrix.SetTRS(transform.position, transform.rotation, Vector3.one);

        //攻撃範囲頂点の決定
        for (var i = 0; i < MyCube.NUM_VERTICES; i++)
        {
            //絶対的な攻撃範囲の決定
            m_attackVerteces[i] = m_matrix.MultiplyPoint(ATTACK_VERTECES[i]);
        }

        //攻撃範囲の直方体の構築
        m_attackRange.SetCube(m_attackVerteces[0], m_attackVerteces[1], m_attackVerteces[2], m_attackVerteces[3],
                              m_attackVerteces[4], m_attackVerteces[5], m_attackVerteces[6], m_attackVerteces[7]);

        m_attackManager.EnemyAttack(m_attackRange, MaskAttribute.Non, m_power, m_effectiveAttackTime);
    }