Verified Commit 7d659a63 authored by Lars Mitsem Selbekk's avatar Lars Mitsem Selbekk
Browse files

Combine related files/packages

parent 7a2b1421
......@@ -3,7 +3,7 @@ package se.battlegoo.battlegoose.controllers
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import se.battlegoo.battlegoose.datamodels.GridVector
import se.battlegoo.battlegoose.datamodels.ScreenVector
import se.battlegoo.battlegoose.gridmath.findReachablePositions
import se.battlegoo.battlegoose.utils.gridmath.findReachablePositions
import se.battlegoo.battlegoose.models.BattleMap
import se.battlegoo.battlegoose.models.Obstacle
import se.battlegoo.battlegoose.models.heroes.Hero
......
package se.battlegoo.battlegoose.models
import se.battlegoo.battlegoose.datamodels.GridVector
import se.battlegoo.battlegoose.gridmath.Direction
import se.battlegoo.battlegoose.gridmath.neighbours
import se.battlegoo.battlegoose.utils.gridmath.Direction
import se.battlegoo.battlegoose.utils.gridmath.neighbours
import se.battlegoo.battlegoose.models.units.UnitModel
class BattleMap(
......
package se.battlegoo.battlegoose.gridmath
package se.battlegoo.battlegoose.utils.gridmath
import se.battlegoo.battlegoose.datamodels.ScreenVector
import kotlin.math.abs
......
package se.battlegoo.battlegoose.gridmath
package se.battlegoo.battlegoose.utils.gridmath
enum class Direction {
EAST,
......
package se.battlegoo.battlegoose.gridmath
package se.battlegoo.battlegoose.utils.gridmath
import se.battlegoo.battlegoose.datamodels.GridVector
......
package se.battlegoo.battlegoose.gridmath
package se.battlegoo.battlegoose.utils.gridmath
import se.battlegoo.battlegoose.datamodels.GridVector
import se.battlegoo.battlegoose.models.BattleMap
......
......@@ -5,7 +5,7 @@ import com.badlogic.gdx.graphics.g2d.Sprite
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import se.battlegoo.battlegoose.Game
import se.battlegoo.battlegoose.datamodels.ScreenVector
import se.battlegoo.battlegoose.gridmath.isPointInsideHexagon
import se.battlegoo.battlegoose.utils.gridmath.isPointInsideHexagon
import se.battlegoo.battlegoose.utils.TextureAsset
import se.battlegoo.battlegoose.utils.WavePulsator
import kotlin.math.sqrt
......
package se.battlegoo.battlegoose.views
interface ClickObserver {
fun onClick()
}
package se.battlegoo.battlegoose.views
import com.badlogic.gdx.Gdx
import se.battlegoo.battlegoose.Game
import se.battlegoo.battlegoose.datamodels.ScreenVector
class ClickableImpl(
private val isPointWithinBounds: (ScreenVector) -> Boolean
) : ClickableView {
private var observer: ClickObserver? = null
override fun subscribe(observer: ClickObserver) {
this.observer = observer
}
override fun registerInput() {
if (Gdx.input.justTouched()) {
val clickPos = Game.unproject(Gdx.input.x.toFloat(), Gdx.input.y.toFloat())
if (isPointWithinBounds(ScreenVector(clickPos.x, clickPos.y))) {
observer?.onClick()
}
}
}
}
package se.battlegoo.battlegoose.views
import com.badlogic.gdx.Gdx
import se.battlegoo.battlegoose.Game
import se.battlegoo.battlegoose.datamodels.ScreenVector
interface ClickableView {
fun subscribe(observer: ClickObserver)
fun registerInput()
}
interface ClickObserver {
fun onClick()
}
class ClickableImpl(
private val isPointWithinBounds: (ScreenVector) -> Boolean
) : ClickableView {
private var observer: ClickObserver? = null
override fun subscribe(observer: ClickObserver) {
this.observer = observer
}
override fun registerInput() {
if (Gdx.input.justTouched()) {
val clickPos = Game.unproject(Gdx.input.x.toFloat(), Gdx.input.y.toFloat())
if (isPointWithinBounds(ScreenVector(clickPos.x, clickPos.y))) {
observer?.onClick()
}
}
}
}
package se.battlegoo.battlegoose.views
enum class FacingDirection {
RIGHT,
LEFT;
fun flipped(): FacingDirection = when (this) {
RIGHT -> LEFT
LEFT -> RIGHT
}
}
......@@ -48,3 +48,13 @@ class UnitView(
sprite.flip(facingDirection == FacingDirection.LEFT, false)
}
}
enum class FacingDirection {
RIGHT,
LEFT;
fun flipped(): FacingDirection = when (this) {
RIGHT -> LEFT
LEFT -> RIGHT
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment