Ejemplo n.º 1
0
    public void ArcadeControlIcon_PVP(int num)
    {
        //アケコン
        if (num == 1)
        {
            if (SceneManager.GetActiveScene().name == "SelectScene")
            {
                if (controlFlag1P)
                {
                    if (Input.GetButtonDown("AButton"))
                    {
                        controlFlag1P = false;

                        if (select.GetCharName() == "Aoi")
                        {
                            aoiModel.transform.position = new Vector3(-modelPosX, modelPosY, 0);
                            Instantiate(aoiModel);
                        }
                        else if (select.GetCharName() == "Hikari")
                        {
                            hikariModel2.transform.position = new Vector3(-modelPosX, modelPosY, 0);
                            Instantiate(hikariModel);
                        }
                        else
                        {
                            controlFlag1P = true;
                        }
                    }
                    // 移動キーを押していなければ何もしない
                    if (GamePad.GetAxis(GamePad.Axis.LeftStick, GamePad.Index.One).x == 0.0f && GamePad.GetAxis(GamePad.Axis.LeftStick, GamePad.Index.One).y == 0.0f)
                    {
                        return;
                    }
                    // 移動先を計算
                    pos += new Vector2(GamePad.GetAxis(GamePad.Axis.LeftStick, GamePad.Index.One).x *iconSpeed, GamePad.GetAxis(GamePad.Axis.LeftStick, GamePad.Index.One).y *iconSpeed) * Time.deltaTime;
                    // アイコン位置を設定
                    transform.localPosition = pos;
                }
                else
                {
                    sceneFlag1 = false;
                }
            }
        }
        else
        {
            if (controlFlag2P)
            {
                if (Input.GetButtonDown("AButton2"))
                {
                    controlFlag2P = false;

                    if (select.GetCharName() == "Aoi")
                    {
                        aoiModel2.transform.position = new Vector3(modelPosX, modelPosY, 0);
                        Instantiate(aoiModel2);
                        Debug.Log("2PAOI");
                        controlFlag2P = false;
                    }
                    else if (select.GetCharName() == "Hikari")
                    {
                        hikariModel2.transform.position = new Vector3(modelPosX, modelPosY, 0);
                        Instantiate(hikariModel2);
                        Debug.Log("2PHIAKRI");
                        controlFlag2P = false;
                        Debug.Log(controlFlag2P);
                    }
                    else
                    {
                        controlFlag2P = true;
                    }
                }

                // 移動キーを押していなければ何もしない
                if (GamePad.GetAxis(GamePad.Axis.LeftStick, GamePad.Index.One).x == 0.0f && GamePad.GetAxis(GamePad.Axis.LeftStick, GamePad.Index.One).y == 0.0f)
                {
                    return;
                }
                // 移動先を計算
                pos += new Vector2(GamePad.GetAxis(GamePad.Axis.LeftStick, GamePad.Index.One).x *iconSpeed, GamePad.GetAxis(GamePad.Axis.LeftStick, GamePad.Index.One).y *iconSpeed) * Time.deltaTime;
                // アイコン位置を設定
                transform.localPosition = pos;
            }
            else
            {
                sceneFlag2 = false;
            }
        }
    }