Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject != gameObject && col.tag != "bound")
     {
         if (col.tag == "Player")
         {
             col.GetComponent <Character>().DoAction(gameObject);
         }
         else
         {
             if (GameManager.GetInstance.gameLevel == GameLevel.Normal)
             {
                 if (tag == "triangle")
                 {
                     Vector3 dif       = col.transform.position - transform.position;
                     Objects targetObj = col.gameObject.GetComponent <Objects>();
                     if (targetObj != null)
                     {
                         targetObj.ChangeState(ObjectState.bouncing);
                         targetObj.MoveDir = dif.normalized;
                     }
                 }
             }
         }
     }
 }