mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-08 23:56:07 +08:00
Rename EffectHandler
This commit is contained in:
@ -1,10 +1,10 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flame/effects/effect_handler.dart';
|
|
||||||
import 'package:flutter/painting.dart';
|
import 'package:flutter/painting.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
import '../effects/effects.dart';
|
import '../effects/effects.dart';
|
||||||
|
import '../effects/effects_handler.dart';
|
||||||
import '../extensions/vector2.dart';
|
import '../extensions/vector2.dart';
|
||||||
|
|
||||||
/// This represents a Component for your game.
|
/// 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.
|
/// 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.
|
/// Components also have other methods that can help you out if you want to overwrite them.
|
||||||
abstract class Component {
|
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.
|
/// 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.
|
/// 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.
|
/// 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
|
@mustCallSuper
|
||||||
void update(double dt) {
|
void update(double dt) {
|
||||||
_effectHandler.update(dt);
|
_effectsHandler.update(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Renders this component on the provided Canvas [c].
|
/// Renders this component on the provided Canvas [c].
|
||||||
@ -68,19 +68,19 @@ abstract class Component {
|
|||||||
|
|
||||||
/// Add an effect to the component
|
/// Add an effect to the component
|
||||||
void addEffect(ComponentEffect effect) {
|
void addEffect(ComponentEffect effect) {
|
||||||
_effectHandler.add(effect, this);
|
_effectsHandler.add(effect, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mark an effect for removal on the component
|
/// Mark an effect for removal on the component
|
||||||
void removeEffect(ComponentEffect effect) {
|
void removeEffect(ComponentEffect effect) {
|
||||||
_effectHandler.removeEffect(effect);
|
_effectsHandler.removeEffect(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove all effects
|
/// Remove all effects
|
||||||
void clearEffects() {
|
void clearEffects() {
|
||||||
_effectHandler.clearEffects();
|
_effectsHandler.clearEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a list of non removed effects
|
/// Get a list of non removed effects
|
||||||
List<ComponentEffect> get effects => _effectHandler.effects;
|
List<ComponentEffect> get effects => _effectsHandler.effects;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user