BomberUnits
...a Unity learning project
BombHandler Class Reference

Is serialized and as such initialized by Unity as part of the PlayerController. More...

+ Collaboration diagram for BombHandler:

Public Member Functions

void Init (CharSettings charSettings, MovementState moveState, InputState inputState, Player player)
 
void Run ()
 
void SendSynced (PhotonStream stream)
 
void ReceiveSynced (PhotonStream stream)
 
Transform RegisterBomb (Bomb b)
 Called by placed bombs to allow keeping track of them, even on remotes. More...
 
void OnBombBtnDown ()
 Stages a bomb for this player if the following conditions are fulfilled: More...
 
void OnBombBtnUp (float pressDuration)
 

Public Attributes

GameObject bombPrefab
 
GameObject targetBombUiPrefab
 
GameObject targetTileUiPrefab
 
GameObject trajectoryUIPrefab
 
Transform bombSpawn
 
int bombRange
 
int maxBombs
 

Private Member Functions

void UpdateSnappedLookDir ()
 
void UpdateInteractionTargets ()
 Tries to find the objects (bomb and tile) relevant for this cycle:
 
Bomb CheckForInteractableBomb (Tile thisTile)
 Returns the Bomb reference for a currently interactable placed bomb.
 
Bomb GetBombOnOwnTile (Tile thisTile)
 
Bomb GetBombOnNeighTile (Tile thisTile)
 Returns the closest own bomb from the placedBombs list. More...
 
Tile GetThrowTargetTile (Bomb bomb, Tile thisTile)
 
void ShowUiCues ()
 Precondition is that the interactable bomb and the target tile are valid! Also the snappedLookDir has to be valid!
 
void ShowBombFocusUI ()
 
void ShowKickableTrajectoryUI (WorldDir dir)
 The target tile is not highlighted for kicking, but it enables kicking in the first place! The relative positions of the UI points is hardcoded here. More...
 
void ShowThrowableTrajectoryUI ()
 
void HideUiCues ()
 
void TryToHoldBomb ()
 
void PlaceHeldBomb ()
 
void Kick (Bomb b)
 
void Throw (Bomb b)
 
void Cleanup ()
 

Private Attributes

float bombCooldown
 
float bombCountdown
 
float kickVelocity
 
float throwDist
 
MovementState moveState
 
InputState inputState
 
Player player
 
GameObject targetTileUi
 
GameObject targetBombUi
 
GameObject [] trajectoryUIPoints
 
List< BombplacedBombs = new List<Bomb>()
 
Bomb heldBomb = null
 
Bomb curInteractableBomb = null
 
Tile curTargetTile = null
 
float remainingBombCooldown = 0
 
float kickBombSelectionAngleTolerance
 
const int numTrajPtsAvailable = 10
 
WorldDir snappedLookDir = WorldDir.INVALID
 

Detailed Description

Is serialized and as such initialized by Unity as part of the PlayerController.

Needed information has to be passed to it before the first cycle.

Definition at line 15 of file BombHandler.cs.

Member Function Documentation

◆ GetBombOnNeighTile()

Bomb GetBombOnNeighTile ( Tile  thisTile)
inlineprivate

Returns the closest own bomb from the placedBombs list.

A bomb is also only eligible if we are roughly looking at it.

Definition at line 206 of file BombHandler.cs.

◆ OnBombBtnDown()

void OnBombBtnDown ( )
inline

Stages a bomb for this player if the following conditions are fulfilled:

  • The player is allowed to spawn another bomb by max simultaneous bomb count.
  • The spawning countdown is over.
  • The button does not activate a throwing or kicking action instead.

Definition at line 134 of file BombHandler.cs.

◆ RegisterBomb()

Transform RegisterBomb ( Bomb  b)
inline

Called by placed bombs to allow keeping track of them, even on remotes.

Also returns some needed info: the transform at which the bomb is held initially.

Definition at line 119 of file BombHandler.cs.

◆ ShowKickableTrajectoryUI()

void ShowKickableTrajectoryUI ( WorldDir  dir)
inlineprivate

The target tile is not highlighted for kicking, but it enables kicking in the first place! The relative positions of the UI points is hardcoded here.

Definition at line 262 of file BombHandler.cs.

Member Data Documentation

◆ kickBombSelectionAngleTolerance

float kickBombSelectionAngleTolerance
private
Todo:
: change to coroutine?

Definition at line 53 of file BombHandler.cs.


The documentation for this class was generated from the following file: