// This is the function that fill a shovel report
    public void SetShovelData(ShovelData shovelData)
    {
        // Clear previously created state items
        foreach (var item in _stateItems)
        {
            Destroy(item.gameObject);
        }

        _stateItems.Clear();

        _title.text = shovelData.Name;

        if (shovelData.Report != null)
        {
            // Fill Performance Data
            float performancePerUnit = (float)(shovelData.Report.Performance / shovelData.Report.PlannedPerformance);
            _performanceMeter.fillAmount = performancePerUnit;
            _performanceValue.text       = Mathf.FloorToInt(performancePerUnit * 100) + "%";

            // Fill State Items
            foreach (var state in shovelData.Report.LastStates)
            {
                AddStateItem(state);
            }
        }
    }
示例#2
0
    // Show the info panel for a selected shovel.
    public void ShowInfoPanel(bool show, ShovelData shovelData = null)
    {
        if (shovelData != null)
        {
            _infoPanel.SetShovelData(shovelData);
        }

        _infoPanel.gameObject.SetActive(show);
    }
示例#3
0
    public void SetShovelData(ShovelData data)
    {
        _shovelData = data;

        if (_shovelData != null)
        {
            gameObject.transform.position = _shovelData.Position;
        }
    }