Hey there folks,
In my game the player fires objects out as a projectile, which includes anything in their inventory.
What I want to do is setup some scene items (for instance a door hotspot in the scene) to recieve and react when different objects hit it. For instance, if the player fires a key object at it, the door opens, but, if the player fires a box of chocolates out, then a different response occurs.
I'm trying to figure out how best to structure this. Is this something which is possible in an actionList? To query what object is coming into contact with a hotspot? Or, does AC provide a inbuilt way for handling 'use inventory item with scene object?'
In my case, the object the player fires isn't actually a pure inventory item, it's the linked prefab which can be attached to a inventory item.
Many thanks,
Tem
Comments
public int objectID;
private void Start()
{
//When the object is created, give it a ID which matches its inventory slot
objectID = InventorySelection.activeInventorySlot;
}
private void OnTriggerEnter(Collider other)
{
//Check to see if the incoming object is a inventory projectile
incomingObject = other.gameObject.GetComponent<HotspotTrigger>();
//If it doesn't, then return. We don't care anymore.
if (incomingObject == null) { return; }
//Call the interaction on the hotspot which matches the incoming objectID
hotspot.RunInventoryInteraction(incomingObject.objectID);
}