Example #1
0
  /** ************************ Controls and Draw all Game drawing activities */
  public void Draw(Canvas c) {

    if (PauseGame) {
      pause.onDraw(c);
      return;
    }
    for (DrawableUI a : GameObjects) {
      a.Draw(c);
    }
    for (Action a : ActiveActions) {
      a.Draw(c);
    }
    for (Effect a : Effects) {
      a.Draw(c);
    }
  }
Example #2
0
  /** ************************ Runs right before Draw on every frame */
  public void Update() {

    if (PauseGame) return;
    if (ActiveActions.isEmpty()) {
      for (DrawableUI a : GameObjects) {
        if (!a.Disabled) a.Update();
      }
    } else
      for (Action a : ActiveActions) {
        if (a.IsActionFinished()) ActiveActions.remove(a);
      }

    if (!Effects.isEmpty()) {
      for (Effect a : Effects) {
        if (a.IsFinished()) Effects.remove(a);
        else a.Update();
      }
    }
  }
Example #3
0
  /** ***************************** Touch logic */
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    synchronized (getHolder()) {
      if (PauseGame) {
        pause.OnTouch(event);
        return super.onTouchEvent(event);
      }
      CreatePlayerPath(event);
      if (ActiveActions.isEmpty()) {
        for (DrawableUI a : GameObjects) {
          if (!a.Disabled) a.Touched(event);
        }
      } else
        for (Action a : ActiveActions) {
          a.TouchAction(event);
        }
    }

    return super.onTouchEvent(event);
  }
Example #4
0
 /** ******************************** Runs when surface is destroyed. */
 public void Destroy() {
   for (DrawableUI a : GameObjects) {
     a.Destroy();
   }
 }