void OnCollide(GameObject colideObj)
    {
        //is ball star?
        BallMain    bm   = colideObj.GetComponent <BallMain>();
        AudioSource auso = gameObject.GetComponents <AudioSource>()[0];

        auso.pitch = Random.Range(0.5f, 1.5f);
        if (bm.star > 0)
        {
            auso.clip = clips[1];
            ScoreMain.addScore(getScore());
            PreDestory(bm);
        }
        else
        {
            auso.clip = clips[0];
            ScoreMain.addScore(1);
            if (hardness == 0)
            {
                PreDestory(bm);
            }
            else
            {
                gameObject.GetComponents <AudioSource>()[0].Play();
                hardness--;
                hardnessRen.sprite = hardness <= 0 ? null : hardnessSrt[hardness - 1];
            }
        }
    }
Ejemplo n.º 2
0
    private void Start()
    {
        turnText            = GameObject.Find("Turn").GetComponent <Text>();
        score               = GameObject.Find("Score").GetComponent <ScoreMain>();
        manager             = GameObject.FindGameObjectsWithTag("RiskManager")[0].GetComponent <RiskManager>();
        deliverys           = GameObject.Find("Deliverys").GetComponent <Deliverys>();
        storeController     = GameObject.Find("StoreController").GetComponent <StoreController>();
        teamController      = GameObject.Find("TeamController").GetComponent <TeamController>();
        teamControllerStore = GameObject.Find("TeamControllerStore").GetComponent <TeamControllerStore>();
        buildController     = GameObject.Find("BuildController").GetComponent <BuildController>();

        wether = GameObject.Find("Wether").GetComponent <Image>();

        score.ChangeScore(-10000000);

        mounths     = new string[12];
        mounths[0]  = "Июнь";
        mounths[1]  = "Июль";
        mounths[2]  = "Август";
        mounths[3]  = "Сентябрь";
        mounths[4]  = "Октябрь";
        mounths[5]  = "Ноябрь";
        mounths[6]  = "Декабрь";
        mounths[7]  = "Янаврь";
        mounths[8]  = "Февраль";
        mounths[9]  = "Март";
        mounths[10] = "Апрель";
        mounths[11] = "Май";
    }
Ejemplo n.º 3
0
 private void Start()
 {
     scoreController = GameObject.Find("Score").GetComponent <ScoreMain>();
     int[] array = new int[3];
     array[0] = 2;
     array[1] = 3;
     array[2] = 10;
     RestoreSmallToBig(array, 1);
     teamController = GameObject.Find("TeamController").GetComponent <TeamController>();
     deliverys      = GameObject.Find("Deliverys").GetComponent <Deliverys>();
 }
Ejemplo n.º 4
0
    public void ChangeGovernment()
    {
        ScoreMain score = GameObject.Find("Score").GetComponent <ScoreMain>();

        score.ChangeScore(300000);
    }
Ejemplo n.º 5
0
 void setStage()
 {
     if (stageId >= 0)
     {
         stageObj.GetComponent <Text>().text = "STAGE " + (1 + stageId);
         ballMain.GetComponent <BallMain>().Reset();
         GameObject[] objs = GameObject.FindGameObjectsWithTag("Ball");
         foreach (GameObject obj in objs)
         {
             if (obj.name != "BallMain")
             {
                 Destroy(obj);
             }
         }
         gameClearObj.SetActive(false);
         setLife(3);
         ScoreMain.setScore(0);
         objs = GameObject.FindGameObjectsWithTag("Block");
         foreach (GameObject obj in objs)
         {
             Destroy(obj);
             obj.SetActive(false);
         }
         BlockGen.Generate(stageId);
         gameOver = false;
         gameEnd  = false;
         objs     = GameObject.FindGameObjectsWithTag("Block");
         maxScore = 0;
         foreach (GameObject obj in objs)
         {
             maxScore += obj.GetComponent <BlockMain>().getScore();
             //Debug.Log("getScore"+obj.GetComponent<BlockMain>().getScore());
         }
     }
     else
     {
         stageObj.GetComponent <Text>().text = "CUSTOM STAGE";
         ballMain.GetComponent <BallMain>().Reset();
         GameObject[] objs = GameObject.FindGameObjectsWithTag("Ball");
         foreach (GameObject obj in objs)
         {
             if (obj.name != "BallMain")
             {
                 Destroy(obj);
             }
         }
         // gameClearObj.SetActive(false);
         setLife(3);
         ScoreMain.setScore(0);
         objs = GameObject.FindGameObjectsWithTag("Block");
         foreach (GameObject obj in objs)
         {
             Destroy(obj);
             obj.SetActive(false);
         }
         BlockGen.Generate(stageId);
         gameOver = false;
         gameEnd  = false;
         objs     = GameObject.FindGameObjectsWithTag("Block");
         maxScore = 0;
         foreach (GameObject obj in objs)
         {
             maxScore += obj.GetComponent <BlockMain>().getScore();
             //Debug.Log("getScore"+obj.GetComponent<BlockMain>().getScore());
         }
     }
 }