Esempio n. 1
0
    private void Start()
    {
        playerTank = PlayerData.Instance.GetCurrentVehicleFuelTank();
        Debug.Log(playerTank.GetFuelAmount());
        maxBars = Mathf.CeilToInt(playerTank.GetFuelAmount() / FuelPerBar);
        Image fuelBarIcon = Resources.Load <Image>("UIPrefabs/FuelBarIcon");

        fuelBars = new List <Image>(maxBars);

        for (int i = 0; i < maxBars; i++)
        {
            fuelBars.Add(Instantiate <Image>(fuelBarIcon, transform));
        }
        currentBars = maxBars;
    }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        _fuelIncText.text = "+" + (_fuelTank.GetFuelAmount()).ToString();

        if (_fuelTank.ItemGetCheck() == true)
        {
            Debug.Log("Test");
            _itemGetAnime.SetTrigger("ItemGet");
        }
    }
Esempio n. 3
0
    void FixedUpdate()
    {
        int reqBars = Mathf.CeilToInt(playerTank.GetFuelAmount() / FuelPerBar);

        if (reqBars != currentBars)
        {
            for (int i = 0; i < fuelBars.Count; i++)
            {
                fuelBars[i].gameObject.SetActive(i < reqBars);
            }
            currentBars = reqBars;
        }
    }