Пример #1
0
    private void PickPaper(ThrowDir dir)
    {
        int pickedPaperCount = 0;

        pickedPapers = Instantiate(prefabPickedPapers, new Vector2(0, 0), Quaternion.identity);
        pickedPapers.GetComponent <PickedPapers>().Direction = dir;
        List <Transform> papers = transform.Cast <Transform>().ToList();

        int i = 0;

        for (i = 0; i < papers.Count; i++)
        {
            if (pickedPaper.GetInstanceID() == papers[i].gameObject.GetInstanceID())
            {
                break;
            }

            if (i >= papers.Count)
            {
                return;
            }
        }

        for (; i >= 0; i--)
        {
            papers[i].parent = pickedPapers.transform;
            papers[i].GetComponent <SpriteRenderer>().sortingOrder = 0;
            pickedPaperCount++;
        }
        pickedPaper = null;

        paperReferee.CheckWhereToGo(dir, pickedPaperCount);
    }
Пример #2
0
 public void Throw(float v_h, bool isTopKeyDown, bool isBottomKeyDown)
 {
     throwing = true;
     //获得扔手榴弹的方向
     if (isTopKeyDown == false && isBottomKeyDown == false)
     {
         if (transform.localScale.x == 1)
         {
             throwDir = ThrowDir.Left;
         }
         else if (transform.localScale.x == -1)
         {
             throwDir = ThrowDir.Right;
         }
     }
     else
     {
         if (isTopKeyDown)
         {
             throwDir = ThrowDir.Top;
         }
         else if (isBottomKeyDown)
         {
             throwDir = ThrowDir.Down;
         }
     }
 }
Пример #3
0
    public void Throw(float v_h, bool isTopKeyDown, bool isBottomKeyDown)
    {
        throwing = true;
        //获得扔手榴弹的方向

        //得到射击的方向
        if (isBottomKeyDown)
        {
            if (transform.localScale.x == 1)
            {
                throwDir = ThrowDir.Left;
            }
            else if (transform.localScale.x == -1)
            {
                throwDir = ThrowDir.Right;
            }
            if (isTopKeyDown)
            {
                throwDir = ThrowDir.Top;
            }
        }
        //if (isTopKeyDown == false && isBottomKeyDown == false)
        //{
        //    if (transform.localScale.x == 1)
        //    {
        //        throwDir = ThrowDir.Left;
        //    }
        //    else if (transform.localScale.x == -1)
        //    {
        //        throwDir = ThrowDir.Right;
        //    }
        //}
        //else
        //{
        //    if (isTopKeyDown)
        //    {
        //        throwDir = ThrowDir.Top;
        //    }
        //    else if (isBottomKeyDown)
        //    {
        //        throwDir = ThrowDir.Down;
        //    }
        //}
    }
Пример #4
0
    public void CheckWhereToGo(ThrowDir dir, int throwedPaperCount)
    {
        int result;

        switch (dir)
        {
        case ThrowDir.Left:
            result = requiredPaperLeft.GetComponent <RequiredPaper>().CheckThrowedPapers(throwedPaperCount);
            break;

        default:
            result = 0;
            break;
        }

        if (result > 0)
        {
            StageManager.score += result;
        }
    }
Пример #5
0
 public void Throw(float v_h, bool isTopKeyDown, bool isBottomKeyDown)
 {
     throwing = true;
     //获得扔手榴弹的方向
     if (isTopKeyDown == false && isBottomKeyDown == false)
     {
         if (transform.localScale.x == 1)
         {
             throwDir = ThrowDir.Left;
         }
         else if (transform.localScale.x == -1)
         {
             throwDir = ThrowDir.Right;
         }
     }
     else
     {
         if (isTopKeyDown )
         {
             throwDir = ThrowDir.Top;
         }
         else if (isBottomKeyDown)
         {
             throwDir = ThrowDir.Down;
         }
     }
 }
Пример #6
0
    public void Throw(float v_h, bool isTopKeyDown, bool isBottomKeyDown)
    {
        throwing = true;
        //获得扔手榴弹的方向

        //得到射击的方向
        if (isBottomKeyDown)
        {
            if (transform.localScale.x == 1)
            {
                throwDir = ThrowDir.Left;
            }
            else if (transform.localScale.x == -1)
            {
                throwDir = ThrowDir.Right;
            }
            if (isTopKeyDown)
            {
                throwDir = ThrowDir.Top;
            }
        }
        //if (isTopKeyDown == false && isBottomKeyDown == false)
        //{
        //    if (transform.localScale.x == 1)
        //    {
        //        throwDir = ThrowDir.Left;
        //    }
        //    else if (transform.localScale.x == -1)
        //    {
        //        throwDir = ThrowDir.Right;
        //    }
        //}
        //else
        //{
        //    if (isTopKeyDown)
        //    {
        //        throwDir = ThrowDir.Top;
        //    }
        //    else if (isBottomKeyDown)
        //    {
        //        throwDir = ThrowDir.Down;
        //    }
        //}
    }