Skip to content

Withered-Flower-0422/Laser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laser Package

This package contains the Laser-related Items for Ballex² and BME pro HDRP.

English | 简体中文

Usage

Installation

Put the whole Assets folder in %USERPROFILE%\AppData\LocalLow\Mushreb\BME Pro HDRP.

Enabling Laser

Click Scripts → Enable → Enable Laser in the menu bar to enable the Laser system for the current scene.

Tip

If there is no Scripts → Enable → Enable Laser in the menu bar, please restart BME.

Tags

Tags for Items

These tags only work for non-link items.

  • AffectedByLaserForce: Only a rigid item with this tag can be affected by the laser force.
  • ReflectLaser: An item with this tag will reflect the laser.
  • IgnoreLaser: An item with this tag will be ignored by the laser.

Tags for Lasers

These tags should be added to Laser_Head sub-items.

  • CanDestroyItem: A laser with this tag can destroy items with DestroyedByLaser script.

Warning

The laser system has occupied the LaserInstances variable name in the variables module. TRY NOT to use this variable name in your own scripts, nor to call variables.clear().

Items

Balls

WoodenBall PaperBall StoneBall IceBall SteelBall RubberBall BalloonBall StickyBall SpongeBall

Same as the official balls, but affected by the laser force.

In particular, the IceBall ignores the laser and the SteelBall reflects the laser.

Box

Box

Same as the official box, but affected by the laser force.

Steel_Block

Steel_Block

A rigid steel block that is affected by the laser force, as well as reflecting the laser.

Ice_Block

Ice_Block

A rigid ice block that is ignored by the laser.

DoublePushBoard_TypeA

DoublePushBoard_TypeA

Same as the official DoublePushBoard_TypeA, but affected by the laser force.

DoublePushBoard_TypeB

DoublePushBoard_TypeB

Same as the official DoublePushBoard_TypeB, but affected by the laser force.

Fence

Fence

Same as the official fence, but affected by the laser force.

PushBoard

PushBoard

Same as the official push board, but affected by the laser force.

TBoard

TBoard

Same as the official TBoard, but affected by the laser force.

Steel_Board

Steel_Board

A rotatable steel board that can reflect the laser.

TNT

TNT

Basically the same as the official TNT (cannot interact with official machineries, e.g. blowing up the suspension bridge), explodes when hit by the laser, received a strong impact or touched by the player ball with high temperature.

Configuration

Variable Type Default Description
explodeImpulseRequire float 5 The minimum impulse required to explode the TNT.
explodeTempRequire float 200 The minimum temperature required to explode the TNT.
explodeForce float 30 The force applied to the items around the exploded TNT.
range float 5 The range of the explosion. Items within this radius will be affected by the explosion.
damageTable float[] see below The damage inflicted on player if player is blown up by the TNT.

Damage Table

The damage inflicted on player depends on the player's ball type.

Index Corresponding Ball Type Default
0 WoodenBall 10
1 StoneBall 5
2 PaperBall 40
3 IceBall 15
4 SteelBall 2.5
5 RubberBall 8
6 BalloonBall 100
7 StickyBall 15
8 SpongeBall 0
9 Others 10

LaserLockedDoor

LaserLockedDoor

Same as the official LaserLockedDoor in Ballex1.

Configuration

The first element of Tags in Settings component means the duration (in frames) for which the laser door opens after being hit by the laser, defaults to 100.

LaserLockedDoor_Joint

LaserLockedDoor_Joint

The door will open permanently after being hit by the laser.

Tip

To make the door be affected by the laser force, add the AffectedByLaserForce tag to the Door_Left and Door_Right sub-items.

Configuration

If there is a ResetOnDeath tag in Tags in Settings component, the door will be locked again after the player dies. Otherwise, it will remain unlocked (if it had been unlocked before).

DestroyedByLaser

WoodenBall

A templated item that can be destroyed by the laser with CanDestroyItem tag.

You can change the destroy sfx in AudioPlayer component.

Laser

Laser

A pure laser that emits laser rays.

Configuration

Variable Type Default Description
endPosOffsets Float3[] [{x: 0, y: 0, z: 30}] Each Float3 represents a ray, whose direction and maximum distance can travel depend on the Float3's direction and length.
force [float, float] [0.5, 1] The linear (first element) and angular (second element) forces applied to the rigid items with AffectedByLaserForce tag hit by the laser.
damageTable float[] see below The damage inflicted on player per frame if player is hit by the laser.
heatFactor float 2 The temperature added to the player per frame if player is hit by the laser. The value varies according to player's current temperature.
chargeFactor float 0.5 The power added to the player per frame if player is hit by the laser.
dryFactor float 0.5 The humidity subtracted from the player per frame if player is hit by the laser. If the temperature of player is lower than -20, the wetness is locked.
material AssetReference SwitcherGlow_Purple The material of the laser rays.
thickness float 1 The thickness factor of the laser rays.
stopUpdateDistance float 50 If the distance between the laser and the player is larger than this value, the laser will stop being updated. If the value is negative, the laser will always be updated. This is for sake of optimizing performance.
halfSample bool true If true, the laser will be updated every other frame. This is for sake of optimizing performance.
asRepeater bool false If true, the laser won't emit rays unless itself is hit by any laser ray.
bake bool false If true, the laser will be baked and never be updated or affect other items during gameplay. This is for decoration.

Damage Table

The damage inflicted on player depends on the player's ball type.

Index Corresponding Ball Type Default
0 WoodenBall 0.3
1 StoneBall 0.1
2 PaperBall 100
3 IceBall 0
4 SteelBall 0.025
5 RubberBall 0.3
6 BalloonBall 100
7 StickyBall 0.125
8 SpongeBall 0
9 Others 0.25

Laser_Static

Laser_Static

A static laser that emits laser rays in the positive z-axis direction of its own coordinate system. You can configure the laser in Laser_Head sub-item.

Laser_Rotating

Laser_Rotating

Same as Laser_Static, but continuously rotates around its own y-axis.

Configuration

Variable Type Default Description
rotateSpeed float 0.25 The speed of rotation in degrees per frame.

Laser_Rotatable

Laser_Rotatable

Same as Laser_Static, but can be rotated.

Laser_Rotatable_ShortHandle

Laser_Rotatable_ShortHandle

Same as Laser_Rotatable, but with a shorter handle.

Laser_DHs

Laser_DH_Static Laser_DH_Rotating Laser_DH_Rotatable Laser_DH_Rotatable_ShortHandle

The double-head versions of the laser. They emit two laser rays in both positive and negative z-axis direction of their own coordinate system.

Repeaters

LaserRepeater_Static LaserRepeater_Rotating LaserRepeater_Rotatable LaserRepeater_Rotatable_ShortHandle

The repeater versions of the laser.

Splitters

LaserSplitter_Static LaserSplitter_Rotating LaserSplitter_Rotatable LaserSplitter_Rotatable_ShortHandle

The repeater versions of the double-head laser.

Features

Self-supplying : If the repeater is hit by its own laser ray, it can still emit rays.

Self-supplying

Notes

  • The Laser items are quite "heavy", so use them sparingly.
  • Try not to use Laser_Rotating excessively. Static lasers have cache mechanisms to ensure their performance, but an always-rotating laser cannot enjoy the same benefits.
  • Try not to let the laser reflect excessively. Reflecting consumptions are quite high.
  • It is recommended to arrange no more than four lasers within a section, as the performance may degrade significantly.
  • Extend the distance between sections which have lasers as much as possible so that the lasers in previous sections don't get updated (if stopUpdateDistance works) to optimize performance.

License

This package is under the MIT license.

About

A package contains the Laser-related Items for Ballex² and BME pro HDRP.

Topics

Resources

License

Stars

Watchers

Forks

Contributors