Class: SceneMap

SceneMap

A scene for a local map

new SceneMap (id, isBattleMap, minimal)

Name Type Default Description
id number The map ID
isBattleMap number Indicate if this map is a battle one
minimal boolean false optional Indicate if the map should be partialy loaded (only for getting objects infos)
Properties:
Name Type Description
id number The map ID
isBattleMap number Indicate if this map is a battle one
mapName string The map name
scene THREE.Scene The 3D scene of the map
collisions Array.<Array.<number>> The collisions squares arrays
mapProperties MapProperties The map properties
camera Camera The map camera
currentPortion Array.<number> The current portion (according to camera position)
previousCameraPosition THREE.Vector3 The previous camera position
orientation Orientation The camera orientation
allObjects Array.<Array.<number>> All the objects portions according to ID
portionsObjectsUpdated boolean Indicate if the portions objects are loaded
textureTileset THREE.MeshBasicMaterial The tileset material
texturesAutotiles Array.<THREE.MeshBasicMaterial> The autotiles materials
texturesWalls Array.<THREE.MeshBasicMaterial> The walls materials
texturesMountains Array.<THREE.MeshBasicMaterial> The mountains materials
texturesObjects3D Array.<THREE.MeshBasicMaterial> The 3D objects materials
texturesCharacters Array.<THREE.MeshBasicMaterial> The characters materials
mapPortions Array.<MapPortion> All the portions in the visible ray of the map (according to an index)

Extends

Methods

SceneMap.getPortionName (x, y, z)string static

Get the portion file name
Name Type Description
x number The global x portion
y number The global y portion
z number The global z portion
Returns:
Type Description
string

SceneMap.getGlobalPortion (position)Array.<number> static

Get the global portion of a json position
Name Type Description
position Array.<number> The json position
Returns:
Type Description
Array.<number>

load () async overrides

Load async stuff

readMapProperties () async

Read the map properties file

initializeObjects () async

Initialize the map objects

initializePortionsObjects ()

Initialize all the objects moved or / and with changed states

loadTextures () async

Load all the textures of the map

loadCollisions ()

Load the collisions settings

initializePortions () async

Initialize the map portions

loadPortions (noNewPortion) async

Get the portion file name
Name Type Description
noNewPortion boolean Indicate if the map portions array needs to be initialized

loadPortion (realX, realY, realZ, x, y, z, move) async

Load a portion
Name Type Description
realX number The global x portion
realY number The global y portion
realZ number The global z portion
x number The local x portion
y number The local y portion
z number The local z portion
move boolean Indicate if the portion was moved or completely loaded

loadPortionFromPortion (portion, x, y, z, move) async

Load a portion from a portion
Name Type Description
portion Array.<number> The portion
x number The local x portion
y number The local y portion
z number The local z portion
move boolean Indicate if the portion was moved or completely loaded

removePortion (x, y, z, move)

Remove a portion
Name Type Description
x number The local x portion
y number The local y portion
z number The local z portion
move boolean Indicate if the portion was moved or completely loaded

setPortion (i, j, k, m, n, o)

Set a portion
Name Type Description
i number The previous x portion
j number The previous y portion
k number The previous z portion
m number The new x portion
n number The new y portion
o number The new z portion

setMapPortion (x, y, z, mapPortion, move)

Set a portion
Name Type Description
x number The local x portion
y number The local y portion
z number The local z portion
mapPortion MapPortion The new map portion
move boolean Indicate if the portion was moved or completely loaded

getObjectsAtPortion (i, j, k)Array.<Object>

Get the objects at a specific portion
Name Type Description
i number The global x portion
j number The global y portion
k number The global z portion
Returns:
Type Description
Array.<Object>

getMapPortion (x, y, z)MapPortion

Get a map portion at local postions
Name Type Description
x number The local x portion
y number The local y portion
z number The local z portion
Returns:
Type Description
MapPortion

getMapPortionByPortion (portion)MapPortion

Get a map portion at local portion
Name Type Description
portion Array.<number> The local portion
Returns:
Type Description
MapPortion

getMapPortionByPosition (position)MapPortion

Get a map portion at json position
Name Type Description
position Array.<number> The json position
Returns:
Type Description
MapPortion

getBrutMapPortion (index)MapPortion

Get map portion according to portion index
Name Type Description
index number The portion index
Returns:
Type Description
MapPortion

getPortionIndex (x, y, z)number

Get portion index according to local position
Name Type Description
x number The local x portion
y number The local y portion
z number The local z portion
Returns:
Type Description
number

getLocalPortion (portion)Array.<number>

Set a local portion with a global portion
Name Type Description
portion Array.<number> The global portion
Returns:
Type Description
Array.<number>

getMapPortionLimit ()number

Get the map portion limit
Returns:
Type Description
number

getMapPortionSize ()number

Get the map portions size
Returns:
Type Description
number

getMapPortionTotalSize ()number

Get the map portion total size
Returns:
Type Description
number

isInPortion (portion)boolean

Check if a local portion if in the limit
Name Type Description
portion number The local portion
Returns:
Type Description
boolean

isInMap (position)boolean

Check if a json position is in the map
Name Type Description
position Array.<number> The json position
Returns:
Type Description
boolean

getHeroPosition ()THREE.Vector3

Get the hero position according to battle map
Returns:
Type Description
THREE.Vector3

updateBackgroundColor ()

Update the background color

loadSpecialsCollision (list, kind, specials)

Load collision for special elements
Name Type Description
list Array.<number> The IDs list
kind PictureKind The picture kind
specials Array.<SystemSpecialElement> The specials list

updateMovingPortions ()

Update moving portions

updateMovingPortionsEastWest ()

Update moving portions for east and west

updateMovingPortionsNorthSouth ()

Update moving portions for north and south

updateMovingPortionsUpDown ()

Update moving portions for up and down

updatePortions ()

Update portions according to a callback

update () overrides

Update the scene

onKeyPressed (key) overrides

Handle scene key pressed
Name Type Description
key number The key ID

onKeyReleased (key) overrides

Handle scene key released
Name Type Description
key number The key ID

onKeyPressedRepeat (key)boolean overrides

Handle scene pressed repeat key
Name Type Description
key number The key ID
Returns:
Type Description
boolean

onKeyPressedAndRepeat (key)boolean overrides

Handle scene pressed and repeat key
Name Type Description
key number The key ID
Returns:
Type Description
boolean

draw3D () overrides

Draw the 3D scene

close () overrides

Close the map

updateInterpreters () inherited overrides

Update all the reactions interpreters

updateParallelCommands () inherited overrides

Update all the parallel commands

addReaction (sender, reaction, object, state, parameters, event, moving) inherited overrides

Add a reaction in the interpreter list
Name Type Description
sender MapObject The sender of this reaction
reaction SystemReaction The reaction to add
object MapObject The object reacting
state number The state ID
parameters Array.<SystemParameter> All the parameters coming with this reaction
event Array.<number> The time events values
moving boolean Indicate if command is a moving one

drawHUD () inherited overrides

Draw the HUD scene