mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
less stupid name
Former-commit-id: 4b62bf4b861dc32935489c2b9d063cb0b3b0917c Former-commit-id: faf1a304fb8f96eaf35ab80b0fa964c6e28e2b96
This commit is contained in:
@@ -59,7 +59,7 @@ constructor() : BasicGameState() {
|
||||
lateinit var debugWindow: UIHandler
|
||||
lateinit var notifier: UIHandler
|
||||
|
||||
lateinit internal var playerWrapper: AnyPlayer
|
||||
lateinit internal var playerWrapper: PossessedPlayerWrapper
|
||||
internal val player: ActorHumanoid // currently POSSESSED actor :)
|
||||
get() = playerWrapper.actor
|
||||
|
||||
@@ -126,7 +126,7 @@ constructor() : BasicGameState() {
|
||||
|
||||
|
||||
// add new player and put it to actorContainer
|
||||
playerWrapper = AnyPlayer(PlayerBuilderSigrid.create())
|
||||
playerWrapper = PossessedPlayerWrapper(PlayerBuilderSigrid.create())
|
||||
//player = PBCynthia.create()
|
||||
//player.setNoClip(true);
|
||||
addActor(player)
|
||||
@@ -242,7 +242,7 @@ constructor() : BasicGameState() {
|
||||
changePossession(Player.PLAYER_REF_ID) // TODO completely other behaviour?
|
||||
}
|
||||
|
||||
private fun changePossession(newActor: AnyPlayer) {
|
||||
private fun changePossession(newActor: PossessedPlayerWrapper) {
|
||||
if (!hasActor(player)) {
|
||||
throw IllegalArgumentException("No such actor in actorContainer: $newActor")
|
||||
}
|
||||
@@ -256,7 +256,7 @@ constructor() : BasicGameState() {
|
||||
throw IllegalArgumentException("No such actor in actorContainer: $refid")
|
||||
}
|
||||
|
||||
playerWrapper = AnyPlayer(getActorByID(refid) as ActorHumanoid)
|
||||
playerWrapper = PossessedPlayerWrapper(getActorByID(refid) as ActorHumanoid)
|
||||
WorldSimulator(world, player, UPDATE_DELTA)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@ import org.newdawn.slick.Input
|
||||
/**
|
||||
* A wrapper to support instant player changing (or possessing other NPCs maybe)
|
||||
*
|
||||
* @param actor : here you 'snap in' the actor you wish to control
|
||||
* Created by minjaesong on 16-10-23.
|
||||
*/
|
||||
class AnyPlayer(val actor: ActorHumanoid) {
|
||||
class PossessedPlayerWrapper(val actor: ActorHumanoid) {
|
||||
|
||||
init {
|
||||
if (actor !is Controllable)
|
||||
Reference in New Issue
Block a user