public class PhysicalBehaviour

Inherits MonoBehaviour, Messages.IUse, Messages.IUseContinuous, Messages.IShot, Messages.IExitShot, Messages.IStabbed, Messages.IOnBeforeSerialise, Messages.IDecal, IManagedBehaviour, IUseEmitter

Handles all physical properties of an object. Collision sounds, temperature, electricity, mass, particle effects, and more is all handled in this class.

Almost all spawned objects have this component attached.

Tread with caution. This is possibly the oldest class still in use and it is a complete disaster.

Nested types

PhysicalBehaviour.Penetration

Fields

public PhysicalProperties Properties

The PhysicalProperties for this object. Cannot be null.


public UnityEngine.Rendering.SortingGroup SortingGroup

[SkipSerialisation]

Potential sorting group that this object belongs to. Can be null.


public Dictionary<ushort, DeltaInt> ContinuousActivationTracker

[SkipSerialisation]

The continuous activation signal tracker. You really shouldn't mess with this unless you know what you're doing. Please, I beg you.


public bool SendUserPropagation

Should this object propagate activation signals?


public ContextMenuOptionComponent ContextMenuOptions

[SkipSerialisation] [HideInInspector]

Object containing the object-specific context menu options.


public bool ReflectsLasers

Should this object reflect lasers like a mirror?


public bool AbsorbsLasers

Should this object absorb lasers?


public bool PlaySliderSound

Should this object play a sliding noise (as defined by PhysicalProperties) when it slides over the ground?


public bool Resizable

Should the player be allowed to resize this object?


public bool Selectable

Should the player be allowed to select this object?


public LocalFirePropagationMap LocalFirePropagationMap

[SkipSerialisation]

Very large flammable objects usually have a local fire propagation map to prevent the entire surface from catching fire all at once


public float StabWoundSizeMultiplier

[SkipSerialisation]

No description provided


public new Rigidbody2D rigidbody

[SkipSerialisation]

The object's rigidbody component


public bool ChargeBurns

Should this object burn when electricity flows through? Only applies if the PhysicalProperties is set to be flammable.


public float BuoyancyModifier

Buoyancy in water muliplier, based on the Properties.


public bool SimulateTemperature

Should this object simulate temperature transfer and its effects at all?


public bool isSliding

Is this object currently sliding over a surface.


public float EnergyWireResistance

The amount of energy that is lost when this object conducts electricity.


public float ActivationPropagationDelay

The amount of delay in seconds of activation signals that propagate through this object. This object will not propagate signals if this value is negative.


public Activations.NodeBehaviour ActivationNode

No description provided


public bool SpawnSpawnParticles

Should this object create those purple and blue particles when spawned?


public GameObject selectionOutlineObject

[SkipSerialisation] [HideInInspector]

The object that renders the green selection outline


public bool BulletPenetration

[SkipSerialisation] [HideInInspector]

Does the object allow bullets to pass through?


public Vector3[] HoldingPositions

[SkipSerialisation]

An array of local-space points where humanoids can hold the object


public bool DisplayBloodDecals

Should this object render decals? It's called "blood" decals because that used to be the only decal.


public bool HasOutline

Confusing names again but you can set this to false to ensure that an outline is never rendered.


public float SoundVolumeBoost

0 by default. This value determines the added minimum range of all sounds that are emitted by this behaviour.


public bool IsWeightless

[HideInInspector]

Is this object weightless? You shouldn't write to this value unless you like undefined behaviour.


public float charge

[HideInInspector]

The raw charge. This does not take several factors into account. It is recommended to use the property (Charge) or the method (GetChargeWithWireResistance()) instead.


public bool ConductOverride

Should this object conduct electricity if the PhysicalProperties allow it? Set this to false to ensure no electricity can be conducted, regardless of the physical properties of the object.


public bool ForceNoCharge

Should this object be allowed to hold charge and conduct electricity? This value overrides the physical properties of the object.


public bool ForceNoChargeParticles

Should this object not display electricity particles? Set it to true to disable them.


public bool Deletable

Is this object deletable? Setting it to false will also prevent the object from being disintegrated or crushed.


public int MaximumStabVictims

Maximum amount of objects this object can stab


public bool Disintegratable

Is this object disintegratable (crushable, in case of limbs)?


public bool StabCausesWound

If this is true, this object will create wounds when it penetrates entities. The syringes, for example, have this set to false.


public float LooseEndSize

The radius of the sharp ends of the object. Larger values make it easier to remove the sharp point from its victim.


public float StabReleaseSpeedModifier

The higher this value is, the easier it is to dislodge this object. 1 by default.


public bool IsInLava

[System.NonSerialized]

Returns true if this object is in a lava pool and false otherwise.You can write to this value but it is handled by the LavaBehaviour in the map, so there is no point really.


public float CurrentWaterSurfaceLevel

[System.NonSerialized]

This value returns the surface level of the water this object is currently in. If this object isn't under water, this will return the last surface level (or zero).


public float burnIntensity

[HideInInspector]

The raw burn intensity. It is recommended to use the property (BurnIntensity) instead.


public Collider2D[] colliders

[SkipSerialisation]

The colliders attached to this behaviour when it was created.This variable is related to much older systems that are still active inside the game and may be replaced soon.It is recommended that you leave this alone.


public List<Penetration> penetrations

[HideInInspector]

A list of all Penetrations that this object is currently responsible for.


public List<PhysicalBehaviour> beingStabbedBy

[HideInInspector]

A list of all other PhysicalBehaviours that this object is being stabbed by.


public List<Penetration> victimPenetrations

[HideInInspector] [SkipSerialisation]

A list of all Penetrations that this object is the victim of.


public uint stabWoundCount

[HideInInspector]

The amount of objects that are stabbing into this object.


public AudioSource slidingAudioSource

[HideInInspector] [SkipSerialisation]

The sliding audio source. It is solely responsible for the looping sliding sound.


public AudioClip[] OverrideImpactSounds

[SkipSerialisation]

An array of sounds that, when populated, will override the collision impact sounds specified in the PhysicalProperties of this behaviour.


public AudioClip[] OverrideShotSounds

[SkipSerialisation]

An array of sounds that, when populated, will override the bullet impact sounds specified in the PhysicalProperties of this behaviour.


public static float AmbientTemperature

The ambient temperature of the world. This is a static value.


public float Temperature

The temperature of this object (in Celsius).


public bool beingHeldByGripper

[HideInInspector]

Is this object being held by a ragdoll or other entity?


public float Wetness

The wetness of this object. Extinguishes fire if high.


public SpriteRenderer spriteRenderer

[SkipSerialisation] [HideInInspector]

The SpriteRenderer of this object.


public int GridRes

The local point grid resolution. Used to bake the local point grid. The grid is used by water to correctly calculate buoyancy.


public Vector2[] LocalColliderGridPoints

[SkipSerialisation]

The local point grid. It is baked before the game is built. The grid is used by water to correctly calculate buoyancy.


public Bounds InitialBounds

The global bounds of the object when it is created.


public bool ForceContinuous

When set to true, this object will never enter discrete collision mode even if requested by the player using the settings. This is used by objects that are meant to move very quickly, like tank projectiles.


public float ObjectArea

[SkipSerialisation]

The initial area of this object. Mainly used by the temperature simulation.


public float TemperatureWhenBurningLerpMultiplier

How quickly should the temperature of this object increase when it's on fire?


public float BurningProgressionMultiplier

How fast should this object burn when it's hot?


public float Circumference

Rough circumference of this object


public float TrueInitialMass

[HideInInspector]

The mass of this object when it was created. This is the mass that the object is meant to be, without any modifications.


public float InitialMass

The mass of the object if it wasn't weightless. This changes when the size of the object is changed. If you want the actual real (true) initial mass, use TrueInitialMass. Why is it named this way? Am I stupid? Yes but the reason is that these variables were created before resizing existed. I am not allowed to change them because of serialisation.


public float InitialGravityScale

[HideInInspector]

The gravity scale this object is meant to have. 1 for most objects.


public bool isDisintegrated

[NaughtyAttributes.ReadOnly]

Is this object disintegrated?


public System.Guid[] serialisable_victims

[HideInInspector]

You are in the nightmare zone. This value is for serialisation only and should not be touched.


public float[] serialisable_durations

[HideInInspector]

You are in the nightmare zone. This value is for serialisation only and should not be touched.


public SharpAxis[] serialisable_axes

[HideInInspector]

You are in the nightmare zone. This value is for serialisation only and should not be touched.


public Vector2[] serialisable_anchors

[HideInInspector]

You are in the nightmare zone. This value is for serialisation only and should not be touched.


public bool[] serialisable_active

[HideInInspector]

You are in the nightmare zone. This value is for serialisation only and should not be touched.


Properties

public bool OnFire { get; private set; }

Is this object currently on fire?


public float BurnProgress { get; set; }

This object's burn progress. Objects stop burning if this is high and it is automatically incremented when this object is on fire or very hot.


public float Charge { get; set; }

The amount of electricity running through or coming out of the object


public bool ShowOutline { get; set; }

Should this object render outlines if requested (by user selection, usually)?


public float BurnIntensity { get; set; }

The current fire intensity. When the object is on fire, this value will return the intensity (size, brightness) of the flames. It can also be written to.


public bool IsUnderWater { set; get; }

[SkipSerialisation]

Returns true if this object is underwater and false otherwise.


public bool IsBeingStabbed

[SkipSerialisation]

Returns true if this object is being stabbed.


public AudioSource MainAudioSource

[SkipSerialisation]

Returns the main audio source for this object. It usually plays physics related noises. THIS CAN BE NULL if the object is static


public int LocalGridPointLength

The amount of points in the local point grid LocalColliderGridPoints.


public UnityEvent<ActivationPropagation> OnSingleUse { get; }

No description provided


public UnityEvent<ActivationPropagation> OnContinuousUse { get; }

No description provided


public float ObjectAreaByMass

Returns (rigidbody.mass / TrueInitialMass) * ObjectArea. Effectively, this is the object area multiplied by how much the object has been resized (because mass changes when resized). Mainly used by the temperature simulation.


public bool IsTouchingSomething { get; }

No description provided


Methods

public bool IsBeingUsedContinuously(ushort channel)

Is this object being continuously used on the given channel?


public bool WasBeingUsedContinuously(ushort channel)

Was this object being continuously used on the given channel last frame?


public bool StartedBeingUsedContinuously(ushort channel)

Has this object started being continuously used on the given channel? In other words: will return true last frame it WAS NOT being used and now it IS.


public bool StoppedBeingUsedContinuously(ushort channel)

Has this object stopped being continuously used on the given channel? In other words: will return true last frame it WAS being used and now it IS NOT.


public bool IsBeingUsedContinuously()

Is this object being continuously used on any channel?


public bool WasBeingUsedContinuously()

Was this object being continuously used on any channel last frame?


public bool StartedBeingUsedContinuously()

Has this object started being continuously used on any channel? In other words: will return true last frame it WAS NOT being used and now it IS.


public bool StoppedBeingUsedContinuously()

Has this object stopped being continuously used on any channel? In other words: will return true last frame it WAS being used and now it IS NOT.


public float GetHeatCapacity()

Returns the calculated thermal capacity value. Takes size, mass, and material properties into account.


public float GetChargeWithWireResistance()

The amount of charge taking the EnergyWireResistance into account.


public Vector2 GetPreviousVel()

Returns the velocity of the previous frame.


public float GetScaledCircumference()

Get the circumference scaled by the local scale of this objecty


public void HaltNextPropagation()

Abort the next propagation signal.


public void HaltPropagation()

Abort all propagation signals until ActivationPropagationDelay is changed again.


public void ResetColliderArray()

Rebuilds the colliders array. This should be called when you change the colliders of the object.


public void ClearAllDecals()

Clears all decals off of this object


public Vector2 GetClosestPointTo(Vector2 point)

Finds and returns the point on this object's colliders that is closest to the given point. If the object has no colliders it will return the center of the object.


public void CalculateCircumference()

[NaughtyAttributes.Button("Calculate circumference")]

Calculates the rough circumference of this object based on the local grid point array. The result is put in Circumference


public void RecalculateMassBasedOnSize()

Recalculates the rigidbody mass (and also InitialMass) based on the change in scale.


public void Decal(DecalInstruction instruction)

Generate a decal on this object given a DecalInstruction.


public float GetRelativeStabSpeed(PhysicalBehaviour victim)

Get the speed of this object relative to a victim that it is currently lodged in. Returns 0 if given a victim that this object is not lodged in.


public Vector2 GetGlobalStabPoint(PhysicalBehaviour victim)

Get the stabbing point in global space of this object in the given victim. Returns (0,0) if given a victim that this object is not lodged in.


public void RefreshOutline()

Update the outline object to the current sprite. Should be called when changing the sprite.


public void ManagedUpdate()

No description provided


public void ManagedLateUpdate()

No description provided


public void ManagedFixedUpdate()

No description provided


public void ForceSendUse()

Forcibly send a single activation signal through this object as if a player had activated it.


public void Use(ActivationPropagation activation)

No description provided


public void Ignite(bool ignoreFlammability = false)

[ContextMenu("Ignite")]

Try to ignite this object based on its flammability. Pass true to set it on fire regardless of its flammability.


public void Ignite(bool ignoreFlammability, Vector2 position)

No description provided


public void Ignite(Vector2 position)

No description provided


public void Extinguish()

Extinguish this object immediately. Also adjusts the temperature so that it doesn't catch fire again.


public IEnumerable<(Collider2D coll, Vector2 point)> GetCurrentContacts()

[System.Obsolete]

No description provided


public void Sizzle(bool withSound = true)

Trigger the sizzle event. This create particles and play sound. Pass in false to disable the sounds.


public Vector2 GetWorldCenterOfMass()

Returns the world center of mass of the object. If the object is not dynamic (frozen or static), it will return the world pivot instead.


public void Shot(Shot shot)

No description provided


public void ExitShot(Shot shot)

No description provided


public void Stabbed(Stabbing stabbing)

No description provided


public void PlayClipOnce(AudioClip clip, float volume)

Plays an audio clip once at this object's position. Should be used instead of creating hundreds of one-use audio sources. Accepts a volume level.


public void PlayClipOnce(AudioClip clip)

Plays an audio clip once at this object's position. Should be used instead of creating hundreds of one-use audio sources.


public void BakeColliderGridPoints()

[ContextMenu("Bake collider grid points")] [Button("Bake collider grid points")]

Rebake the collider grid points. Should be called when colliders are changed.


public Vector2 GetRandomGridPoint()

Get a random point on the local point grid.


public Vector2 GetLowestGlobalGridPoint()

Get the lowest point on the local point grid.


public Vector2 GetNearestLocalHoldingPoint(Vector2 worldPoint, out float distance)

Gets the gripping point, as defined by HoldingPositions, closest to the given point in world space.


public void MakeWeightless()

Make this object weightless.


public void MakeWeightful()

Undo weightlessness.


public void Disintegrate()

Disintegrate this object. This will not necessarily remove it from the world, but will make it practically non-existent.


public void OnBeforeSerialise()

No description provided


public bool ShouldUpdate()

No description provided


public void UseContinuous(ActivationPropagation activation)

No description provided


Attention!

This member is obsolete and should not be used. It is a remnant from the past.

bi bij bibi