Beispiel #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();
    }
Beispiel #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;
    }
Beispiel #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;
    }