public void SettingChange()
    {
        if (canUseAxis)
        {
            if ((XCI.GetAxisRaw(XboxAxis.LeftStickX, XboxController.First) == 1 || KCI.GetAxisRaw(KeyboardAxis.Horizontal, KeyboardController.First) == 1) && numberRound < maxValue)
            {
                canUseAxis = false;
                numberRound++;
                GameObject.Find("AudioHandler").GetComponent <AudioBehaviour> ().audios [5].Play();
                SettingText();
            }
            if ((XCI.GetAxisRaw(XboxAxis.LeftStickX, XboxController.All) == -1 || KCI.GetAxisRaw(KeyboardAxis.Horizontal, KeyboardController.First) == -1) && numberRound > minValue)
            {
                canUseAxis = false;
                numberRound--;
                GameObject.Find("AudioHandler").GetComponent <AudioBehaviour> ().audios [5].Play();
                SettingText();
            }
        }

        if (XCI.GetAxisRaw(XboxAxis.LeftStickX, XboxController.First) == 0 && KCI.GetAxisRaw(KeyboardAxis.Horizontal, KeyboardController.First) == 0)
        {
            canUseAxis = true;
        }
    }
示例#2
0
    void FixedUpdate()
    {
        float moveX = KCI.GetAxisRaw(KeyboardAxis.Horizontal, Kcontroller);
        float moveY = KCI.GetAxisRaw(KeyboardAxis.Vertical, Kcontroller);

        if (moveX > 0.1f && canControl)
        {
            rb.velocity = new Vector2(moveX * maxWalkSpeed, rb.velocity.y);
            //angle = 90;
        }
        if (moveX < -0.1f && canControl)
        {
            rb.velocity = new Vector2(moveX * maxWalkSpeed, rb.velocity.y);
            //angle = 270;
        }
        if (moveX == 0)
        {
            rb.velocity = new Vector2(0, rb.velocity.y);
        }
        if (moveY > 0.1f && canControl)
        {
            rb.velocity = new Vector2(rb.velocity.x, moveY * maxWalkSpeed);
            //angle = 180;
        }
        if (moveY < -0.1f && canControl)
        {
            rb.velocity = new Vector2(rb.velocity.x, moveY * maxWalkSpeed);
        }
        if (moveY == 0 && canControl)
        {
            rb.velocity = new Vector2(rb.velocity.x, 0);
        }
    }
示例#3
0
 void Walk()
 {
     if (isKeyboard)
     {
         input = new Vector2(KCI.GetAxisRaw(KeyboardAxis.Horizontal, Kcontroller), KCI.GetAxisRaw(KeyboardAxis.Vertical, Kcontroller));
     }
     else
     {
         input = new Vector2(XCI.GetAxisRaw(XboxAxis.LeftStickX, Xcontroller), XCI.GetAxisRaw(XboxAxis.LeftStickY, Xcontroller));
     }
 }
示例#4
0
 void Pivot()
 {
     if (KCI.GetAxisRaw(KeyboardAxis.Horizontal, Kcontroller) == 1)
     {
         transform.rotation = Quaternion.Euler(0, 0, 0);
         shootDir           = 1;
     }
     else if (KCI.GetAxisRaw(KeyboardAxis.Horizontal, Kcontroller) == -1)
     {
         transform.rotation = Quaternion.Euler(0, 0, 180);
         shootDir           = 2;
     }
     else if (KCI.GetAxisRaw(KeyboardAxis.Vertical, Kcontroller) == 1)
     {
         transform.rotation = Quaternion.Euler(0, 0, 90);
         shootDir           = 3;
     }
     else if (KCI.GetAxisRaw(KeyboardAxis.Vertical, Kcontroller) == -1)
     {
         transform.rotation = Quaternion.Euler(0, 0, 270);
         shootDir           = 4;
     }
 }
示例#5
0
 void Passing()
 {
     if (!isKeyboard && isSet && !ready)
     {
         if (XCI.GetAxisRaw(XboxAxis.LeftStickX, Xcontroller) == 1f && canUseAxis)
         {
             canUseAxis = false;
             ChangeCurrentSprite("next");
         }
         else if (XCI.GetAxisRaw(XboxAxis.LeftStickX, Xcontroller) == -1f && canUseAxis)
         {
             canUseAxis = false;
             ChangeCurrentSprite("previous");
         }
         else if (XCI.GetAxisRaw(XboxAxis.LeftStickX, Xcontroller) == 0f)
         {
             canUseAxis = true;
         }
     }
     else if (isKeyboard && isSet && !ready)
     {
         if (KCI.GetAxisRaw(KeyboardAxis.Horizontal, Kcontroller) == 1f && canUseAxis)
         {
             canUseAxis = false;
             ChangeCurrentSprite("next");
         }
         else if (KCI.GetAxisRaw(KeyboardAxis.Horizontal, Kcontroller) == -1f && canUseAxis)
         {
             canUseAxis = false;
             ChangeCurrentSprite("previous");
         }
         else if (KCI.GetAxisRaw(KeyboardAxis.Horizontal, Kcontroller) == 0f)
         {
             canUseAxis = true;
         }
     }
 }
示例#6
0
    void Update()
    {
        float moveX    = KCI.GetAxisRaw(KeyboardAxis.Horizontal, Kcontroller);
        float moveY    = KCI.GetAxisRaw(KeyboardAxis.Vertical, Kcontroller);
        float pivotDir = pivot.transform.rotation.eulerAngles.z;

        dir = (-1 < pivotDir && pivotDir < 1) ? "right" : (179 < pivotDir && pivotDir < 181) ? "left" : dir;

        print(dir);

        idle = (moveX == 0 && moveY == 0);

        if (idle)
        {
            if (dir == "left")
            {
                GetComponent <Animator> ().Play("IdleBack");
            }
            else
            {
                GetComponent <Animator> ().Play("Idle");
            }
        }
        else
        {
            if (moveX != 0 && moveY == 0)
            {
                if ((Input.GetKey(KeyCode.A) && Kcontroller.ToString() == "First") || (Input.GetKey(KeyCode.LeftArrow) && Kcontroller.ToString() == "Second"))
                {
                    GetComponent <Animator> ().Play("WalkingLeft");
                }
                else if ((Input.GetKey(KeyCode.D) && Kcontroller.ToString() == "First") || (Input.GetKey(KeyCode.RightArrow) && Kcontroller.ToString() == "Second"))
                {
                    GetComponent <Animator> ().Play("WalkingRight");
                }
            }
            else if (moveX == 0 && moveY != 0)
            {
                if (moveY > 0)
                {
                    if (dir == "right")
                    {
                        GetComponent <Animator> ().Play("WalkingUpRight");
                    }
                    if (dir == "left")
                    {
                        GetComponent <Animator> ().Play("WalkingUpLeft");
                    }
                }
                else
                {
                    if (dir == "right")
                    {
                        GetComponent <Animator> ().Play("WalkingRight");
                    }
                    if (dir == "left")
                    {
                        GetComponent <Animator> ().Play("WalkingLeft");
                    }
                }
            }
        }
    }