Пример #1
0
    // Use this for initialization
    void Start()
    {
        ManagerGame = Manager.GetComponent("GameManager") as GameManager;
        //PlayerItens = GetComponent<PlayerItens>();
        HandlerItem = GetComponent <ItemHandler>();

        ouro     = new Coletavel();
        prata    = new Coletavel();
        bronze   = new Coletavel();
        diamante = new Coletavel();
        ferro    = new Coletavel();

        fuel     = 100;
        HP       = 100;
        timerAux = 10;
        colorz   = new List <Color>();
        //cor_Inicial = renderer.material.color;
        cubez = transform.GetComponentsInChildren <SkinnedMeshRenderer>();

        for (int i = 0; i < cubez.Length; i++)
        {
            Material[] matz = cubez[i].materials;
            foreach (Material mat in matz)
            {
                colorz.Add(mat.color);
            }
        }

        TargetXp = (level * level) + (level * 200);
        Vector2 initialPosition = new Vector2(9.5f, 1f);

        PlacesToGo.Add(initialPosition);
    }
Пример #2
0
    void OnTriggerEnter2D(Collider2D other)

    {
        if (other.GetComponent <Coletavel>())
        {
            Coletavel coletavel = other.GetComponent <Coletavel>();
            ColletableItem(coletavel);
            Destroy(coletavel.gameObject);
        }
    }
Пример #3
0
    public void DropItens(Itens item)
    {
        GameObject tmpDrop = Instantiate(item.itemDrop, localDrop.position, Quaternion.identity) as GameObject;
        Coletavel  tmpClt  = tmpDrop.GetComponent <Coletavel>();

        tmpClt.nomeItem = item.nomes;
        tmpClt.amount   = item.amount;
        if (item.type == Type.RECURSO || item.type == Type.CONSUMIVEL)
        {
            listItens.Add(item);
        }
    }
Пример #4
0
    private void Collect(Coletavel coletavel)
    {
        if (coletavel.Collect())
        {
            if (coletavel is Comida)
            {
                comida++;
            }

            if (coletavel is Lixo)
            {
                comida++;
            }
        }
        {
        }
    }
Пример #5
0
    public void ColletableItem(Coletavel coletavel)
    {
        for (int l = 0; l < listItens.Count; l++)
        {
            foreach (var i in inv.inventairo)
            {
                if (listItens[l].nomes == i.nomes)
                {
                    listItens.Remove(listItens[l]);
                    break;
                }
            }
        }


        foreach (Itens item in inv.inventairo)
        {
            if (coletavel.nomeItem == item.nomes)
            {
                if (item.type == Type.RECURSO || item.type == Type.CONSUMIVEL)
                {
                    item.amount += coletavel.amount;
                    Destroy(coletavel.gameObject);
                }
            }
        }
        for (int i = 0; i < listItens.Count; i++)
        {
            if (coletavel.nomeItem == listItens[i].nomes)
            {
                inv.AddItens(coletavel.nomeItem, coletavel.amount);
                Destroy(coletavel.gameObject);

                if (listItens[i].type == Type.RECURSO || listItens[i].type == Type.CONSUMIVEL)
                {
                    listItens.Remove(listItens[i]);
                }
                break;
            }
        }
    }