Esempio n. 1
0
    private void attemptRepair()
    {
        CanvasManager.Instance.HideBottomLeftText();
        Statics.Items[] currItems = PlayerController.Instance.inventory;
        for (int i = 0; i < currRepairItems.Length; i++)
        {
            Statics.Items repairItem = currRepairItems[i];
            if (repairItem != Statics.Items.NONE)
            {
                for (int j = 0; j < currItems.Length; j++)
                {
                    Statics.Items currItem = PlayerController.Instance.inventory[j];
                    if (repairItem == currItem)
                    {
                        StartCoroutine(PlayerController.Instance.FixShit());
                        StartCoroutine(SmokeManager.Instance.StartSmoke());
                        PlayerController.Instance.inventory[j] = Statics.Items.NONE;
                        Destroy(PlayerController.Instance.actualItems[j]);
                        for (int k = j + 1; k < PlayerController.Instance.numItemsHeld; k++)
                        {
                            if (PlayerController.Instance.inventory[k] == Statics.Items.NONE)
                            {
                                break;
                            }
                            PlayerController.Instance.inventory[k - 1]   = PlayerController.Instance.inventory[k];
                            PlayerController.Instance.actualItems[k - 1] = PlayerController.Instance.actualItems[k];
                            PlayerController.Instance.actualItems[k - 1].transform.parent   = PlayerController.Instance.spawnPoints[k - 1];
                            PlayerController.Instance.actualItems[k - 1].transform.position = PlayerController.Instance.spawnPoints[k - 1].position;
                            PlayerController.Instance.actualItems[k - 1].GetComponent <SpriteRenderer>().sortingOrder = k - 1;
                            if (k == PlayerController.Instance.numItemsHeld - 1)
                            {
                                PlayerController.Instance.inventory[k]   = Statics.Items.NONE;
                                PlayerController.Instance.actualItems[k] = null;
                                break;
                            }
                        }
                        PlayerController.Instance.numItemsHeld--;

                        currRepairItems[i] = Statics.Items.NONE;
                        currRepairItemsCount--;

                        Destroy(shownObjects[i]);

                        break;
                    }
                }
            }
        }
    }
Esempio n. 2
0
    public GameObject GetNoBoxObjectFromEnum(Statics.Items item)
    {
        switch (item)
        {
        case Statics.Items.GEAR:
            return(gearNoBox);

        case Statics.Items.SPRING:
            return(springNoBox);

        case Statics.Items.SCREW:
            return(screwNoBox);

        default:
            return(null);
        }
    }
Esempio n. 3
0
    public GameObject GetGameObjectFromEnum(Statics.Items item)
    {
        switch (item)
        {
        case Statics.Items.GEAR:
            return(gear);

        case Statics.Items.SPRING:
            return(spring);

        case Statics.Items.SCREW:
            return(screw);

        case Statics.Items.OIL:
            return(oil);

        default:
            return(null);
        }
    }