Exemplo n.º 1
0
 /*
  *  Rammasse l'objet en parametre.
  *  Si le personnage tient deja un objet, ne fait rien
  *  -> bool : true si l'objet a ete ramasse, sinon false
  */
 public bool pickBigObject(Rigidbody2D obj)
 {
     if (bigObj)
     {
         return(false);
     }
     bigObj = obj;
     obj.BroadcastMessage("OnPickup", SendMessageOptions.DontRequireReceiver);
     bigObjOldState       = bigObj.bodyType;
     bigObj.bodyType      = RigidbodyType2D.Kinematic;
     bigObjOldLayer       = obj.gameObject.layer;
     obj.gameObject.layer = gameObject.layer;
     return(true);
 }
Exemplo n.º 2
0
 public bool dropBigObject(out Rigidbody2D obj, out Transform dropPos)
 {
     dropPos = dropPosition;
     if (!bigObj)
     {
         obj = null;
         return(false);
     }
     obj                  = bigObj;
     obj.bodyType         = bigObjOldState;
     obj.gameObject.layer = bigObjOldLayer;
     obj.BroadcastMessage("OnDrop", SendMessageOptions.DontRequireReceiver);
     bigObj = null;
     return(true);
 }