Пример #1
0
    private void MineTile(Vector3 mousePosition)
    {
        GameObject go =
            gc.world.getTileFromPosition(Mathf.RoundToInt(mousePosition.x), Mathf.RoundToInt(mousePosition.y));

        if (go == null)
        {
            return;
        }
        Tile tile = go.GetComponent <Tile>();

        if (go.activeSelf && ammoType[tile.type] + ammoPerTile <= maxAmmoPerType /* && tile.type == chosenProjectile*/)
        {
            ammoType[tile.type] += ammoPerTile;
            go.SetActive(false);
            OnAmmoCountChanged(tile.type, (int)ammoType[tile.type]);

            //if(tile.type == chosenProjectile) OnAmmoCountChanged((int) ammoType[chosenProjectile]);

            if (!seenTypes.Contains(tile.type))
            {
                seenTypes.Add(tile.type);
                unlockScript.OpenUnlockUI(unlockUIOpenTime, tile.typeName, tile.tileSprite);
            }
        }
    }