Пример #1
0
    // プレイヤーの動きに関する処理
    void MovePlayer()
    {
        stunAnimeTime -= Time.deltaTime;

        /*=================================================================
         * // ▼▼▼移動処理▼▼▼
         * //=================================================================*/
        if (stat.IsReload() == true)
        {
              // Reload時
            charaCtrl.Move(moveDirection *moveSpeed *Time.deltaTime *ReloadSpeedRatio);
        }
        else
        {
            charaCtrl.Move(moveDirection * moveSpeed * Time.deltaTime);
        }

        if (stunAnimeTime > 0F)
        {
            return;
        }

        //  テンキーや3Dスティックの入力(GetAxis)がゼロの時の動作
        //animCtr.SetBool("doMove", useMoveKey());

        //=================================================================
        // ▼▼▼ジャンプと落下の処理▼▼▼
        //=================================================================
        if (charaCtrl.isGrounded)    //CharacterControllerの付いているこのオブジェクトが接地している場合の処理
        {
            MoveOnGround();

            if (iController.GetJumpButton())   //ジャンプボタンが押されている場合
            {
                animCtr.SetTrigger("doJump");
                moveDirection.y = jumpPower; //Y方向への速度に「ジャンプパワー」の変数を代入する
                //SE_JUMP.Play();
                return;
            }
        }

        //マイナスのY方向(下向き)に重力を与える
        moveDirection.y -= gravity * Time.deltaTime;
    }
Пример #2
0
    //チョコボール発射(リロード方式)
    void RespawnChoco()
    {
        stat.nowReloadTime -= Time.deltaTime;

        if (stat.IsReload() == true || !iController.GetFireButton())
        {
            return;
        }

        // チョコが0の時
        if (stat.bulletRemain <= 0)
        {
            stat.nowReloadTime = FIX_RELOAD_TIME;
            stat.ResetBullet();
            return;
        }

        // チョコが1以上の時
        // 発射処理
        Vector3    _pos       = this.transform.position + this.transform.forward * 3F + Vector3.up;
        GameObject _objBullet = Instantiate(bulletPrefab, _pos, Quaternion.identity);

        Destroy(_objBullet, 3F);

        // コンポーネントにアタッチ
        ChocoStatics _chocoStat = _objBullet.GetComponent <ChocoStatics>();

        _chocoStat.SetOwnPlayer(stat.playerTag);

        // 力を加える
        Rigidbody rg = _objBullet.GetComponent <Rigidbody>();

        rg.AddForce(this.transform.forward * 20F, ForceMode.Impulse);
        stat.bulletRemain--;
        //SE_BALL.Play();
    }