Ejemplo n.º 1
0
 private void OnTriggerExit(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         //QUAND ON SORT DE LA ZONE EN VOLANT UN OBJET
         PlayerManager player = other.gameObject.GetComponent <PlayerManager>();
         if (player.IsBringingObject())
         {
             BringObject concernedObj = player.IsBringingObject();
             if (concernedObj.GetComponent <InteractObject>().CanTakeObject)
             {
                 return;
             }
             CheckStealObject(concernedObj, true);
             if (concernedObj.GetOwner() == characterOwner)
             {
                 objectsInZone.Remove(concernedObj.gameObject);
             }
         }
         else if (player.IsBringingTool())
         {
             ToolObject tool = player.IsBringingTool();
             if (tool.GetComponent <InteractObject>().CanTakeObject)
             {
                 return;
             }
             CheckStealObject(tool, true);
             if (tool.GetOwner() == characterOwner)
             {
                 objectsInZone.Remove(tool.gameObject);
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "PNJ" && other.gameObject.GetComponent <PnjManager>().GetCharacterType() == characterOwner)
     {
         PnjCheckStealedObjects();
     }
     else if (other.gameObject.tag == "Player")
     {
         PlayerManager player = other.gameObject.GetComponent <PlayerManager>();
         if (player.IsBringingObject())
         {
             //SI JE REVIENS DANS LA ZONE AVEC UN OBJET DU PERSO
             BringObject concernedObj = player.IsBringingObject();
             //  CheckEventObject(concernedObj);
             if (concernedObj.GetComponent <InteractObject>().CanTakeObject)
             {
                 return;
             }
             CheckStealObject(concernedObj, false);
             if (concernedObj.GetOwner() == characterOwner)
             {
                 objectsInZone.Add(concernedObj.gameObject);
             }
         }
         else if (player.IsBringingTool())
         {
             ToolObject tool = player.IsBringingTool();
             // CheckEventObject(tool);
             if (tool.GetComponent <InteractObject>().CanTakeObject)
             {
                 return;
             }
             CheckStealObject(tool, false);
             if (tool.GetOwner() == characterOwner)
             {
                 objectsInZone.Add(tool.gameObject);
             }
         }
     }
 }