示例#1
0
 private void FireCannon()
 {
     if (Input.GetKeyUp(KeyCode.RightArrow))
     {
         if (!rReload && shipInventory.CanFireCannon())
         {
             myCannons.FireRightCannon(equippedItem.itemName);
             rReload = true;
             shipInventory.DecreaseQuantity(equippedItem.id, 1);
         }
     }
     if (Input.GetKeyUp(KeyCode.LeftArrow))
     {
         if (!lReload && shipInventory.CanFireCannon())
         {
             myCannons.FireLeftCannon(equippedItem.itemName);
             lReload = true;
             shipInventory.DecreaseQuantity(equippedItem.id, 1);
         }
     }
 }
 private void FireAtPlayer()
 {
     if (lCannon.IsTouchingLayers(LayerMask.GetMask("Player")) && !lReload)
     {
         playerInSights = true;
         EquipProjectile();
         myCannons.FireLeftCannon(equippedItem);
         StartCoroutine("ReloadLeft");
         lReload = true;
     }
     else if (rCannon.IsTouchingLayers(LayerMask.GetMask("Player")) && !rReload)
     {
         playerInSights = true;
         EquipProjectile();
         myCannons.FireRightCannon(equippedItem);
         StartCoroutine("ReloadRight");
         rReload = true;
     }
     else
     {
         playerInSights = false;
     }
 }