Aeon Vex
Implementing an inventory system with right click actions
right, but I feel that a simple
var menuActions = item.Components.SelectMany(c => c.GetComponentActions());
or something along those lines would be pretty clean for the menu side of things20 replies
Implementing an inventory system with right click actions
An issue with this is that an item can't have multiple uses at once like equipable and droppablewell in the example I have, all items would at the very least be droppable + something else. but I see what you mean, if I had a
Consumable
and a Wearable
class, I'd run into trouble if I ever wanted to add a candy necklace.
could this not be resolved through interfaces? say all items are IDroppable
(for example), and then I could implement interfaces as needed so something could be both IConsumable
and IWearable
. of course, yeah, I suppose that could get messy having to create a concrete implementation for each combination of behaviours.
so you'd go with a component based approach (whether through the unity component system if working in unity, or some other solution) and to construct the right click menu cycle through components and resolve actions for them?20 replies
easy movement
for unity see:
https://docs.unity3d.com/ScriptReference/Input.GetKey.html
and
https://docs.unity3d.com/ScriptReference/Transform.Translate.html
as a starting point
5 replies