Exemplo n.º 1
0
    void Start()
    {
        storeController = GameObject.FindGameObjectWithTag("StoreUI").GetComponent<StoreController>();
        stats = GameObject.FindGameObjectWithTag("Persistent Stats").GetComponent<persistentStats>();

        buyText.text = "$" + price;
        if (storeController.AvailableItems[(int)thisItem] != Equipment.EMPTY)
        {
           button.interactable = false;
           button.image.color = inactiveColour;
        }
        else if (storeController.money >= price)
        {
            button.interactable = true;
            button.image.color = activeColour;
        }
        string name = this.name.Replace ("Screen_", "");
        Transform weaponObject = Resources.Load<Transform>("Item_" + name);
        weaponStats weapon = weaponObject.GetComponent<weaponStats>();
        if (weapon == null)
        {
            Debug.Log("stat is in a child");
            weapon = weaponObject.GetComponentInChildren<weaponStats>();
        }

        float damage = 0;
        if (weapon.damageMultiplier < 1) {
            damage = 0;
        } else {
            damage = (weapon.damageMultiplier - 1) * 10;
        }

        description.text = "Weight: " + weapon.mass * 50 + "kg" + "\n" + "Damage: " + damage;
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        if (GameObject.FindGameObjectWithTag("Persistent Stats").GetComponent<persistentStats>() != null)
        {
            playerChoice = GameObject.FindGameObjectWithTag("Persistent Stats").GetComponent<persistentStats>();
        }

        slider = transform.GetComponent<Slider>();
        sliderStart();
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        stats = GameObject.FindGameObjectWithTag("Persistent Stats").GetComponent<persistentStats>();
        active = stats.tutorialActive;

        tutorialMessages = GameObject.FindGameObjectsWithTag("Tutorial");
        foreach (GameObject message in tutorialMessages)
        {
            message.gameObject.SetActive(active);
        }
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        possibleObjects = transform.parent.GetComponentsInChildren<ItemSelectorMulti>();
        playerNumber = possibleObjects[0].player;

        if (playerNumber == 2)
        {
            controllerA += "P2";
            controllerB += "P2";
            controllerX += "P2";
            axisH += "P2";
            controllerStart += "P2";

        }

        Time.timeScale = 1;

        if (GameObject.FindGameObjectWithTag ("Persistent Stats").GetComponent<persistentStats> () != null)
        {
            playerChoice = GameObject.FindGameObjectWithTag ("Persistent Stats").GetComponent<persistentStats> ();
        }

        // equipment initializers=
        for (int i = 0; i < MAX_SOCKETS; i++)
        {
            itemSocketArray[i] = Equipment.EMPTY;
        }

        if (playerChoice != null){
            for (int i = 0; i < MAX_SOCKETS; i++)
            {
                playerChoice.playerItems[i] = itemSocketArray[i];
            }

            //get the bought items
            for (int i = 0; i < TOTAL_ITEMS; i++)
            {
                AvailableItems[i] = playerChoice.boughtItems[i];
            }

        }

        noOfModels = uiPlayerModels.GetComponent<Transform> ().childCount - 1;

        sliderColour = new Color(rgbColor.x, rgbColor.y, rgbColor.z);
    }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        Time.timeScale = 1;

        if (GameObject.FindGameObjectWithTag ("Persistent Stats").GetComponent<persistentStats> () != null)
        {
            playerChoice = GameObject.FindGameObjectWithTag ("Persistent Stats").GetComponent<persistentStats> ();
        }

        // equipment initializers=
        for (int i = 0; i < MAX_SOCKETS; i++)
        {
            itemSocketArray[i] = Equipment.EMPTY;
        }

        if (playerChoice != null){
            for (int i = 0; i < MAX_SOCKETS; i++)
            {
                playerChoice.playerItems[i] = itemSocketArray[i];
            }

            //get the bought items
            for (int i = 0; i < TOTAL_ITEMS; i++)
            {
                AvailableItems[i] = playerChoice.boughtItems[i];
            }

            money = playerChoice.playerMoney;

        }

        sliderColour = new Color(rgbColor.x, rgbColor.y, rgbColor.z);
    }