so, exactly what I want to do is
targetting garlic -> check it is BaseReagent -> Get Type as BaseReagent
A Type is a declarion what kind of Object you have. you cant get a Type as SubType.
You can cast or check if an object is typeof(X) or inherited from X.
In the Moment you Target Garlic you can check if the ITem is Garlic, or Is BaseReagent or is Item.
All 3 will return true because Garlic is also BaseReagent and also Item
Sample from Real World :
You have Animals, some Animals could be Horses and some Horses can be special races.
No matter from qhat perspective you look. A Special Race cant be another special race, but they
are always Horses and always animals.
You dont make an instance into an Type, you compare same beings and use Attributes of same beeings.
I know this function, but how can I get BaseReagent just using Garlic?
I want to sort a lot of kind items, and there are many kinds of basetypes.
so, if I type basetypes, it will make too many lines.
This is not a Function, this is a basic of object orientated programming,
Inheritence and Polymorphy as sample.
As i stated above Garlic is ALSO BaseReagent. If you take any list\Array with the type of BaseReagent,
you can put any Object into, wich inherits from BaseReagent.
The Hirarchy is here topdown :
Items -> BaseReagent -> Garlic as said above.
The deepness how you filter depending on you. You also could just filter for Items and Mobiles and then make subfilter\Sublists.
You also can´t prevent many lines if you check many things. You also can´t avoid getting fat if you eat many food. (Yes Sport but then you have to do "a lot of sport")
that`s the reason why I need to convert garlic to BaseReagent..
As said above its already a BaseReagent. You can cast it back, but then you loose the Properties you may added to Garlic.
As sample with my animals :
Animals have the function to breed, eat, and such. But you say your horse can be tamed.
You cant check if an Animal is tamed, but you can check if a horse is tamed.
So "CASTING" it back only removes abilities and properties on the moment you want to handle the fatherclass, but the informations arent lost,
even if you cast it back to an animal, its theoreticly still a horse.
I tried target script, and targeting garlic, and then using terget.GerType().GetType()
but it returns RunTime ( I don`t know what is the RunTime )
and tried like base.target.GetType()
but it just convert to targetscript`s base
what I need is targetting garlic, and get BaseReagent.
Target an Object and check if its Mobile or Item
if you know its an item you can check if its a BaseReagent
by using GetType() you get the actual top object type, but as said its still BaseReagent
base.target.getType() is not right here.
You call the father then a Target and then want a type?