Class Effect

java.lang.Object
de.tum.cit.fop.maze.effects.Effect
Direct Known Subclasses:
Buff, Dash, DashCooldown, Flicker, FlickerHidden, Freeze, GodMode, Invis, InvisCooldown, Poison, Sunscreen

public abstract class Effect extends Object
Abstract base class for all status effects applied to the player. Handles the duration and lifecycle (start, tick, end) of effects.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Player
    The player affected by this effect.
    protected float
    The remaining time for this effect.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Gets the remaining time of the effect.
    abstract void
    Called when the effect expires or is removed.
    abstract void
    Called when the effect is first applied.
    boolean
    onTick(float deltaTime)
    Called every frame to update the effect.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • player

      protected Player player
      The player affected by this effect.
    • timeLeft

      protected float timeLeft
      The remaining time for this effect.
  • Constructor Details

    • Effect

      public Effect()
  • Method Details

    • getTimeLeft

      public float getTimeLeft()
      Gets the remaining time of the effect.
      Returns:
      The time left in seconds.
    • onStart

      public abstract void onStart()
      Called when the effect is first applied.
    • onTick

      public boolean onTick(float deltaTime)
      Called every frame to update the effect.
      Parameters:
      deltaTime - The time elapsed since the last frame.
      Returns:
      True if the effect has expired, false otherwise.
    • onEnd

      public abstract void onEnd()
      Called when the effect expires or is removed.