Exemple #1
0
    private void UpdateMapItems()
    {
        var mi = _Game.mapitems.Where(a => a.enabled && (
                                          a.buttons.Any(b => Vector3.Distance(b.position, pos) < a.Distance) ||
                                          a.boundings.Any(b => b.collider.bounds.Contains(a.pos)))
                                      ).OrderBy(a => Vector3.Distance(a.pos, pos)).FirstOrDefault();

        if (mi != null)
        {
            mapItem   = mi;
            mapItemTm = .5f;
        }
        MapItemInterval -= Time.deltaTime;
        mapItemTm       -= Time.deltaTime;
        if (mapItemTm > 0 && MapItemInterval < 0 && mapItem.Check())
        {
            _GameWindow.CenterText.text = mapItem.text +
                                          (mapItem.Score > 0 ? (", costs " + mapItem.Score + " Money") : "");
            if ((Input.GetKeyDown(KeyCode.F) || mapItem.autoTake) && (Score >= mapItem.Score - 1 || debug))
            {
                mapItem.LocalCheckOut();
            }
        }
        else
        {
            _GameWindow.CenterText.text = "";
        }
    }