public abstract class WireBehaviour
Inherits Hover
, Messages.ISlice
The base class for all wire behaviours. Handles rendering, physics, and input.
Fields
protected LineRenderer lineRenderer
[SkipSerialisation]
The line renderer used to render the wire.
public AnchoredJoint2D untypedJoint
[SkipSerialisation]
The joint. The specific joint type is unknown and is usually exposed by the actual implementation of this class.
protected Transform lineChild
[SkipSerialisation]
The transform of the renderer. This is not the transform of the behaviour itself. The renderer is attached to a child object.
public PhysicalBehaviour physicalBehaviour
The PhysicalBehaviour
of the object this behaviour is attached to.
public PhysicalBehaviour otherPhysicalBehaviour
The PhysicalBehaviour
on the other end. This is null if the wire is attached to the background.
protected Vector3[] vertices
[SkipSerialisation]
The vertices of the visual wire that is rendered.
protected Vector2[] points2d
[SkipSerialisation]
The 2D vertices of the visual wire that is rendered.
public Vector2 Joint_ConnectedAnchor
[System.Obsolete]
The connected anchor of the joint as given by the tool behaviour. It is obsolete and does nothing.
public Vector2 Joint_Anchor
[System.Obsolete]
The local anchor of the joint as given by the tool behaviour. It is obsolete and does nothing.
public Material WireMaterial
[SkipSerialisation]
The material for the renderer.
public float WireWidth
The width of the wire.
public Color WireColor
The colour of the wire used by the renderer.
public readonly Color LegacyColour
[SkipSerialisation]
The colour of a wire from an older version of the game. Used for deserialisation.
public string WireMaterialName
The Resource name for the material. Used for serialisation and deserialisation. Disgusting.
protected bool shouldIgnoreUpdate
[SkipSerialisation]
Should the wire update at all? This is a redundant member that exists just to guarantee that nothing is updated when the wire is about to be destroyed.
protected bool usedToHaveConnectedBody
Did this wire have a connected body at some point?
protected Vector2 currentConnectedAnchor
The connected anchor of the joint .
protected Vector2 currentAnchor
The local anchor of the joint as given by the tool behaviour.
public float currentBreakingForce
The current breaking force of the joint as given by the tool behaviour.
Properties
protected EdgeCollider2D EdgeCollider
[SkipSerialisation]
[System.Obsolete]
The generated edge collider.
Methods
public virtual int GetVertexCount()
Should return the amount of vertices in the wire. 12 by default. Meant to be implemented by the actual implementation.
protected void Initialise()
Initialises objects that need to exist.
protected virtual void Update()
The base class updates the renderer and handles input.
public override void OnMouseOverlapEvent(bool overlap)
No description provided
protected override void OnDestroy()
No description provided
public virtual void Slice()
A message receiver that is called by things like lasers and Beamrifles. It disconnects the joint and destroys the wire.
public void SetColor(Color color)
Forcefully sets the wire colour. May not work for some implementations.
public void SetThickness(float thickness)
Forcefully sets the wire thickness. May not work for some implementations.
protected override Bounds GetVisualBounds()
No description provided
protected override bool IsMouseInsideCollider()
No description provided
protected virtual void JointBroken()
Is called when the joint breaks. Base class does nothing.
protected virtual void Tick()
Is called every fixed update step. Base class does nothing.
protected virtual void Created()
Is called when the wire is created. Base class does nothing.