Rename EffectHandler

This commit is contained in:
Lukas Klingsbo
2020-11-05 20:53:22 +01:00
parent 6afe52b931
commit 057c84e9e6
2 changed files with 7 additions and 7 deletions

View File

@ -1,10 +1,10 @@
import 'dart:ui';
import 'package:flame/effects/effect_handler.dart';
import 'package:flutter/painting.dart';
import 'package:meta/meta.dart';
import '../effects/effects.dart';
import '../effects/effects_handler.dart';
import '../extensions/vector2.dart';
/// This represents a Component for your game.
@ -13,7 +13,7 @@ import '../extensions/vector2.dart';
/// Anything that either renders or updates can be added to the list on [BaseGame]. It will deal with calling those methods for you.
/// Components also have other methods that can help you out if you want to overwrite them.
abstract class Component {
final EffectHandler _effectHandler = EffectHandler();
final EffectsHandler _effectsHandler = EffectsHandler();
/// This method is called periodically by the game engine to request that your component updates itself.
///
/// The time [t] in seconds (with microseconds precision provided by Flutter) since the last update cycle.
@ -21,7 +21,7 @@ abstract class Component {
/// All components on [BaseGame] are always updated by the same amount. The time each one takes to update adds up to the next update cycle.
@mustCallSuper
void update(double dt) {
_effectHandler.update(dt);
_effectsHandler.update(dt);
}
/// Renders this component on the provided Canvas [c].
@ -68,19 +68,19 @@ abstract class Component {
/// Add an effect to the component
void addEffect(ComponentEffect effect) {
_effectHandler.add(effect, this);
_effectsHandler.add(effect, this);
}
/// Mark an effect for removal on the component
void removeEffect(ComponentEffect effect) {
_effectHandler.removeEffect(effect);
_effectsHandler.removeEffect(effect);
}
/// Remove all effects
void clearEffects() {
_effectHandler.clearEffects();
_effectsHandler.clearEffects();
}
/// Get a list of non removed effects
List<ComponentEffect> get effects => _effectHandler.effects;
List<ComponentEffect> get effects => _effectsHandler.effects;
}