Exemple #1
0
 void Start()
 {
     currentDirection = stepDirection.NEITHER;
     monster.AddObserver(this);
     garbageCollector.AddObserver(this);
     currentVelocity = Screen.height / 10;
 }
Exemple #2
0
 public override void onNotify(InputEvents e)
 {
     if (e == InputEvents.CorrectInput)
     {
         targetPopped.Add(true);
     }
     else if (e == InputEvents.IncorrectInput)
     {
         targetPopped.Add(false);
     }
     currentDirection = fasterOrSlower();
     currentVelocity  = updateVelocity(currentDirection);
     machine.updateVelocity(currentVelocity);
 }
Exemple #3
0
    float updateVelocity(stepDirection currentDirection)
    {
        switch (currentDirection)
        {
        case stepDirection.FASTER:
            return(currentVelocity + currentVelocity * STEP_SIZE);

        case stepDirection.SLOWER:
            return(currentVelocity - currentVelocity * STEP_SIZE);

        case stepDirection.NEITHER:
            return(currentVelocity);

        default:
            return(currentVelocity);
        }
    }