Esempio n. 1
0
    public void AddBolota(Bolota newBolota)
    {
        int index = bolotas.Count;

        newBolota.transform.position = bolotasSpawnPosition[index].position;
        bolotas.Add(newBolota);
    }
Esempio n. 2
0
    public void BolotaBreak()
    {
        Bolota b = bolotas[0];

        RemoveBolota(b);
        Destroy(b.gameObject);
        OrderBolotas();
        UpdateGoal();
    }
Esempio n. 3
0
    private void BolotaJoin(Bolota b, Bolota b2)
    {
        b2.currentValue    = b.currentValue + b2.currentValue;
        b2.bolotaText.text = b2.currentValue.ToString();

        b2.bolotaMaterial.material = BolotaManager.instance.bolotasColors[b2.materialId + 1];
        b2.materialId++;

        RemoveBolota(b);
        Destroy(b.gameObject);
        OrderBolotas();
    }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        if (selecting == true)
        {
            bolotaToChange.transform.position = currentFrask.bolotasSpawnPosition[currentFrask.bolotasSpawnPosition.Count - 1].position;
        }


        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            currentFrask = BolotaManager.instance.frasks[BolotaManager.instance.frasks.IndexOf(currentFrask) + 1];
            if (currentFrask.bolotas.Count != 0)
            {
                selector.position = currentFrask.bolotas[currentFrask.bolotas.Count - 1].transform.position;
            }
            else
            {
                selector.position = currentFrask.transform.position;
            }
        }
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            currentFrask = BolotaManager.instance.frasks[BolotaManager.instance.frasks.IndexOf(currentFrask) - 1];
            if (currentFrask.bolotas.Count != 0)
            {
                selector.position = currentFrask.bolotas[currentFrask.bolotas.Count - 1].transform.position;
            }
            else
            {
                selector.position = currentFrask.transform.position;
            }
        }
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (selecting == false)
            {
                selecting      = true;
                bolotaToChange = currentFrask.GetLastBolota();
                fraskToChange  = currentFrask;
            }

            else if (selecting == true)
            {
                selecting = false;
                currentFrask.AddBolota(bolotaToChange);
                fraskToChange.RemoveBolota(bolotaToChange);
                BolotaManager.instance.UpdateBolotasJoins();
                StartCoroutine(BolotaManager.instance.GeneratingAfterChange(currentFrask, fraskToChange));
            }
        }
    }
Esempio n. 5
0
    public void InstantiateNewBolota(float goalIndex)
    {
        currentGoal    = (int)Mathf.Pow(2f, goalIndex);
        fraskText.text = currentGoal.ToString();

        Bolota newBolota = Instantiate(BolotaManager.instance.bolota);
        int    index     = bolotas.Count;

        newBolota.transform.position = bolotasSpawnPosition[index].position;

        int numberIndex = UnityEngine.Random.Range(0, 2);

        newBolota.bolotaMaterial.material = BolotaManager.instance.bolotasColors[numberIndex];
        newBolota.materialId      = numberIndex;
        newBolota.currentValue    = (int)Mathf.Pow(2f, numberIndex + 1);
        newBolota.bolotaText.text = Mathf.Pow(2f, numberIndex + 1).ToString();

        bolotas.Add(newBolota);
    }
Esempio n. 6
0
 public void RemoveBolota(Bolota bolota)
 {
     bolotas.Remove(bolota);
 }