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); } }
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; }
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); }
public void RemoveColectable() { colectable = null; meshRendererIntern.material.color = defaultColor; }
public void CollectObject(Colectable colectable) { collecteObjetc += colectable.value; }