Example #1
0
    void Update()
    {
        if (!b_Start)
        {
            return;
        }

        if (i_Cnt > CNT_MAX)
        {
            g_Boss.GetComponent <Pop>().PopAnime();
            g_Player.GetComponent <Animator>().Play("Stay");
            GameObject g_wall = GameObject.Find("BossLeft");
            g_wall.GetComponent <Rigidbody2D>().simulated = true;

            GameObject g_Rightwall = GameObject.Find("BossRight");
            g_Rightwall.GetComponent <Rigidbody2D>().simulated = true;

            return;
        }
        else
        {
            g_Player.transform.Translate(g_Move.AccelerateRight(cf_AccelOnce, cf_MaxSpeed), 0.0f, 0.0f);
            Vector3 v_PlayerPos = g_Player.transform.position;

            g_Cam.transform.position = new Vector3(v_PlayerPos.x + f_Dis, v_PlayerPos.y + 3.0f, g_Cam.transform.position.z);

            g_TopBar.transform.position    -= new Vector3(0.0f, BAR_MOVE, 0.0f);
            g_BottomBar.transform.position += new Vector3(0.0f, BAR_MOVE, 0.0f);

            i_Cnt++;
            f_Dis += 0.05f;
        }
    }
Example #2
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();
        }
    }
Example #3
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;
         }
     }
 }