Example #1
0
    protected override void ExecuteShoot()
    {
        // PlayerBulletを動的生成
        StgPlayerBulletFactory factory = new StgPlayerBulletFactory();

        // 発射位置の設定 + オフセット設定
        Vector3 position = CalcShootPosition();

        shootPositions[0]    = position;
        shootPositions[1]    = position;
        shootPositions[2]    = position;
        shootPositions[0].x += kAttackPositionXOffset;
        shootPositions[1].x += 0;
        shootPositions[2].x += -kAttackPositionXOffset;

        GameObject[] bullets = new GameObject[kShootNum];
        bullets[0] = factory.Create(StgBulletConstant.Type.kPlayerNormal);
        bullets[1] = factory.Create(StgBulletConstant.Type.kPlayerNormal);
        bullets[2] = factory.Create(StgBulletConstant.Type.kPlayerNormal);

        for (int i = 0; i < kShootNum; ++i)
        {
            Object.Instantiate(bullets[i], shootPositions[i], Quaternion.identity);
        }
    }
    /// <summary>
    /// 発射処理
    /// </summary>
    protected virtual void ExecuteShoot()
    {
        // PlayerBulletを動的生成
        StgPlayerBulletFactory factory = new StgPlayerBulletFactory();
        GameObject             bullet  = factory.Create(StgBulletConstant.Type.kPlayerNormal);

        // 発射位置の設定 + オフセット設定
        Vector3 position = CalcShootPosition();

        Object.Instantiate(bullet, position, Quaternion.identity);
    }
Example #3
0
    private void AttackProcess()
    {
        // PlayerBulletを動的生成
        StgPlayerBulletFactory factory = new StgPlayerBulletFactory();
        GameObject             bullet  = factory.Create(StgBulletConstant.Type.kPlayerNormal);

        if (playerScript == null)
        {
            // SetPlayerの時点ではStgPlayerを取得できないのでここで一度だけ取得する
            playerScript = this.player.GetComponent <StgPlayer>();
        }
        MhCommon.Assert(playerScript != null, "StgPlayerAttack::AttackProcess() playerScript null");
        Vector3 shootPosition = playerScript.GetShootPosition();

        attackPositon = shootPosition;

        Object.Instantiate(bullet, attackPositon, Quaternion.identity);
    }