Beispiel #1
0
 public void CheckUsefulItems(GameItem.ItemType item)
 {
     if (item == GameItem.ItemType.Salami)
     {
         UnlockInteractableProgress.Instance.salami = true;
     }
     if (item == GameItem.ItemType.Flour)
     {
         UnlockInteractableProgress.Instance.flour = true;
     }
     if (item == GameItem.ItemType.Cheese)
     {
         UnlockInteractableProgress.Instance.cheese = true;
     }
     if (item == GameItem.ItemType.Tomato)
     {
         UnlockInteractableProgress.Instance.tomato = true;
     }
     if (item == GameItem.ItemType.FullBottle)
     {
         UnlockInteractableProgress.Instance.water = true;
     }
     if (item == GameItem.ItemType.Pizza)
     {
         UnlockInteractableProgress.Instance.isPizzaGot = true;
     }
 }
Beispiel #2
0
    public List<GameObject> GetNextItems()
    {
        List<GameObject> listG0 = new List<GameObject> ();
        LevelItem levelItem = null;
        do {
            float randValue = UnityEngine.Random.Range(0.0f, 100.0f);
            float currValue = 0.0f;
            for (int iItem = 0; iItem < levelItems.Count && levelItem == null; iItem++) {
                currValue += levelItems [iItem].frequency;
                if (randValue <= currValue)
                    levelItem = levelItems [iItem];
            }
            if(levelItem.itemType ==  lastItem)
                levelItem = null;
        } while (levelItem == null);

        lastItem = levelItem.itemType;

        int rows = UnityEngine.Random.Range(levelItem.nMinRows, levelItem.nMaxRows + 1);
        lastPos += levelItem.roomBeforeItem;
        for(int iRow = 0; iRow < rows; iRow++) {
            GameObject go = GameObject.Instantiate(levelItem.gameObject, new Vector3(0, 0, lastPos), Quaternion.identity) as GameObject;
            lastPos += levelItem.roomBetweenRows;
            listG0.Add(go);
        }

        return listG0;
    }
Beispiel #3
0
    public void AddItem(GameItem.ItemType type)
    {
        GameItem item = new GameItem();

        item.itemType = type;

        CheckUsefulItems(type);

        AddItem(item);
    }
Beispiel #4
0
 public void RemoveItemByType(GameItem.ItemType type)
 {
     for (int i = 0; i < _itemList.Count; i++)
     {
         if (_itemList[i].itemType == type)
         {
             RemoveItem(i);
             break;
         }
     }
 }
Beispiel #5
0
    public void ResetSelectedItem(bool withUi = true)
    {
        followCursorItem.SetActive(false);
        Debug.Log("Reset Selected Item");
        chosenItemIndex = -1;
        chosenItem      = GameItem.ItemType.None;

        if (withUi)
        {
            UiInventory.CloseInventory();
        }
    }
    public override Reaction GetNextReaction()
    {
        GameItem.ItemType item = GameManager.Instance.chosenItem;
        if (item == GameItem.ItemType.EmptyBottle)
        {
            return(progress[1]);
        }
        else if (item != GameItem.ItemType.None)
        {
            return(ReactionAssets.Instance.notMatchItemReaction);
        }

        return(progress[0]);
    }
Beispiel #7
0
    public Sprite GetSpriteByItemType(GameItem.ItemType type)
    {
        switch (type)
        {
        case GameItem.ItemType.Rock: return(rockSprite);

        case GameItem.ItemType.Coin: return(coinSprite);

        case GameItem.ItemType.Beer: return(beerSprite);

        case GameItem.ItemType.Stick: return(stickSprite);

        case GameItem.ItemType.EmptyBottle: return(emptyBottle);

        case GameItem.ItemType.FullBottle: return(fullBottle);

        case GameItem.ItemType.Cheese: return(cheeseSprite);

        case GameItem.ItemType.Bun: return(bunSprite);

        case GameItem.ItemType.Gas: return(gasSprite);

        case GameItem.ItemType.Pie: return(pieSprite);

        case GameItem.ItemType.Pizza: return(pizzaSprite);

        case GameItem.ItemType.Flour: return(flourSprite);

        case GameItem.ItemType.Salami: return(salamiSprite);

        case GameItem.ItemType.CasinoCoin: return(casinoCoinSprite);

        case GameItem.ItemType.Tomato: return(tomatoSprite);

        case GameItem.ItemType.Magnet: return(magnetSprite);

        case GameItem.ItemType.MagnetAndCoin: return(magnetAndCoinSprite);

        default: return(rockSprite);
        }
    }
Beispiel #8
0
    public List <GameObject> GetNextItems()
    {
        List <GameObject> listG0    = new List <GameObject> ();
        LevelItem         levelItem = null;

        do
        {
            float randValue = UnityEngine.Random.Range(0.0f, 100.0f);
            float currValue = 0.0f;
            for (int iItem = 0; iItem < levelItems.Count && levelItem == null; iItem++)
            {
                currValue += levelItems [iItem].frequency;
                if (randValue <= currValue)
                {
                    levelItem = levelItems [iItem];
                }
            }
            if (levelItem.itemType == lastItem)
            {
                levelItem = null;
            }
        } while (levelItem == null);

        lastItem = levelItem.itemType;

        int rows = UnityEngine.Random.Range(levelItem.nMinRows, levelItem.nMaxRows + 1);

        lastPos += levelItem.roomBeforeItem;
        for (int iRow = 0; iRow < rows; iRow++)
        {
            GameObject go = GameObject.Instantiate(levelItem.gameObject, new Vector3(0, 0, lastPos), Quaternion.identity) as GameObject;
            lastPos += levelItem.roomBetweenRows;
            listG0.Add(go);
        }

        return(listG0);
    }
Beispiel #9
0
    public void SetSelectedItem(int index)
    {
        followCursorItem.SetActive(true);
        followCursorItem.GetComponent <SpriteRenderer>().sprite =
            ItemAssets.Instance.GetSpriteByItemType(inventory.GetItemList()[index].itemType);

        var lastItem = chosenItem;

        chosenItem = inventory.GetItemList()[index].itemType;
        if (lastItem == GameItem.ItemType.Coin && chosenItem == GameItem.ItemType.Magnet ||
            chosenItem == GameItem.ItemType.Coin && lastItem == GameItem.ItemType.Magnet)
        {
            inventory.RemoveItemByType(GameItem.ItemType.Magnet);
            inventory.RemoveItemByType(GameItem.ItemType.Coin);
            inventory.AddItem(GameItem.ItemType.MagnetAndCoin);
            chosenItem      = GameItem.ItemType.None;
            chosenItemIndex = -1;
            DisableSelectedItemFollowingCursor();
            return;
        }
        chosenItemIndex = index;

        Debug.Log("New selected Item: " + chosenItem);
    }
Beispiel #10
0
 public void GetItem(GameItem.ItemType type)
 {
     inventory.AddItem(type);
 }
Beispiel #11
0
 public void SetSelectedItem(GameItem.ItemType type)
 {
     chosenItem = type;
     Debug.Log("New selected Item: " + chosenItem);
 }