Mouse buttons and variables

I want to have variables count the number of times that two separate keyboard keys are pressed.

I will have an animation file playing until one of the variables reaches say 10, when I want a different animation to play after that.

I have been trying to work out how to do this but have been stumped for quite a while so any advice would be appreciated.

I can see the pseudo code but am not sure how to put it in to unity:

play animation file

While Left OR Right != 10 do

{
if

KeyCode.LeftArrow pressed

THen Left = left + 1

if

KeyCode.RightArrow pressed

THen Right = Right + 1

}

if Left OR Right = 10 then

play second animation file

Just keep a variable for each key of interest, then when it’s pressed increment that variable and check it against your ‘trigger value’ to play an animation. Here is an example looking for only one key:

var LeftArrowCount = 0;

function Update () {

  if (Input.GetKeyDown(KeyCode.LeftArrow)) {
    LeftArrowCount++;
    if (LeftArrowCount >= 10) {
      // do whatever you want here
      LeftArrowCount = 0;
    }
  }

}