예제 #1
0
 public void swipe_end(BaseEventData data)
 {
     if (!tap_mode)
     {
         if (swiping)              // avoids unnecesarry triggers when passed over without swiping
         {
             PointerEventData pointer = data as PointerEventData;
             //Debug.Log("x: " + pointer.position.x + ", y: " + pointer.position.y);    //!!!!!! DEBUG STATEMENT !!!!!!
             float delta_x = start_x - pointer.position.x;
             float delta_y = start_y - pointer.position.y;
             if (Mathf.Abs(delta_x) > 50.0f || Mathf.Abs(delta_y) > 50.0f)           // discounts swipes of length < 50
             {
                 if (Mathf.Abs(delta_x) >= Mathf.Abs(delta_y))                       //greater horizontal change (slight bias)
                 {
                     if (delta_x > 0)
                     {
                         Navi.moveLeft();
                     }
                     else
                     {
                         Navi.moveRight();
                     }
                 }
                 else                            // greater vertical change
                 {
                     if (delta_y > 0)
                     {
                         Navi.moveDown();
                     }
                     else
                     {
                         Navi.moveUp();
                     }
                 }
             }
             swiping = false;
         }
     }
 }
예제 #2
0
 public void Left()
 {
     Navi.moveLeft();
 }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown("w"))          // movement
        {
            Navi.moveUp();
        }
        if (Input.GetKeyDown("a"))
        {
            Navi.moveLeft();
        }
        if (Input.GetKeyDown("s"))
        {
            Navi.moveDown();
        }
        if (Input.GetKeyDown("d"))
        {
            Navi.moveRight();
        }
        if (Input.GetKeyDown("space"))          // Buster Press
        {
            Navi.bust_shot();
        }
        if (Input.GetKeyUp("space"))            // Buster Release
        {
            Navi.charge_release();
        }
        if (Input.GetKeyDown("+") || Input.GetKeyDown("="))             // Draw Chip Button
        {
            DrawButton.GetComponent <Draw_Button>().Draw_Chip();
        }

        if (Input.GetKeyDown("left shift") || Input.GetKeyDown("right shift"))          // Navi Power
        {
            Navi.NaviPowerInput();
        }

        if (Input.GetKeyDown("0"))                                     // Chips in hand
        {
            if (Chip_hand.GetComponent <Chip_Hand>().chips[0] != null) // holding a 0 index chip
            {
                Chip_hand.GetComponent <Chip_Hand>().chips[0].GetComponent <BattleChip>().clicked();
            }
        }
        if (Input.GetKeyDown("9"))
        {
            if (Chip_hand.GetComponent <Chip_Hand>().chips[1] != null)             // holding a 1 index chip
            {
                Chip_hand.GetComponent <Chip_Hand>().chips[1].GetComponent <BattleChip>().clicked();
            }
        }
        if (Input.GetKeyDown("8"))
        {
            if (Chip_hand.GetComponent <Chip_Hand>().chips[2] != null)             // holding a 2 index chip
            {
                Chip_hand.GetComponent <Chip_Hand>().chips[2].GetComponent <BattleChip>().clicked();
            }
        }
        if (Input.GetKeyDown("7"))
        {
            if (Chip_hand.GetComponent <Chip_Hand>().chips[3] != null)             // holding a 3 index chip
            {
                Chip_hand.GetComponent <Chip_Hand>().chips[3].GetComponent <BattleChip>().clicked();
            }
        }
        if (Input.GetKeyDown("6"))
        {
            if (Chip_hand.GetComponent <Chip_Hand>().chips[4] != null)             // holding a 4 index chip
            {
                Chip_hand.GetComponent <Chip_Hand>().chips[4].GetComponent <BattleChip>().clicked();
            }
        }
        if (Input.GetKeyDown("5"))
        {
            if (Chip_hand.GetComponent <Chip_Hand>().chips[5] != null)             // holding a 0 index chip
            {
                Chip_hand.GetComponent <Chip_Hand>().chips[5].GetComponent <BattleChip>().clicked();
            }
        }
    }