Example #1
0
    void Start()
    {
        GameObject SceneManager = GameObject.Find("_SceneManager");

        ChangeScene      = SceneManager.GetComponent <ChangeScene>();
        CustomizeStorage = SceneManager.GetComponent <CustomizeStorage>();
        AlertScript      = SceneManager.GetComponent <AlertScript>();

        // set bar
        int   expCap      = PlayerPrefs.GetInt("level") * 85;
        float capBarValue = 1f / expCap * PlayerPrefs.GetInt("exp");

        BarValue.fillAmount = capBarValue;

        // set stats
        bonusText.text  = "Bonus: " + PlayerPrefs.GetInt("bonus") * 5 + "%";
        packText.text   = "Packs opened: " + PlayerPrefs.GetInt("packs");
        easyText.text   = "Easy solved: " + PlayerPrefs.GetInt("easy");
        normalText.text = "Normal solved: " + PlayerPrefs.GetInt("normal");
        hardText.text   = "Hard solved: " + PlayerPrefs.GetInt("hard");

        // if premium?
        if (PlayerPrefs.GetInt("highscore") == 763)
        {
            Destroy(blocker);
            Destroy(BuyPremiumButton);
            PremiumAds.sprite = upgradedImage;
        }
    }
    void BuildTurret()
    {
        GameObject  tempAlert = GameObject.FindGameObjectsWithTag("AlertSys") [0];
        AlertScript flag      = (AlertScript)tempAlert.GetComponent(typeof(AlertScript));

        if (gm.credits - 25f >= 0)
        {
            string[] splitter = this.gameObject.name.Split(',');
            if (!isWall)
            {
                Game.addWall(int.Parse(splitter [0]), int.Parse(splitter [1]));
                isWall = true;
                //this.GetComponent<Renderer> ().material.color = Color.green;
                this.GetComponent <SpriteRenderer> ().sprite = bottle;
                this.GetComponent <SpriteRenderer> ().color  = Color.white;
                this.gameObject.AddComponent <TurretBehavior> ();
                gm.credits = gm.credits - 25f;
            }
        }
        else
        {
            flag.AlertCall("NoFunds");
            print("No Funds Tried To Call");
        }
    }
Example #3
0
    void Start()
    {
        m_gc           = GameObject.FindWithTag("GameController").GetComponent <GameControllerScript>();
        m_alert        = GameObject.FindWithTag("GameController").GetComponent <AlertScript>();
        m_pointsSystem = GameObject.FindWithTag("PointsText").GetComponent <PointsSystemScript>();

        m_player = GameObject.FindWithTag("Player");

        InvokeRepeating("SpawnWave", 2, 6);
    }
    void Start()
    {
        // get ChangeScene and CustomizeStorage
        GameObject SceneManager = GameObject.Find("_SceneManager");

        ChangeScene      = SceneManager.GetComponent <ChangeScene>();
        CustomizeStorage = SceneManager.GetComponent <CustomizeStorage>();
        AlertScript      = SceneManager.GetComponent <AlertScript>();

        // set up owned
        owned = PlayerPrefs.GetString("owned").ToCharArray();

        // set up buy button
        packCost          = (PlayerPrefs.GetInt("packs") * 50) + 200;
        packCostText.text = packCost + "";

        // create arrow buttons
        GameObject       clone;
        Image            ImageComponent;
        SkinButtonScript sbs;

        for (int i = 0; i < CustomizeStorage.arrowImage.Length; i++)
        {
            clone                 = Instantiate(SkinButton);
            ImageComponent        = clone.GetComponent <Image>();
            sbs                   = clone.GetComponent <SkinButtonScript>();
            ImageComponent.sprite = CustomizeStorage.arrowImage[i];  // change sprite image
            clone.transform.SetParent(SkinButtonsParent.transform);  // set parent

            sbs.sms      = this;
            sbs.idNumber = i; // give ID


            // change color
            if (i < 48 && owned[i].Equals('1')) // owned?
            {
                ImageComponent.color = CustomizeStorage.arrowColors[i];
            }
            else if (i == 48 && allOwned()) // qMark check
            {
                ImageComponent.color = CustomizeStorage.arrowColors[i];
            }
            else
            {
                ImageComponent.color = new Color(0, 0, 0);
            }
        }

        // set image select shower
        Image img = ImageSelect.GetComponent <Image>();

        img.sprite = CustomizeStorage.arrowImage[CustomizeStorage.selectedArrow];
        img.color  = CustomizeStorage.arrowColors[CustomizeStorage.selectedArrow];
    }
    void Start()
    {
        m_gc           = GameObject.FindWithTag("GameController").GetComponent <GameControllerScript>();
        m_alert        = GameObject.FindWithTag("GameController").GetComponent <AlertScript>();
        m_ss           = GameObject.FindWithTag("SoundManager").GetComponent <SoundScript>();
        m_pointsScript = GameObject.FindWithTag("PointsText").GetComponent <PointsSystemScript>();

        m_player = GameObject.FindWithTag("Player");

        m_enemySprite = GetComponentInChildren <SpriteRenderer>();

        if (m_isPartOfElite == false && m_enemySprite != null)
        {
            m_defaultColour = m_enemySprite.color;
        }
    }
    void BuildWall()
    {
        GameObject  tempAlert = GameObject.FindGameObjectsWithTag("AlertSys") [0];
        AlertScript flag      = (AlertScript)tempAlert.GetComponent(typeof(AlertScript));

        if (gm.credits - 10f >= 0)
        {
            string[] splitter = this.gameObject.name.Split(',');
            if (!isWall)
            {
                Game.addWall(int.Parse(splitter [0]), int.Parse(splitter [1]));
                isWall = true;
                this.GetComponent <SpriteRenderer> ().color = Color.gray;
                gm.credits = gm.credits - 10f;
            }
        }
        else
        {
            flag.AlertCall("NoFunds");
            print("No Funds Tried To Call");
        }
    }
    private void BuildBomb()
    {
        GameObject  tempAlert = GameObject.FindGameObjectsWithTag("AlertSys") [0];
        AlertScript flag      = (AlertScript)tempAlert.GetComponent(typeof(AlertScript));

        if (gm.credits - 50f >= 0)
        {
            string[] splitter = this.gameObject.name.Split(',');
            if (!isWall)
            {
                this.gameObject.AddComponent <BombBehavior> ();
                isWall = true;
                this.GetComponent <SpriteRenderer> ().sprite = yarn;
                this.GetComponent <SpriteRenderer> ().color  = Color.white;
                //this.GetComponent<Renderer> ().material.color = Color.yellow;
                gm.credits = gm.credits - 50f;
            }
        }
        else
        {
            flag.AlertCall("NoFunds");
            print("No Funds Tried To Call");
        }
    }
Example #8
0
 private void Start()
 {
     CreatePuzzle = GameObject.Find("_LevelManager").GetComponent <CreatePuzzle>();
     AlertScript  = GameObject.Find("_SceneManager").GetComponent <AlertScript>();
 }