예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        player = PlayerIndex.One;
        start  = false;

        _stickLeft.Init();
        _stickRight.Init();

        _stickLeft.moveDegree  = 0;
        _stickRight.moveDegree = 0;

        _stickLeft.thrust  = 0;
        _stickRight.thrust = 0;

        _stickLeft.movement  = 0;
        _stickRight.movement = 0;

        _boatRB         = transform.GetComponent <Rigidbody>();
        _boatController = transform.GetComponent <BoatController>();

        _changeSpeed = false;
        //_offsetSpeed = 0.01f;

        _turnSpeed   = 0;
        _reached     = 0;
        _vibrateFlag = false;
        _oldFlag     = false;
        _newFlag     = false;
        isHit        = false;

        if (fakeL == null || fakeR == null)
        {
            Debug.Log("Fake is missing");
        }
    }
예제 #2
0
    private void Awake()
    {
        if (Instance == null)
        {
            string contName = "";
            for (int i = 0; i < Input.GetJoystickNames().Length; i++)
            {
                if (Input.GetJoystickNames()[i] != "")
                {
                    contName = Input.GetJoystickNames()[i];
                    break;
                }
            }

            //Debug.Log("接続しているコントローラーは " + contName + " です。");
            stick.Init();
            button.Init();
            buttonDown.Init();
            IsPS4Controller = !(contName == "Controller (XBOX 360 For Windows)");
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }