public class Global
Inherits MonoBehaviour
The Global behaviour. It exists at all times when a map is loaded. It provides useful functions and references to other objects.
Fields
public AudioMixerGroup SoundEffects
The SFX audio mixer
public AudioMixerGroup Ambience
The Ambience audio mixer
public AudioMixerGroup UserInterface
The UI audio mixer
public Material SelectionOutlineMaterial
The selection outline material
public Material FrozenOutlineMaterial
The frozen outline material
public List<PhysicalBehaviour> PhysicalObjectsInWorld
All physical objects currently in the world
public Dictionary<Transform, PhysicalBehaviour> PhysicalObjectsInWorldByTransform
All physical objects currently in the world by transform. This should be used to get the PhysicalBehaviour component off any transform.
public CameraControlBehaviour CameraControlBehaviour
The main camera control behaviour.
public new Camera camera
The main camera.
public FireLoopSoundControllerBehaviour FireLoopSoundControllerBehaviour
A reference to the fire loop sound controller that is currently active.
public EventSystem eventSystem
The active UI event system.
public GameObject PauseMenu
The pause menu object
public bool ShowLimbStatus
Determines whether or not "Detail view" should be enabled. ToggleLimbStatus
should be used instead.
This is misnamed because "Detail view" used to be called "Limb status view".
public static Global main
The main instance of this behaviour, accessible from everywhere.
public VideoSettingsInitBehaviour VideoSettingsInitBehaviour
The active instance of the video settings initialisation behaviour.
public BellClipContainer BellClips
The currently active BellClipContainer
.
public MixerControllerBehaviour MixerControllerBehaviour
The currently active mixer controller behaviour.
public ResizeHandles ResizeHandles
The currently active resize handles.
public Vector3 MousePosition
The current world-space mouse position.
public Vector3 CameraSpeedCompensatingMousePosition
The current world-space mouse position that is compensated by for the camera movement speed.
public float SlowmotionTimescale
The target timescale when slowmotion is enabled
public int ActiveUiBlockers
The amount of active UI blockers. This is different from UILock
.This value is incremented when an object registers itself as a "ui blocking object".
public WorkshopUploaderDialog WorkshopUploaderDialog
The current workshop uploader dialog box.
public LayerMask EnergyLayers
The layer mask of energy objects. These are objects that do not collide with the world but can collide with other energy objects like energy swords and blaster bolts.
public Material GlobalFoliageMaterial
The one instance of the foliage material. This is shared across all foliage.
public Material GlobalParticleFoliageMaterial
The one instance of the foliage particle material. This is shared across all foliage.
public CatalogToggleBehaviour CatalogToggleBehaviour
I am so tired.
public AudioClip[] WoodStrutStressClips
Audio clips that play when a wooden strut is under stress (I hate Unity)
public AudioClip[] WoodStutSnapClips
Audio clips that play when a wooden strut breaks (I hate Unity)
public float DynamicSqrdVelocityThreshold
The squared velocity threshold for switching between Discrete and Continuous collision detection. The real threshold is the square root of this value.
public GameObject MetalScrapePrefab
Instantiated for objects that need a scraping effect when its sliding around
public const float MetricMultiplier
Constant value that represents how many meters are in 1 Unity unit. You can multiply any translation value with this constant to get the amount of meters back.
Constant value: 2.2f / 2.67f
public bool UiEnabled
No description provided
public UnityEvent OnUiToggle
No description provided
public CanvasScaler CanvasScaler
The current canvas scaler.
Unity documentation: https://docs.unity3d.com/2020.3/Documentation/ScriptReference/
public Color BloodColor
Not used by the game. It is a remnant from when the colour of blood was a global thing.
public DecalDescriptor BlastMarkDecal
This is a messed up bit of code. It is a reference to the blast mark decal.
public const float ChunkSize
A constant value that represents the size of a PhysicalBehaviour chunk. This relates to the chunk system mainly used by the fire propagation system.
Constant value: 1.5f
public const float InverseChunkSize
A constant value that is always equal to 1.0 / ChunkSize
Constant value: 1f / ChunkSize
Properties
public bool UILock
Read-only property that returns whether or not the mouse pointer is over any UI elements.
public static bool ActiveUiBlock
Read-only value that returns whether or not ActiveUiBlockers
is greater than 0
public bool SlowMotion { get; private set; }
Determines whether slow motion is enabled. Cannot be directly. Use ToggleSlowmotion
.
public bool Paused { get; private set; }
Determines whether the time is stopped. Cannot be set directly. Use TogglePaused
.
public static RigidbodyInterpolation2D CurrentInterpolationMode
Read-only value that returns the current interpolation mode.When time is stopped, bodies stop interpolating to make sure the player gets to see the actual position of everything.When time moves, bodies start interpolating to make sure the player doesn't see bodies update at their actual rate of 50 Hz.
public static Vector3 CameraPosition { get; set; }
Read-only value that returns the main camera position independent from camera shake.
public static Vector2 MouseDelta { get; private set; }
Returns how much the mouse has moved in world space in the last frame.
public static float LastKillTime { get; internal set; }
Returns the time when the last being was killed by the player.
Methods
public bool GetPausedMenu()
Returns true if the pause menu is open
public void SetPausedMenu(bool value, string page = "Main")
Closes or opens the pause menu. There is an optional parameter that sets the menu page.
public void ClosePauseMenu()
Closes the pause menu.
public void OpenPauseMenu()
Opens the pause menu.
public void ToggleLimbStatus()
Toggles "Detail view". This should be used instead of setting the ShowLimbStatus
value directly.
This is misnamed because "Detail view" used to be called "Limb status view".
public void AddAudioSource(AudioSource a, bool isAmbience = false)
Add an audio source to the automatic timescale based pitch adjustment system.
public void RemoveAudioSource(AudioSource audioSource)
Remove an audio source fromthe automatic timescale based pitch adjustment system.
public void AddUiBlocker()
Increment ActiveUiBlockers
. This will block most game interaction. This should always, at some point, be followed by RemoveUiBlocker
to prevent permanent interaction blocking.
public void RemoveUiBlocker()
Decrement ActiveUiBlockers
public void TogglePaused()
Toggle whether time is stopped.
public void ToggleSlowmotion()
Toggle whether slowmotion is enabled.
public IEnumerable<PhysicalBehaviour> GetPhysicsObjectsNear(PhysicalBehaviour me)
Returns an enumerable that returns all objects in the same chunk as the given object. The "radius" of this is determined by ChunkSize
and the PhysicalBehaviour.ObjectArea
of the object
public IEnumerable<PhysicalBehaviour> GetPhysicsObjectsNearPosition(Vector2 position, float radius)
Returns an enumerable that returns all objects near the given position with the given radius
public IEnumerable<PhysicalBehaviour> GetPhysicsObjectsNearPositionAccurate(Vector2 position, float radius, float accuracy = 1)
Returns an enumerable that returns all objects near the given position with the given radius.This is less performant than GetPhysicsObjectsNearPosition(Vector2, float)
but will return much more accurate resultsNote that the "accuracty" parameter has no real impact on performance