예제 #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Colectable item = collision.GetComponent <Colectable>();

        if (item != null)
        {
            item.player           = this.gameObject;
            item.transform.parent = null;
            info.inventory.Add(item);
            item.gameObject.SetActive(false);
        }
    }
예제 #2
0
    public void ConfigColectable(ColectableScriptable colecScriptable)
    {
        int randomNumber = Random.RandomRange(0, 100);
        int rarity       = 0;

        if (randomNumber < 60)
        {
            rarity = 1;
        }
        else
        {
            if (randomNumber < 97)
            {
                rarity = 2;
            }
            else
            {
                rarity = 3;
            }
        }
        colectable = new Colectable(colecScriptable.typeColectable.ToString(), rarity, colecScriptable.forcaEfeito, colecScriptable.colorTileColectable);
        meshRendererIntern.material.color = colectable.colorTileColectable;
    }
예제 #3
0
    public bool CollectColetable()
    {
        Colectable col = destiny.GetComponent <TileScript>().GetColectable();

        if (col != null)
        {
            switch (col.typeColectable)
            {
            case "Movement":
                _currentMovementPlayer += col.forceEffect * col.rarity;
                break;

            case "Attack":
                _currentAttackPlayer += col.forceEffect * col.rarity;
                break;

            case "Health":
                _currentHealthPlayer += col.forceEffect * col.rarity;
                break;
            }
            return(true);
        }
        return(false);
    }
예제 #4
0
 public void RemoveColectable()
 {
     colectable = null;
     meshRendererIntern.material.color = defaultColor;
 }
예제 #5
0
 public void CollectObject(Colectable colectable)
 {
     collecteObjetc += colectable.value;
 }