protected override void OnMouseButtonDown(MouseButtons button, int id, int theItem)
 {
     if (id == this.id)
     {
         if (button == MouseButtons.left)
         {
             if (CurrentPlayer.Instance.AmountOfEquipments[theItem] is GrenadeData)
             {
                 GrenadeData grenade = (GrenadeData)CurrentPlayer.Instance.AmountOfEquipments[theItem];
                 grenade.SetDirection(theDirection);
             }
             GameObject obj    = CurrentPlayer.Instance.AmountOfEquipments[theItem].DummySpawnBomb(this.ourTransform.position);
             RemoteBomb remote = obj.GetComponent <RemoteBomb>();
             if (remote != null)
             {
                 remote.id = id;
             }
             obj.GetComponent <BombsParent>().ID = id;
         }
         else if (button == MouseButtons.right)
         {
             ActivateRemote(id);
         }
     }
 }
示例#2
0
 protected override void OnMouseButtonDown(MouseButtons button, int id, int theItemID)
 {
     if (id == player_id)
     {
         if (button == MouseButtons.left)
         {
             if (theTileMap.theMap.GetTileAt(currentTilePos) is Noblock || theTileMap.theMap.GetTileAt(currentTilePos) is InvisibleWallBlock)
             {
                 if (TheCurrentItem is GrenadeData)
                 {
                     GrenadeData grenade = (GrenadeData)TheCurrentItem;
                     grenade.SetDirection(ourDirection);
                 }
                 GameObject obj = TheCurrentItem.PlayerSpawnBomb(theTileMap.ConvertTileToWorld(currentTilePos));
                 if (obj != null)
                 {
                     RemoteBomb remote = obj.GetComponent <RemoteBomb>();
                     if (remote != null)
                     {
                         remote.id = id;
                     }
                     if (DarkRiftAPI.isConnected)
                     {
                         DarkRiftAPI.SendMessageToOthers(NetworkingTags.Events, NetworkingTags.EventSubjects.leftMouseButton, TheCurrentItem.OrderID);
                     }
                     obj.GetComponent <BombsParent>().ID = id;
                 }
             }
         }
         else if (button == MouseButtons.right)
         {
             ActivateRemote(DarkRiftAPI.id);
             if (DarkRiftAPI.isConnected)
             {
                 DarkRiftAPI.SendMessageToOthers(NetworkingTags.Events, NetworkingTags.EventSubjects.rightMouseButton, DarkRiftAPI.id);
             }
         }
         else if (button == MouseButtons.ScrollDown)
         {
             bool Changed = false;
             for (int i = TheCurrentItem.OrderID + 1; i < theEquipments.Count; i++)
             {
                 if (theEquipments[i].Amount > 0)
                 {
                     TheCurrentItem = theEquipments[i];
                     Changed        = true;
                     break;
                 }
             }
             if (!Changed)
             {
                 TheCurrentItem = theEquipments[0];
             }
         }
         else if (button == MouseButtons.ScrollUp)
         {
             bool Changed = false;
             if (TheCurrentItem.OrderID == 0)
             {
                 for (int i = theEquipments.Count - 1; i >= 0; i--)
                 {
                     if (theEquipments[i].Amount > 0)
                     {
                         TheCurrentItem = theEquipments[i];
                         Changed        = true;
                         break;
                     }
                 }
             }
             else
             {
                 for (int i = TheCurrentItem.OrderID - 1; i >= 0; i--)
                 {
                     if (theEquipments[i].Amount > 0)
                     {
                         TheCurrentItem = theEquipments[i];
                         Changed        = true;
                         break;
                     }
                 }
             }
             if (!Changed)
             {
                 TheCurrentItem = theEquipments[0];
             }
         }
     }
     UpdateUI(TheCurrentItem);
 }