示例#1
0
    /*=====================*/
    //  更新関係
    /*=====================*/

    //---横移動関係---//
    void SideMove()
    {
        // 左が押されたとき
        if (Input.GetKey(KeyCode.LeftArrow))
        {
            transform.Translate(g_Move.AccelerateLeft(cf_AccelOnce, cf_MaxSpeed), 0.0f, 0.0f);
            if (n_MortionState != (int)Mortion.Jump)
            {
                n_MortionState = (int)Mortion.Move;
            }
            n_LeftRightFlag = -1;
            SoundSide();
        }

        // 右が押されたとき
        else if (Input.GetKey(KeyCode.RightArrow))
        {
            transform.Translate(g_Move.AccelerateRight(cf_AccelOnce, cf_MaxSpeed), 0.0f, 0.0f);
            if (n_MortionState != (int)Mortion.Jump)
            {
                n_MortionState = (int)Mortion.Move;
            }
            n_LeftRightFlag = 1;

            SoundSide();
        }

        // どちらも押されてないとき
        else
        {
            SideKeyRelease();
        }
    }
示例#2
0
 /*=============================================*/
 // 更新
 /*=============================================*/
 void Update()
 {
     f_Timer += Time.deltaTime;
     //能力発動条件
     if ((f_Timer > cf_Wait) && b_ActiveFlg == false)
     {
         b_ActiveFlg = true;
     }
     //能力終了条件
     if ((f_Timer >= cf_Active) && b_ActiveFlg == true)
     {
         b_ActiveFlg = false;
         f_Timer     = 0.0f;
     }
     //発動処理
     if (b_ActiveFlg == true)
     {
         if (InvicbleFlg == true)                                      //フラグ判定
         {
             if (g_Player.GetComponent <Player>().IsDirection() == -1) //左を向いているとき
             {
                 LeftStep    = true;                                   //左回避フラグ呼び出し
                 InvicbleFlg = false;
             }
             if (g_Player.GetComponent <Player>().IsDirection() == 1) //右を向いているとき
             {
                 RightStep   = true;                                  //右回避フラグ呼びだし
                 InvicbleFlg = false;
             }
         }
     }
     //回避処理
     if (LeftStep == true)//左回避処理
     {
         g_Player.transform.Translate(g_Move.AccelerateLeft(cf_AccelOnce, cf_MaxSpeed), 0.0f, 0.0f);
         framecount++;
         if (framecount < 15)
         {
             g_Player.layer = 10;
         }
         else
         {
             g_Player.layer = 8;
         }
     }
     if (RightStep == true)//右回避処理
     {
         g_Player.transform.Translate(g_Move.AccelerateRight(cf_AccelOnce, cf_MaxSpeed), 0.0f, 0.0f);
         framecount++;
         if (framecount < 15)
         {
             g_Player.layer = 10;
         }
         else
         {
             g_Player.layer = 8;
         }
     }
 }