Working Event system & SoftObstacle
This commit is contained in:
parent
08f623a1b1
commit
a940cb64ba
8 changed files with 279 additions and 68 deletions
|
@ -10,7 +10,8 @@ public class Tavernkeeper_controller : MonoBehaviour
|
|||
public float action_dist = 1.5f; //Action distance
|
||||
public float action_cd = 0.5f; //Action cooldown
|
||||
|
||||
IDictionary<string, GameObject> hand_container; //Objects in hand
|
||||
//TODO : GameObject => IGrabable
|
||||
Dictionary<string, GameObject> hand_container; //Objects in hand
|
||||
|
||||
float actionTimer;
|
||||
bool isInteracting;
|
||||
|
@ -25,6 +26,7 @@ public class Tavernkeeper_controller : MonoBehaviour
|
|||
Rigidbody2D rigidbody2d;
|
||||
Animator animator;
|
||||
|
||||
//Grab an Object (IGrabable) w/ a specific or w/ last hand used (hand=null).
|
||||
public void grab(GameObject obj, string hand=null)
|
||||
{
|
||||
//Default hand
|
||||
|
@ -52,6 +54,22 @@ public class Tavernkeeper_controller : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
//Drop every objects in hands at tavernkeeper position.
|
||||
public void emptyHands()
|
||||
{
|
||||
|
||||
foreach(string hand in hand_container.Keys)
|
||||
{
|
||||
if(hand_container[hand]!=null)
|
||||
{
|
||||
IGrabable grabable_obj = hand_container[hand].GetComponent<IGrabable>();
|
||||
grabable_obj.drop(transform.position);
|
||||
}
|
||||
}
|
||||
hand_container["left"]=null;
|
||||
hand_container["right"]=null;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue