Skip to content

Commit

Permalink
Update RoomScene.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sky-is-winning authored Oct 30, 2024
1 parent 62b87ae commit 9c0a2aa
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/scenes/igloos/RoomScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import BaseScene from '@scenes/base/BaseScene'

export default class RoomScene extends BaseScene {
constructor(key) {
super(key)
super(`${key}-igloo`)

this.key = key
this.iglooKey = `${key}-igloo`
this.baseKey = key

this.penguins = null

Expand Down Expand Up @@ -78,20 +79,10 @@ export default class RoomScene extends BaseScene {
/*======= Physics =======*/

get roomPhysics() {
let key = this.isPreview ? this.key.toLowerCase().split('-').slice(0, -2).join('-') : this.key.toLowerCase()
if (this.cache.json.get(`${key}-physics`)) {
return this.cache.json.get(`${key}-physics`)
} else {
let splitter
for (let i = 1; i < this.key.length; i++) {
if (this.key[i] == this.key[i].toUpperCase()) {
splitter = this.key[i]
break
}
}
let split = this.key.split(splitter)
return this.cache.json.get(`${split[0].toLowerCase()}-physics`)
}
let key = this.key.toLowerCase()
let baseKey = this.baseKey.toLowerCase()

return this.cache.json.get(`${key}-physics`) || this.cache.json.get(`${baseKey}-physics`)
}

addPhysics() {
Expand Down

0 comments on commit 9c0a2aa

Please sign in to comment.