Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        leftLimitQ  = Quaternion.Euler(0f, 0f, leftLimit);
        rightLimitQ = Quaternion.Euler(0f, 0f, rightLimit);

        xInput = GameObject.FindWithTag("Xbox Input").GetComponent <XboxInput> ();
    }
Exemplo n.º 2
0
    void Start()
    {
        currentColor    = GameVariables.availableColors [0];
        currentBonus    = GameVariables.bonus [0];
        changedRecently = false;

        //All images which need to be recolored according to player selection
        imagesToColor = new List <Image> ();
        imagesToColor.Add(transform.FindChild("ColorSelection").GetComponentInChildren <Image> ());
        //imagesToColor.Add( transform.FindChild ("enabled").GetComponentInChildren<Image> ());
        bonusGO    = transform.FindChild("Bonus").gameObject;
        bonusImage = bonusGO.GetComponentInChildren <Image> ();
        colorImages();
        bonusImages();
        playText = GameObject.Find("Play").GetComponent <Text>();

        if (nbReady < GameObject.Find("CheckNewControllers").transform.GetComponent <CheckNewControllers> ().GetNbPlayers())
        {
            playText.enabled = false;
        }

        //Different states of validation
        currentState = 0;
        text         = transform.FindChild("InstructionsPanel/Instructions").GetComponent <Text> ();
        textState    = new List <string> ()
        {
            "Choose Color", "Choose Bonus", "Ready ?", "Ready !"
        };
        maxState  = textState.Count;
        text.text = textState [currentState];

        xboxInput = new XboxInput(playerControllerId);
    }
Exemplo n.º 3
0
 public override void SendInput(XboxInput input)
 {
     SetValueIfNeeded(Xbox360Button.A, input.A);
     SetValueIfNeeded(Xbox360Button.B, input.B);
     SetValueIfNeeded(Xbox360Button.X, input.X);
     SetValueIfNeeded(Xbox360Button.Y, input.Y);
     SetValueIfNeeded(Xbox360Button.LeftShoulder, input.L1);
     SetValueIfNeeded(Xbox360Button.RightShoulder, input.R1);
     SetValueIfNeeded(Xbox360Button.LeftThumb, input.L3);
     SetValueIfNeeded(Xbox360Button.RightThumb, input.R3);
     SetValueIfNeeded(Xbox360Button.Back, input.Back);
     SetValueIfNeeded(Xbox360Button.Start, input.Start);
     SetValueIfNeeded(Xbox360Button.Guide, input.Home);
     SetValueIfNeeded(Xbox360Button.Up, input.Up);
     SetValueIfNeeded(Xbox360Button.Down, input.Down);
     SetValueIfNeeded(Xbox360Button.Left, input.Left);
     SetValueIfNeeded(Xbox360Button.Right, input.Right);
     SetValueIfNeeded(Xbox360Axis.LeftThumbX, input.LX);
     SetValueIfNeeded(Xbox360Axis.LeftThumbY, input.LY);
     SetValueIfNeeded(Xbox360Axis.RightThumbX, input.RX);
     SetValueIfNeeded(Xbox360Axis.RightThumbY, input.RY);
     SetValueIfNeeded(Xbox360Slider.LeftTrigger, input.L2);
     SetValueIfNeeded(Xbox360Slider.RightTrigger, input.R2);
     controller.SubmitReport();
 }
Exemplo n.º 4
0
 public override void SendInput(XboxInput input)
 {
     SetValueIfNeeded(2, 0, input.UP);
     SetValueIfNeeded(2, 1, input.DOWN);
     SetValueIfNeeded(2, 2, input.LEFT);
     SetValueIfNeeded(2, 3, input.RIGHT);
     SetValueIfNeeded(2, 4, input.Start);
     SetValueIfNeeded(2, 5, input.Back);
     SetValueIfNeeded(2, 6, input.L3);
     SetValueIfNeeded(2, 7, input.R3);
     SetValueIfNeeded(3, 0, input.L1);
     SetValueIfNeeded(3, 1, input.R1);
     SetValueIfNeeded(3, 2, input.Home);
     SetValueIfNeeded(3, 4, input.A);
     SetValueIfNeeded(3, 5, input.B);
     SetValueIfNeeded(3, 6, input.X);
     SetValueIfNeeded(3, 7, input.Y);
     SetValueIfNeeded(4, input.L2);
     SetValueIfNeeded(5, input.R2);
     SetValueIfNeeded(6, 7, input.LX);
     SetValueIfNeeded(8, 9, input.LY);
     SetValueIfNeeded(10, 11, input.RX);
     SetValueIfNeeded(12, 13, input.RY);
     client.Report(controllerCount, report);
 }
Exemplo n.º 5
0
    void Start()
    {
        // clear round values for this player
        human.startNewRound();
        modeDirection = 1;
        movementSpeed = GameVariables.charactersSpeed;

        //Set orientation
        leftOrientationScale    = transform.localScale;
        rightOrientationScale   = transform.localScale;
        rightOrientationScale.x = rightOrientationScale.x * -1;
        xboxInput         = new XboxInput(human.getJoystickId());
        mapCollider       = GameObject.FindGameObjectWithTag("Map").GetComponentInChildren <Collider2D> ();
        groundPosition    = transform.FindChild("GroundCheck");
        rendererContainer = transform.FindChild("Renderers");

        Debug.Log("Bonus_JoystickId" + human.getJoystickId());
        bonus     = GameObject.Find("Bonus_JoystickId" + human.getJoystickId()).gameObject;
        bonusUsed = false;

        rgdby             = gameObject.GetComponent <Rigidbody2D> ();
        animatorsBody     = new List <Animator> ();
        animatorsArm      = new List <Animator> ();
        animatorsArmKnife = new List <Animator> ();
        for (int i = 0; i < rendererContainer.childCount; i++)
        {
            animatorsBody.Add(rendererContainer.GetChild(i).GetComponent <Animator> ());
            animatorsArm.Add(rendererContainer.GetChild(i).FindChild("arm").GetComponent <Animator> ());
            animatorsArmKnife.Add(rendererContainer.GetChild(i).FindChild("armKnife").GetComponent <Animator> ());
        }
    }
    // Use this for initialization
    void Start()
    {
        openRotation              = Quaternion.Euler(303.37f, 180f, 180f);
        closedRotation            = Quaternion.Euler(360f, 180f, 180f);
        blockTarget.localPosition = Vector3.zero;

        xInput = GameObject.FindWithTag("Xbox Input").GetComponent <XboxInput> ();
    }
Exemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        velocity        = new Vector3(0, 0, 0);
        angularVelocity = 0.0f;

        drive.drive = GameObject.FindWithTag("Drive");

        xInput = GameObject.FindWithTag("Xbox Input").GetComponent <XboxInput> ();
    }
Exemplo n.º 8
0
 void Start()
 {
     this.MAX_OPERATING_TIME_FPS = MAX_OPERATING_TIME * 60;             // ロボットの稼働時間(フレーム単位変換)
     this.lifeTime    = MAX_OPERATING_TIME_FPS;
     this.rigidBody   = GetComponent <Rigidbody>();
     this.animator    = GetComponent <Animator>();
     this.image       = gauge.GetComponent <Image>();
     this.xboxInput   = new XboxInput();
     this.playerState = PLAYER_STATE._MOVE;
 }
Exemplo n.º 9
0
    void Start()
    {
        stageHeights = new float[numStages];

        for (int i = 0; i < numStages; i++)
        {
            stageInitials[i] = stages[i];
        }

        xInput = GameObject.FindWithTag("Xbox Input").GetComponent <XboxInput> ();
    }
Exemplo n.º 10
0
 // Update is called once per frame
 void Update()
 {
     if (Application.loadedLevel == 1 || Application.loadedLevel == 2)
     {
         xInput = GameObject.FindWithTag("Xbox Input").GetComponent <XboxInput>();
         if (Input.GetButtonDown("Pause") || xInput.GetButtonDown("Start"))
         {
             Application.LoadLevel(0);
         }
     }
 }
Exemplo n.º 11
0
    private void Initialize()
    {
        // Create instance, or destroy self if duplicate
        if (singleton != null)
        {
            Destroy(this.gameObject);
            return;
        }
        singleton = this;
        DontDestroyOnLoad(this.gameObject);

        _gamePadStates        = new GamePadStates[] { new GamePadStates(), new GamePadStates(), new GamePadStates(), new GamePadStates() };
        _controllerVibrations = new float[] { 0, 0, 0, 0 };
    }
Exemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        initialPosition = new Vector3(
            transform.position.x,
            transform.position.y,
            transform.position.z);
        initialRotation = new Quaternion(
            transform.rotation.x,
            transform.rotation.y,
            transform.rotation.z,
            transform.rotation.w);

        chaser         = GetComponent <TargetChaser> ();
        chaser.enabled = false;

        xInput = GameObject.FindWithTag("Xbox Input").GetComponent <XboxInput> ();
    }
Exemplo n.º 13
0
    /// <summary>
    /// XBoxの入力
    /// </summary>
    /// <param name="_Index">コントローラーの番号</param>
    /// <param name="_Button">ボタン</param>
    /// <returns>入力されているかどうか</returns>
    static bool InputXboxButton(int _Index, XboxInput _Button)
    {
        const int addNum = KeyCode.Joystick2Button0 - KeyCode.Joystick1Button0;

        switch (_Button)
        {
        case XboxInput.Up:
            return(Input.GetKey(KeyCode.Joystick1Button3 + _Index * addNum));

        case XboxInput.Down:
            return(Input.GetKey(KeyCode.Joystick1Button0 + _Index * addNum));

        case XboxInput.Right:
            return(Input.GetKey(KeyCode.Joystick1Button1 + _Index * addNum));

        case XboxInput.Left:
            return(Input.GetKey(KeyCode.Joystick1Button2 + _Index * addNum));

        case XboxInput.SR:
            return(Input.GetKey(KeyCode.Joystick1Button5 + _Index * addNum));

        case XboxInput.SL:
            return(Input.GetKey(KeyCode.Joystick1Button4 + _Index * addNum));

        case XboxInput.StickUp:
            return(Input.GetAxisRaw("Vertical" + (_Index + 1).ToString()) > 0);

        case XboxInput.StickDown:
            return(Input.GetAxisRaw("Vertical" + (_Index + 1).ToString()) < 0);

        case XboxInput.StickRight:
            return(Input.GetAxisRaw("Horizontal" + (_Index + 1).ToString()) > 0);

        case XboxInput.StickLeft:
            return(Input.GetAxisRaw("Horizontal" + (_Index + 1).ToString()) < 0);

        case XboxInput.Pause:
            return(Input.GetKey(KeyCode.Joystick1Button7 + _Index * addNum));

        default:
            return(false);
        }
    }
Exemplo n.º 14
0
    private bool GetButtonDown(ButtonSet.ButtonCascade buttonCascade)
    {
        try
        {
            if (UnityEngine.Input.GetButtonDown(buttonCascade.pcName))
            {
                return(true);
            }
        }
        catch (System.Exception) { }

        if (XboxInput.GetButtonDown(_inputId, buttonCascade.xboxButton))
        {
            return(true);
        }
        if (UIInput.GetButtonDown(buttonCascade.uIButton))
        {
            return(true);
        }
        return(false);
    }
Exemplo n.º 15
0
    private float GetAxis(AxisSet.AxisCascade axisCascade)
    {
        float value = 0;

        try
        {
            value += UnityEngine.Input.GetAxis(axisCascade.pcName);
        }
        catch (System.Exception)
        {
            try
            {
                value += UnityEngine.Input.GetButton(axisCascade.pcName) ? 1 : 0;
            }
            catch (System.Exception)
            {
            }
        }

        value += XboxInput.GetAxis(_inputId, axisCascade.xboxAxis);
        value += UIInput.GetAxis(axisCascade.uIAxis);

        return(Mathf.Clamp(value, -1, 1));
    }
Exemplo n.º 16
0
    // Use this for initialization
    void Start()
    {
        xInput = GameObject.FindWithTag("Xbox Input").GetComponent <XboxInput> ();

        clampState = (int)ClampStates.CLOSED;
    }
Exemplo n.º 17
0
 void Start()
 {
     this.xboxInput = new XboxInput();
     //this.startCamera = GameObject.Find("StartCamera");
 }
Exemplo n.º 18
0
    /// <summary>
    /// XBoxの入力
    /// </summary>
    /// <param name="index">コントローラーの番号</param>
    /// <param name="button">ボタン</param>
    /// <returns>入力されているかどうか</returns>
    static bool InputXboxButton(int index, XboxInput button)
    {
        const int AddNum = KeyCode.Joystick2Button0 - KeyCode.Joystick1Button0;

        switch (button)
        {
        case XboxInput.Up:
            return(Input.GetKey(KeyCode.Joystick1Button3 + index * AddNum) ||
                   (index == 0 && Input.GetKey(KeyCode.UpArrow)));

        case XboxInput.Down:
            return(Input.GetKey(KeyCode.Joystick1Button0 + index * AddNum) ||
                   (index == 0 && Input.GetKey(KeyCode.DownArrow)));

        case XboxInput.Right:
            return(Input.GetKey(KeyCode.Joystick1Button1 + index * AddNum) ||
                   (index == 0 && Input.GetKey(KeyCode.RightArrow)));

        case XboxInput.Left:
            return(Input.GetKey(KeyCode.Joystick1Button2 + index * AddNum) ||
                   (index == 0 && Input.GetKey(KeyCode.LeftArrow)));

        case XboxInput.SR:
            return(Input.GetKey(KeyCode.Joystick1Button5 + index * AddNum) ||
                   (index == 0 && Input.GetKey(KeyCode.E)));

        case XboxInput.SL:
            return(Input.GetKey(KeyCode.Joystick1Button4 + index * AddNum) ||
                   (index == 0 && Input.GetKey(KeyCode.Q)));

        case XboxInput.StickUp:
            return(Input.GetAxisRaw("Vertical" + (index + 1).ToString()) > DeadZone ||
                   (index == 0 && Input.GetKey(KeyCode.W)));

        case XboxInput.StickDown:
            return(Input.GetAxisRaw("Vertical" + (index + 1).ToString()) < -DeadZone ||
                   (index == 0 && Input.GetKey(KeyCode.S)));

        case XboxInput.StickRight:
            return(Input.GetAxisRaw("Horizontal" + (index + 1).ToString()) > DeadZone ||
                   (index == 0 && Input.GetKey(KeyCode.D)));

        case XboxInput.StickLeft:
            return(Input.GetAxisRaw("Horizontal" + (index + 1).ToString()) < -DeadZone ||
                   (index == 0 && Input.GetKey(KeyCode.A)));

        case XboxInput.Pause:
            return(Input.GetKey(KeyCode.Joystick1Button7 + index * AddNum) ||
                   (index == 0 && Input.GetKey(KeyCode.Alpha1)));

        case XboxInput.Stick:
            return(Input.GetKey(KeyCode.Joystick1Button8 + index * AddNum) ||
                   Input.GetKey(KeyCode.Joystick1Button9 + index * AddNum) ||
                   (index == 0 && Input.GetKey(KeyCode.Space)));

        case XboxInput.Trigger:
            return(Input.GetKey(KeyCode.JoystickButton4 + index * AddNum) ||
                   Input.GetKey(KeyCode.Joystick1Button5 + index * AddNum) ||
                   (index == 0 && Input.GetKey(KeyCode.T)));

        case XboxInput.ZTrigger:
            return(Mathf.Abs(Input.GetAxisRaw("Ztrigger" + (index + 1).ToString())) > DeadZone ||
                   (index == 0 && Input.GetKey(KeyCode.Z)));

        default:
            return(false);
        }
    }
Exemplo n.º 19
0
 void Start()
 {
     this.xboxInput   = new XboxInput();
     this.startCamera = GameObject.FindWithTag("StartCamera");
 }
Exemplo n.º 20
0
 void Start()
 {
     xInput = GameObject.FindWithTag("Xbox Input").GetComponent <XboxInput> ();
 }