Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (gamemode == null)
        {
            var dump = GameObject.Find("Gamemode");
            if (dump != null)
            {
                gamemode = dump.GetComponent <Gamemode>();
            }
            return;
        }
        if (PlayerNetwork.localPlayer == null)
        {
            updateWeaponTexture(InventoryScript.WEAPON.noWeapon);
            return;
        }
        InventoryScript.WEAPON currentWeapon = PlayerNetwork.localPlayer.GetComponent <InventoryScript>().currentWeapon;
        if (currentWeapon != uiweapon)
        {
            updateWeaponTexture(currentWeapon);
        }
        lapText.GetComponent <Text>().text = "Lap:" + PlayerNetwork.localPlayer.GetComponent <Placement>().currentLap;
        int placement = gamemode.getPlacement(PlayerNetwork.localPlayer);

        placementText.GetComponent <Text>().text = placement + getPlacementString(placement);

        gamemode.checkGameFinish();
    }
Пример #2
0
    public void updateWeaponTexture(InventoryScript.WEAPON currentWeapon)
    {
        int    index        = (int)currentWeapon;
        Sprite weaponSprite = weaponSprites[index];

        if (weaponSprite == null)
        {
            return;
        }
        if (currentWeapon == InventoryScript.WEAPON.noWeapon)
        {
            imageScript.changeColorAlpha(0.0f);
            imageScript.changeColorAlphaBackground(0.0f);
        }
        else
        {
            imageScript.changeColorAlpha(1.0f);
            imageScript.changeColorAlphaBackground(1.0f);
        }
        imageScript.updateSprite(weaponSprite);

        uiweapon = currentWeapon;
    }
Пример #3
0
    public void updateWeaponTexture(InventoryScript.WEAPON currentWeapon)
    {
        int index = (int)currentWeapon;
        Sprite weaponSprite = weaponSprites[index];
        if (weaponSprite == null)
            return;
        if (currentWeapon == InventoryScript.WEAPON.noWeapon)
        {
            imageScript.changeColorAlpha(0.0f);
            imageScript.changeColorAlphaBackground(0.0f);
        }
        else
        {
            imageScript.changeColorAlpha(1.0f);
            imageScript.changeColorAlphaBackground(1.0f);
        }
        imageScript.updateSprite(weaponSprite);

        uiweapon = currentWeapon;
    }