So i am trying to figure out how i can pass parameters to my method which then creates a tween from it.
I am unsure how people are doing it - and have not really seen many in depth examples for this. My current method is like this:
public void SetTarget(Hashtable ht){
if(ht.ContainsKey("duration") == false){
ht.Add("duration",2.0f);
}
if(ht.ContainsKey("ease") == false){
ht.Add("ease","linear");
}
DOTween.To(()=> transform.position, x=> transform.position = x, (Vector3)ht["target"], (float)ht["duration"]).SetEase((Ease)ht["ease"]);
}
I assume a hash table is not the smartest way to approach this, and i can see this is going to get even more unmanageable when i add callbacks of which also have parameters. I am confused how for example i would pass an ease type say Quad ease in-out or callbacks with parameters to go with them.
I call my method like this:
void eventTriggered(){
Hashtable param = new Hashtable();
param.Add("target",target);
param.Add("ease","QuadEaseInOut");
cameraHandler.SetTarget(param);
}
Has any one got any advice on how i should setup my method to be more flexible like this?