void Start() { currentDirection = stepDirection.NEITHER; monster.AddObserver(this); garbageCollector.AddObserver(this); currentVelocity = Screen.height / 10; }
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); }
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); } }