Class FlingUtilities
Provides extra functions and utilities for flinging objects
Namespace: WeaverCore.Utilities
Assembly: WeaverCore.dll
Syntax
public static class FlingUtilities
Methods
| Edit this page View SourceFlingSpawnedObject(Vector2, Vector2, GameObject)
Flings a spawned object with the specified speed and angle.
Declaration
public static void FlingSpawnedObject(Vector2 speedRange, Vector2 angleRange, GameObject spawnedObj)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | speedRange | The range of speeds for flinging. |
Vector2 | angleRange | The range of angles for flinging. |
GameObject | spawnedObj | The GameObject to be flung. |
SpawnPooledAndFling(Config, Transform, Vector3)
Spawns a specified number of pooled objects and flings them based on the provided configuration.
Declaration
public static GameObject[] SpawnPooledAndFling(FlingUtils.Config config, Transform spawnPoint, Vector3 positionOffset)
Parameters
Type | Name | Description |
---|---|---|
FlingUtils.Config | config | The configuration for spawning and flinging. |
Transform | spawnPoint | The transform representing the spawn point. |
Vector3 | positionOffset | The offset from the spawn point position. |
Returns
Type | Description |
---|---|
GameObject[] | An array of GameObjects spawned and flung. |
SpawnRandomObjects(GameObject, Vector3, Vector2Int, Vector2, Vector2, Vector2)
Spawns a specified number of random objects and flings them based on the provided parameters.
Declaration
public static GameObject[] SpawnRandomObjects(GameObject prefab, Vector3 spawnPos, Vector2Int spawnAmountRange, Vector2 speedRange, Vector2 angleRange, Vector2 originVariation)
Parameters
Type | Name | Description |
---|---|---|
GameObject | prefab | The GameObject prefab to spawn. |
Vector3 | spawnPos | The spawn position for the objects. |
Vector2Int | spawnAmountRange | The range for the number of objects to spawn. |
Vector2 | speedRange | The range of speeds for flinging. |
Vector2 | angleRange | The range of angles for flinging. |
Vector2 | originVariation | The variation in origin positions. |
Returns
Type | Description |
---|---|
GameObject[] | An array of spawned and flung GameObjects. |
SpawnRandomObjectsOverTime(GameObject, float, float, Func<Vector3>, Vector2Int, Vector2, Vector2, Vector2, Vector2)
Spawns random objects over a specified duration with a given frequency, and flings them based on the provided parameters.
Declaration
public static IEnumerator SpawnRandomObjectsOverTime(GameObject prefab, float duration, float frequency, Func<Vector3> spawnPos, Vector2Int spawnAmountRange, Vector2 speedRange, Vector2 angleRange, Vector2 originVariation, Vector2 scaleRange)
Parameters
Type | Name | Description |
---|---|---|
GameObject | prefab | The GameObject prefab to spawn. |
float | duration | The total duration for spawning objects. |
float | frequency | The frequency of spawning objects. |
Func<Vector3> | spawnPos | The spawn position for the objects. |
Vector2Int | spawnAmountRange | The range for the number of objects to spawn. |
Vector2 | speedRange | The range of speeds for flinging. |
Vector2 | angleRange | The range of angles for flinging. |
Vector2 | originVariation | The variation in origin positions. |
Vector2 | scaleRange | The range of scales for the spawned objects. |
Returns
Type | Description |
---|---|
IEnumerator | An IEnumerator for coroutine usage. |
SpawnRandomObjectsOverTime(GameObject, float, float, Vector3, Vector2Int, Vector2, Vector2, Vector2, Vector2)
Spawns random objects over a specified duration with a given frequency, and flings them based on the provided parameters.
Declaration
public static IEnumerator SpawnRandomObjectsOverTime(GameObject prefab, float duration, float frequency, Vector3 spawnPos, Vector2Int spawnAmountRange, Vector2 speedRange, Vector2 angleRange, Vector2 originVariation, Vector2 scaleRange)
Parameters
Type | Name | Description |
---|---|---|
GameObject | prefab | The GameObject prefab to spawn. |
float | duration | The total duration for spawning objects. |
float | frequency | The frequency of spawning objects. |
Vector3 | spawnPos | The spawn position for the objects. |
Vector2Int | spawnAmountRange | The range for the number of objects to spawn. |
Vector2 | speedRange | The range of speeds for flinging. |
Vector2 | angleRange | The range of angles for flinging. |
Vector2 | originVariation | The variation in origin positions. |
Vector2 | scaleRange | The range of scales for the spawned objects. |
Returns
Type | Description |
---|---|
IEnumerator | An IEnumerator for coroutine usage. |
SpawnRandomObjectsPooled(GameObject, Vector3, Vector2Int, Vector2, Vector2, Vector2)
Spawns a specified number of random objects and flings them based on the provided parameters.
Declaration
public static GameObject[] SpawnRandomObjectsPooled(GameObject prefab, Vector3 spawnPos, Vector2Int spawnAmountRange, Vector2 speedRange, Vector2 angleRange, Vector2 originVariation)
Parameters
Type | Name | Description |
---|---|---|
GameObject | prefab | The GameObject prefab to spawn. |
Vector3 | spawnPos | The spawn position for the objects. |
Vector2Int | spawnAmountRange | The range for the number of objects to spawn. |
Vector2 | speedRange | The range of speeds for flinging. |
Vector2 | angleRange | The range of angles for flinging. |
Vector2 | originVariation | The variation in origin positions. |
Returns
Type | Description |
---|---|
GameObject[] | An array of spawned and flung GameObjects. |
SpawnRandomObjectsPooledOverTime(GameObject, float, float, Func<Vector3>, Vector2Int, Vector2, Vector2, Vector2, Vector2)
Spawns random pooled objects over a specified duration with a given frequency, and flings them based on the provided parameters.
Declaration
public static IEnumerator SpawnRandomObjectsPooledOverTime(GameObject prefab, float duration, float frequency, Func<Vector3> spawnPos, Vector2Int spawnAmountRange, Vector2 speedRange, Vector2 angleRange, Vector2 originVariation, Vector2 scaleRange)
Parameters
Type | Name | Description |
---|---|---|
GameObject | prefab | The GameObject prefab to spawn. |
float | duration | The total duration for spawning objects. |
float | frequency | The frequency of spawning objects. |
Func<Vector3> | spawnPos | The spawn position for the objects. |
Vector2Int | spawnAmountRange | The range for the number of objects to spawn. |
Vector2 | speedRange | The range of speeds for flinging. |
Vector2 | angleRange | The range of angles for flinging. |
Vector2 | originVariation | The variation in origin positions. |
Vector2 | scaleRange | The range of scales for the spawned objects. |
Returns
Type | Description |
---|---|
IEnumerator | An IEnumerator for coroutine usage. |
SpawnRandomObjectsPooledOverTime(GameObject, float, float, Vector3, Vector2Int, Vector2, Vector2, Vector2, Vector2)
Spawns random pooled objects over a specified duration with a given frequency, and flings them based on the provided parameters.
Declaration
public static IEnumerator SpawnRandomObjectsPooledOverTime(GameObject prefab, float duration, float frequency, Vector3 spawnPos, Vector2Int spawnAmountRange, Vector2 speedRange, Vector2 angleRange, Vector2 originVariation, Vector2 scaleRange)
Parameters
Type | Name | Description |
---|---|---|
GameObject | prefab | The GameObject prefab to spawn. |
float | duration | The total duration for spawning objects. |
float | frequency | The frequency of spawning objects. |
Vector3 | spawnPos | The spawn position for the objects. |
Vector2Int | spawnAmountRange | The range for the number of objects to spawn. |
Vector2 | speedRange | The range of speeds for flinging. |
Vector2 | angleRange | The range of angles for flinging. |
Vector2 | originVariation | The variation in origin positions. |
Vector2 | scaleRange | The range of scales for the spawned objects. |
Returns
Type | Description |
---|---|
IEnumerator | An IEnumerator for coroutine usage. |