mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Tilemaps.Components.GetCullTilesFunction
is a new function that returns the correct culling function to use.
This commit is contained in:
parent
c66df4b94b
commit
2450a16911
1 changed files with 48 additions and 0 deletions
48
src/tilemaps/components/GetCullTilesFunction.js
Normal file
48
src/tilemaps/components/GetCullTilesFunction.js
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
/**
|
||||||
|
* @author Richard Davey <rich@photonstorm.com>
|
||||||
|
* @copyright 2020 Photon Storm Ltd.
|
||||||
|
* @license {@link https://opensource.org/licenses/MIT|MIT License}
|
||||||
|
*/
|
||||||
|
|
||||||
|
var CONST = require('../const');
|
||||||
|
var CullTiles = require('./CullTiles');
|
||||||
|
var HexagonalCullTiles = require('./HexagonalCullTiles');
|
||||||
|
var IsometricCullTiles = require('./IsometricCullTiles');
|
||||||
|
var NOOP = require('../../utils/NOOP');
|
||||||
|
var StaggeredCullTiles = require('./StaggeredCullTiles');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the correct function to use to cull tiles, based on the map orientation.
|
||||||
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.GetCullTilesFunction
|
||||||
|
* @since 3.50.0
|
||||||
|
*
|
||||||
|
* @param {number} orientation - The Tilemap orientation constant.
|
||||||
|
*
|
||||||
|
* @return {(Phaser.Tilemaps.Components.CullTiles|Phaser.Tilemaps.Components.StaggeredCullTiles|Phaser.Tilemaps.Components.HexagonalCullTiles|Phaser.Tilemaps.Components.IsometricCullTiles)} The function to use to cull tiles for the given map type.
|
||||||
|
*/
|
||||||
|
var GetCullTilesFunction = function (orientation)
|
||||||
|
{
|
||||||
|
if (orientation === CONST.ORTHOGONAL)
|
||||||
|
{
|
||||||
|
return CullTiles;
|
||||||
|
}
|
||||||
|
else if (orientation === CONST.HEXAGONAL)
|
||||||
|
{
|
||||||
|
return HexagonalCullTiles;
|
||||||
|
}
|
||||||
|
else if (orientation === CONST.STAGGERED)
|
||||||
|
{
|
||||||
|
return StaggeredCullTiles;
|
||||||
|
}
|
||||||
|
else if (orientation === CONST.ISOMETRIC)
|
||||||
|
{
|
||||||
|
return IsometricCullTiles;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NOOP;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = GetCullTilesFunction;
|
Loading…
Add table
Reference in a new issue