- 最后登录
- 2019-12-2
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 34660
- 纳金币
- 38268
- 精华
- 111
|
- void OnTriggerStay2D(Collider2D other)
- {
- //print ("OnCollisionStay:"+transform.name);
- //print ("OnCollisionStayOther:"+other.name);
- bIsCollier = true;
- Swap_Object = other;
- //transform.position = other.transform.position;
- }
- void OnTriggerExit2D(Collider2D other)
- {
- bIsCollier = false;
- Swap_Object = null;
- }
- void OnMouseUp()
- {
- if (bIsCollier && Swap_Object!=null )
- {
- poker pos_obj;
- pos_obj=(poker)Swap_Object.GetComponent(typeof(poker));
- //在处于碰撞的同时,松开鼠标左键
- //取得被动碰撞体的位置
- pos_poker_sw=pos_obj.Get_PokerStartPos();
- print ("被动碰撞位置"+pos_poker_sw);
- //改变被动碰撞位置,使其脱离碰撞
- pos_obj.Set_PokerPos(pos_poker_st);
- print ("主动碰撞:"+transform.name+"起始位置"+pos_poker_st+"被动碰撞:"+Swap_Object.name+"位置:"+pos_poker_sw);
- //移位调换后,起始位置被改变
- transform.position=pos_poker_sw;
- pos_poker_st=pos_poker_sw;
- //print ("主动碰撞:"+transform.name+"后位置"+transform.position+"主动碰撞后起始位置"+pos_poker_st);
- }
复制代码 |
|