|
|
@ -4,22 +4,38 @@ import 'package:flame_forge2d/flame_forge2d.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pinball_components/pinball_components.dart';
|
|
|
|
import 'package:pinball_components/pinball_components.dart';
|
|
|
|
|
|
|
|
|
|
|
|
/// Circular sensor that represents "Google" letter.
|
|
|
|
enum GoogleLetterOrder {
|
|
|
|
class GoogleLetter extends BodyComponent with InitialPosition {
|
|
|
|
first,
|
|
|
|
/// Circular sensor that represents the first letter "G" in "Google".
|
|
|
|
second,
|
|
|
|
GoogleLetter.letter1() : _sprite = _GoogleLetterSprite.letter1();
|
|
|
|
third,
|
|
|
|
|
|
|
|
fourth,
|
|
|
|
/// Circular sensor that represents the first letter "O" in "Google".
|
|
|
|
fifth,
|
|
|
|
GoogleLetter.letter2() : _sprite = _GoogleLetterSprite.letter2();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Circular sensor that represents the second letter "O" in "Google".
|
|
|
|
|
|
|
|
GoogleLetter.letter3() : _sprite = _GoogleLetterSprite.letter3();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Circular sensor that represents the letter "L" in "Google".
|
|
|
|
extension on GoogleLetterOrder {
|
|
|
|
GoogleLetter.letter4() : _sprite = _GoogleLetterSprite.letter4();
|
|
|
|
String get path {
|
|
|
|
|
|
|
|
switch (this) {
|
|
|
|
|
|
|
|
case GoogleLetterOrder.first:
|
|
|
|
|
|
|
|
return Assets.images.googleWord.letter1.keyName;
|
|
|
|
|
|
|
|
case GoogleLetterOrder.second:
|
|
|
|
|
|
|
|
return Assets.images.googleWord.letter2.keyName;
|
|
|
|
|
|
|
|
case GoogleLetterOrder.third:
|
|
|
|
|
|
|
|
return Assets.images.googleWord.letter3.keyName;
|
|
|
|
|
|
|
|
case GoogleLetterOrder.fourth:
|
|
|
|
|
|
|
|
return Assets.images.googleWord.letter4.keyName;
|
|
|
|
|
|
|
|
case GoogleLetterOrder.fifth:
|
|
|
|
|
|
|
|
return Assets.images.googleWord.letter5.keyName;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Circular sensor that represents the letter "E" in "Google".
|
|
|
|
/// {@template google_letter}
|
|
|
|
GoogleLetter.letter5() : _sprite = _GoogleLetterSprite.letter5();
|
|
|
|
/// Circular sensor that represents "Google" letter.
|
|
|
|
|
|
|
|
/// {@endtemplate}
|
|
|
|
|
|
|
|
class GoogleLetter extends BodyComponent with InitialPosition {
|
|
|
|
|
|
|
|
/// {@macro google_letter}
|
|
|
|
|
|
|
|
GoogleLetter(GoogleLetterOrder order)
|
|
|
|
|
|
|
|
: _sprite = _GoogleLetterSprite(order.path);
|
|
|
|
|
|
|
|
|
|
|
|
final _GoogleLetterSprite _sprite;
|
|
|
|
final _GoogleLetterSprite _sprite;
|
|
|
|
|
|
|
|
|
|
|
@ -52,22 +68,9 @@ class GoogleLetter extends BodyComponent with InitialPosition {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _GoogleLetterSprite extends SpriteComponent with HasGameRef {
|
|
|
|
class _GoogleLetterSprite extends SpriteComponent with HasGameRef {
|
|
|
|
_GoogleLetterSprite.letter1()
|
|
|
|
_GoogleLetterSprite(String path) : _path = path;
|
|
|
|
: _spritePath = Assets.images.googleWord.letter1.keyName;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_GoogleLetterSprite.letter2()
|
|
|
|
|
|
|
|
: _spritePath = Assets.images.googleWord.letter2.keyName;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_GoogleLetterSprite.letter3()
|
|
|
|
|
|
|
|
: _spritePath = Assets.images.googleWord.letter3.keyName;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_GoogleLetterSprite.letter4()
|
|
|
|
|
|
|
|
: _spritePath = Assets.images.googleWord.letter4.keyName;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_GoogleLetterSprite.letter5()
|
|
|
|
|
|
|
|
: _spritePath = Assets.images.googleWord.letter5.keyName;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final String _spritePath;
|
|
|
|
final String _path;
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(alestiago): Correctly implement activate and deactivate once the
|
|
|
|
// TODO(alestiago): Correctly implement activate and deactivate once the
|
|
|
|
// assets are provided.
|
|
|
|
// assets are provided.
|
|
|
@ -87,7 +90,7 @@ class _GoogleLetterSprite extends SpriteComponent with HasGameRef {
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
await super.onLoad();
|
|
|
|
await super.onLoad();
|
|
|
|
|
|
|
|
|
|
|
|
final sprite = await gameRef.loadSprite(_spritePath);
|
|
|
|
final sprite = await gameRef.loadSprite(_path);
|
|
|
|
this.sprite = sprite;
|
|
|
|
this.sprite = sprite;
|
|
|
|
// TODO(alestiago): Size correctly once the assets are provided.
|
|
|
|
// TODO(alestiago): Size correctly once the assets are provided.
|
|
|
|
size = sprite.originalSize / 5;
|
|
|
|
size = sprite.originalSize / 5;
|
|
|
|