ChangeTargetOnCollision

abstract class ChangeTargetOnCollision<T, P : Position<P>>(getCurrentPosition: () -> P) : TargetSelectionStrategy<T, P> (source)

Base class for TargetSelectionStrategy offering automatic target change on collision and utilities for initialization. getCurrentPosition should return the current position of the object to move. P is the position type to use.

Constructors

Link copied to clipboard
constructor(getCurrentPosition: () -> P)

Properties

Link copied to clipboard
open override val target: P

The next target where the Node is directed.

Functions

Link copied to clipboard
abstract override fun cloneIfNeeded(destination: Node<T>, reaction: NodeReaction<T>): ChangeTargetOnCollision<T, P>

Clones this strategy, if needed, for the destination node and its reaction. Returns a copy of the strategy if the strategy is stateful, and this object otherwise: the default implementation assumes a stateless strategy.