mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 20:14:05 +09:00
renaming some shits to make them have more sensible name
Former-commit-id: 1c86d460750aa19f65b6e2a0cd7ac1c51ab8ca21 Former-commit-id: 1dd9c33f3eb05b2c48b85ca70ebf3a1b5e57e51a
This commit is contained in:
@@ -59,9 +59,9 @@ constructor() : BasicGameState() {
|
|||||||
lateinit var debugWindow: UIHandler
|
lateinit var debugWindow: UIHandler
|
||||||
lateinit var notifier: UIHandler
|
lateinit var notifier: UIHandler
|
||||||
|
|
||||||
lateinit internal var playerWrapper: PossessedPlayerWrapper
|
lateinit internal var playableActorWrapper: PlayableActorWrapper
|
||||||
internal val player: ActorHumanoid // currently POSSESSED actor :)
|
internal val player: ActorHumanoid // currently POSSESSED actor :)
|
||||||
get() = playerWrapper.actor
|
get() = playableActorWrapper.actor
|
||||||
|
|
||||||
//private var GRADIENT_IMAGE: Image? = null
|
//private var GRADIENT_IMAGE: Image? = null
|
||||||
//private var skyBox: Rectangle? = null
|
//private var skyBox: Rectangle? = null
|
||||||
@@ -126,7 +126,7 @@ constructor() : BasicGameState() {
|
|||||||
|
|
||||||
|
|
||||||
// add new player and put it to actorContainer
|
// add new player and put it to actorContainer
|
||||||
playerWrapper = PossessedPlayerWrapper(PlayerBuilderSigrid.create())
|
playableActorWrapper = PlayableActorWrapper(PlayerBuilderSigrid.create())
|
||||||
//player = PBCynthia.create()
|
//player = PBCynthia.create()
|
||||||
//player.setNoClip(true);
|
//player.setNoClip(true);
|
||||||
addActor(player)
|
addActor(player)
|
||||||
@@ -244,12 +244,12 @@ constructor() : BasicGameState() {
|
|||||||
changePossession(Player.PLAYER_REF_ID) // TODO completely other behaviour?
|
changePossession(Player.PLAYER_REF_ID) // TODO completely other behaviour?
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun changePossession(newActor: PossessedPlayerWrapper) {
|
private fun changePossession(newActor: PlayableActorWrapper) {
|
||||||
if (!hasActor(player)) {
|
if (!hasActor(player)) {
|
||||||
throw IllegalArgumentException("No such actor in actorContainer: $newActor")
|
throw IllegalArgumentException("No such actor in actorContainer: $newActor")
|
||||||
}
|
}
|
||||||
|
|
||||||
playerWrapper = newActor
|
playableActorWrapper = newActor
|
||||||
WorldSimulator(world, player, UPDATE_DELTA)
|
WorldSimulator(world, player, UPDATE_DELTA)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ constructor() : BasicGameState() {
|
|||||||
throw IllegalArgumentException("No such actor in actorContainer: $refid")
|
throw IllegalArgumentException("No such actor in actorContainer: $refid")
|
||||||
}
|
}
|
||||||
|
|
||||||
playerWrapper = PossessedPlayerWrapper(getActorByID(refid) as ActorHumanoid)
|
playableActorWrapper = PlayableActorWrapper(getActorByID(refid) as ActorHumanoid)
|
||||||
WorldSimulator(world, player, UPDATE_DELTA)
|
WorldSimulator(world, player, UPDATE_DELTA)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ open class ActorWithBody : Actor() {
|
|||||||
@Transient private val gravitation: Vector2 = world.gravitation
|
@Transient private val gravitation: Vector2 = world.gravitation
|
||||||
@Transient val DRAG_COEFF_DEFAULT = 1.2
|
@Transient val DRAG_COEFF_DEFAULT = 1.2
|
||||||
/** Drag coefficient. Parachutes have much higher value than bare body (1.2) */
|
/** Drag coefficient. Parachutes have much higher value than bare body (1.2) */
|
||||||
private var DRAG_COEFF: Double
|
var dragCoefficient: Double
|
||||||
get() = actorValue.getAsDouble(AVKey.DRAGCOEFF) ?: DRAG_COEFF_DEFAULT
|
get() = actorValue.getAsDouble(AVKey.DRAGCOEFF) ?: DRAG_COEFF_DEFAULT
|
||||||
set(value) {
|
set(value) {
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
@@ -424,7 +424,7 @@ open class ActorWithBody : Actor() {
|
|||||||
* Drag of atmosphere
|
* Drag of atmosphere
|
||||||
* D = Cd (drag coefficient) * 0.5 * rho (density) * V^2 (velocity sqr) * A (area)
|
* D = Cd (drag coefficient) * 0.5 * rho (density) * V^2 (velocity sqr) * A (area)
|
||||||
*/
|
*/
|
||||||
val D: Vector2 = Vector2(veloX.magnSqr(), veloY.magnSqr()) * DRAG_COEFF * 0.5 * A// * tileDensityFluid.toDouble()
|
val D: Vector2 = Vector2(veloX.magnSqr(), veloY.magnSqr()) * dragCoefficient * 0.5 * A// * tileDensityFluid.toDouble()
|
||||||
|
|
||||||
val V: Vector2 = (W - D) / mass * SI_TO_GAME_ACC
|
val V: Vector2 = (W - D) / mass * SI_TO_GAME_ACC
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import org.newdawn.slick.Input
|
|||||||
* @param actor : here you 'snap in' the actor you wish to control
|
* @param actor : here you 'snap in' the actor you wish to control
|
||||||
* Created by minjaesong on 16-10-23.
|
* Created by minjaesong on 16-10-23.
|
||||||
*/
|
*/
|
||||||
class PossessedPlayerWrapper(val actor: ActorHumanoid) {
|
class PlayableActorWrapper(val actor: ActorHumanoid) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (actor !is Controllable)
|
if (actor !is Controllable)
|
||||||
Reference in New Issue
Block a user