-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31d36b5
commit 700c6a4
Showing
9 changed files
with
85 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/kotlin/org/hexworks/cavesofzircon/systems/HunterSeeker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.hexworks.cavesofzircon.systems | ||
|
||
import org.hexworks.amethyst.api.base.BaseBehavior | ||
import org.hexworks.amethyst.api.entity.EntityType | ||
import org.hexworks.cavesofzircon.commands.MoveTo | ||
import org.hexworks.cavesofzircon.extensions.GameEntity | ||
import org.hexworks.cavesofzircon.extensions.position | ||
import org.hexworks.cavesofzircon.world.GameContext | ||
import org.hexworks.zircon.api.Positions | ||
|
||
object HunterSeeker : BaseBehavior<GameContext>() { | ||
|
||
override fun update(entity: GameEntity<out EntityType>, context: GameContext): Boolean { | ||
val (world, _, _, player) = context | ||
var hunted = false | ||
world.whenCanSee(entity, player) { path -> | ||
entity.executeCommand(MoveTo( | ||
context = context, | ||
source = entity, | ||
position = Positions.from2DTo3D(path.iterator().next(), player.position.z))) | ||
hunted = true | ||
} | ||
return hunted | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters