Hi all to those who help or read,
Were am I going wrong with this ?
I know you said about Character as not a MonoBehaviour; but it is part of my script and gameobject ( i might not be explaining my self well) so please bare with me.
[code=CSharp] using UnityEngine;
public class Player : Character {
// some other stuff, whatever may already be in the class
void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("CanBePickedUp"))
{
Item hitObject = collision.gameObject.GetComponent<Consumable>().item;
if (hitObject != null)
print("Hit: " + hitObject.objectName)
switch (hitObject.itemType)
{
case Item.ItemType.COIN:
break;
AdjustHitPoints(hitObject.quantity);
break;
default:
break;
}
collision.gameObject.SetActive(false);
} //closes the if statement
} // closes the method
} //closes the class
public void AdjustHitPoints(int amount)
{
hitPoints = hitPoints + amount;
print("Adjusted hitpoints by: " + amount + ". Newvalue: " + hitPoints);
}
[/code]
this is what the book said:
My issue is that im not good at coding, therefore i put things in the wrong place at times. so if you can guide me.
Thank you in advance.[/QUOTE]