Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            //rayの生成
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit = new RaycastHit();

            //rayと衝突していなかったら以降の処理をしない
            if (Physics.Raycast(ray, out hit) && isFirst)
            {
                Vector3 vec = new Vector3(hit.point.x, hit.point.y, hit.point.z);

                //パンプキングからパンプ菌を発射
                throwBom.ThrowingBall(vec, BomType.normal);

                bomb    = throwBom.GetBomObj();
                isFirst = false;
            }
        }
        if (bomb == null && isFirst == false)
        {
            camShake.DoShake(0.5f, 0.5f);
            isFirst = true;
        }
    }
Example #2
0
    /// <summary>
    /// パンプ菌を生成する場所を取得
    /// </summary>
    void CreatePos()
    {
        int nowBomCount = bomCount.NowBomCount();

        //爆弾を生成できるのは、ほかの爆弾がない時 かつ 爆弾の数が0でないときだけ
        if (nowBomCount == 0 || playerMove.IsTouch != true)
        {
            return;
        }


        if (Input.GetButtonUp("Fire1"))
        {
            pumpkinParent.SetActive(false);


            //#if UNITY_EDITOR
            //            //rayの生成
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            //#else
            //Ray ray = Camera.main.ScreenPointToRay(Input.touches[0].position);
//#endif
            RaycastHit hit;
            //rayと衝突していなかったら以降の処理をしない
            if (Physics.Raycast(ray, out hit, layerMask) == false)
            {
                FlickInitialize();
                return;
            }

            pumpkingAnimator.SetTrigger("IsThrow");

            Vector3 createPos = new Vector3(hit.point.x, hit.point.y, hit.point.z);

            HoleParentSet();

            AudioManager.Instance.PlaySE("Throw");

            minionParent = Instantiate(massParentPre, createPos, Quaternion.identity);
            minionParent.transform.SetParent(holeType, true);

            //次のボムのタイプを取得
            BomType nextBom = bomCount.NextBomType();

            //パンプキングからパンプ菌を発射
            throwBom.ThrowingBall(createPos, nextBom);

            bomMar = throwBom.GetBomObj().GetComponent <BomManager>();

            PumpCreateData pumpData;

            pumpData.bomMar       = bomMar;
            pumpData.displayCount = displayCount;
            pumpData.parentObj    = minionParent;

            dataLis.Add(pumpData);

            //ボムの数を減らす
            bomCount.UseBom();

            FlickInitialize();

            delay = false;
        }
    }