Commit 0c74ca6c authored by Tommé Nöll's avatar Tommé Nöll
Browse files

added wind zones

parent c023f793
This diff is collapsed.
fileFormatVersion: 2
guid: 5916f00562e9cb5eb97b95a471c1ef03
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -2697,46 +2697,12 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1163664074}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -2, z: 0}
m_LocalScale: {x: 17.825, y: 1, z: 1}
m_LocalPosition: {x: -0.095, y: -2.065, z: 0}
m_LocalScale: {x: 61.23308, y: 1.12896, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!84 &1197396558
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 3
m_Width: 1181
m_Height: 559
m_AntiAliasing: 1
m_DepthFormat: 0
m_ColorFormat: 21
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
--- !u!1001 &1202668657
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -2752,12 +2718,12 @@ PrefabInstance:
- target: {fileID: 264577551908436770, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_LocalPosition.x
value: -2.81
value: -25.99
objectReference: {fileID: 0}
- target: {fileID: 264577551908436770, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.8
value: 0.99
objectReference: {fileID: 0}
- target: {fileID: 264577551908436770, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
......@@ -2804,6 +2770,27 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 264577551908436771, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 9198288501141113301, guid: 0070d6c3cbeddfc4b83c3545ad5bdd41,
type: 3}
- target: {fileID: 264577551908436771, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_Size.x
value: 2.56
objectReference: {fileID: 0}
- target: {fileID: 264577551908436771, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_Size.y
value: 2.96
objectReference: {fileID: 0}
- target: {fileID: 264577551908436771, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_WasSpriteAssigned
value: 1
objectReference: {fileID: 0}
- target: {fileID: 264577551908436768, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_SpriteTilingProperty.oldSize.x
......@@ -2824,26 +2811,20 @@ PrefabInstance:
propertyPath: m_SpriteTilingProperty.newSize.y
value: 2.96
objectReference: {fileID: 0}
- target: {fileID: 264577551908436771, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 9198288501141113301, guid: 0070d6c3cbeddfc4b83c3545ad5bdd41,
- target: {fileID: 264577551908436768, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
- target: {fileID: 264577551908436771, guid: a1e0107a2375e1140a669c1da0647f9a,
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 264577551908436768, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_Size.x
value: 2.56
value: 0.66
objectReference: {fileID: 0}
- target: {fileID: 264577551908436771, guid: a1e0107a2375e1140a669c1da0647f9a,
- target: {fileID: 264577551908436768, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_Size.y
value: 2.96
objectReference: {fileID: 0}
- target: {fileID: 264577551908436771, guid: a1e0107a2375e1140a669c1da0647f9a,
type: 3}
propertyPath: m_WasSpriteAssigned
value: 1
value: 1.22
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a1e0107a2375e1140a669c1da0647f9a, type: 3}
......@@ -3441,6 +3422,40 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 1398391205}
m_PrefabAsset: {fileID: 0}
--- !u!84 &1400425198
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 3
m_Width: 1181
m_Height: 559
m_AntiAliasing: 1
m_DepthFormat: 0
m_ColorFormat: 21
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 1
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
--- !u!1001 &1458074145
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -4220,6 +4235,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 561089203}
m_Modifications:
- target: {fileID: 1362442974637441874, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: m_Name
value: CorruptionZone (1)
objectReference: {fileID: 0}
- target: {fileID: 146384502658720480, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: m_RootOrder
......@@ -4245,11 +4265,6 @@ PrefabInstance:
propertyPath: m_LocalScale.x
value: 4.02
objectReference: {fileID: 0}
- target: {fileID: 1362442974637441874, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: m_Name
value: CorruptionZone (1)
objectReference: {fileID: 0}
- target: {fileID: 1362442974637441875, guid: 47edb6c4e8357676a9cb004f1655d229,
type: 3}
propertyPath: maxStrengthDistanceFactor
......@@ -5117,6 +5132,75 @@ Transform:
type: 3}
m_PrefabInstance: {fileID: 653046728}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1611726988065383798
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1611726988538008502, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_Name
value: Wind Zone
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_LocalPosition.x
value: -15.03
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_LocalPosition.y
value: 2.34
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_LocalRotation.z
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_LocalRotation.w
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1611726988538008503, guid: 5916f00562e9cb5eb97b95a471c1ef03,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 180
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5916f00562e9cb5eb97b95a471c1ef03, type: 3}
--- !u!1001 &2554834490897211998
PrefabInstance:
m_ObjectHideFlags: 0
......@@ -5335,12 +5419,12 @@ PrefabInstance:
- target: {fileID: 8811539149977030266, guid: 388a7af523fdebaafad4a5d1ae1a896b,
type: 3}
propertyPath: m_LocalPosition.x
value: 5.92
value: -22.46
objectReference: {fileID: 0}
- target: {fileID: 8811539149977030266, guid: 388a7af523fdebaafad4a5d1ae1a896b,
type: 3}
propertyPath: m_LocalPosition.y
value: 2.85
value: 2.34
objectReference: {fileID: 0}
- target: {fileID: 8811539149977030266, guid: 388a7af523fdebaafad4a5d1ae1a896b,
type: 3}
......@@ -5401,7 +5485,7 @@ PrefabInstance:
type: 3}
propertyPath: m_TargetTexture
value:
objectReference: {fileID: 1197396558}
objectReference: {fileID: 1400425198}
- target: {fileID: 8811539148413200140, guid: 388a7af523fdebaafad4a5d1ae1a896b,
type: 3}
propertyPath: corruptionMap
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using UnityEngine.ParticleSystemModule;
public class WindZone2D : MonoBehaviour
{
public float strength = 10f;
public float pulseDuration = 5f;
public float pauseDuration = 3f;
public float transitionDuration = 1f;
public float offset = 0f;
private float currentStrengthFactor;
private List<Collider2D> collidingObjects;
private Collider2D collider;
private ParticleSystem particleSystem;
private ParticleSystemForceField particleForceField;
// Start is called before the first frame update
void Start()
{
collidingObjects = new List<Collider2D>();
collider = GetComponent<Collider2D>();
particleSystem = transform.GetChild(0).gameObject.GetComponent<ParticleSystem>();
particleForceField = particleSystem.transform.GetChild(0).gameObject.GetComponent<ParticleSystemForceField>();
UpdateParticleSystemSize();
}
// Update is called once per frame
void Update()
{
float cycleLength = pulseDuration + pauseDuration;
float currentTime = (Time.time + offset) % cycleLength;
float transitionPoint;
if (currentTime < pulseDuration)
{
float timeInTransition = currentTime - (pulseDuration - transitionDuration);
transitionPoint = timeInTransition / transitionDuration;
transitionPoint = 1 - transitionPoint;
}
else
{
currentTime -= pulseDuration;
float timeInTransition = currentTime - (pauseDuration - transitionDuration);
transitionPoint = timeInTransition / transitionDuration;
}
currentStrengthFactor = Mathf.Clamp(transitionPoint, 0, 1);
ApplyStrength();
}
private void ApplyStrength()
{
foreach (Collider2D other in collidingObjects)
{
other.attachedRigidbody.AddForce(transform.right * strength * currentStrengthFactor);
}
particleForceField.directionX = currentStrengthFactor * 5;
var emission = particleSystem.emission;
emission.rateOverTime = currentStrengthFactor * 10 + 3;
//particleMain.startSpeed = currentStrength * 2;
}
private void UpdateParticleSystemSize()
{
Bounds bounds = collider.bounds;
ParticleSystem.ShapeModule shape = particleSystem.shape;
shape.scale = bounds.size;
bounds.extents += new Vector3(0, 0, 0.1f);
particleForceField.transform.localScale = bounds.extents;
ParticleSystemForceField dragField = particleSystem.transform.GetChild(1).gameObject.GetComponent<ParticleSystemForceField>();
dragField.transform.localScale = bounds.extents;
}
void OnTriggerEnter2D(Collider2D other)
{
collidingObjects.Add(other);
}
void OnTriggerExit2D(Collider2D other)
{
collidingObjects.Remove(other);
}
}
fileFormatVersion: 2
guid: 9d42482bee68f04a894905e35b7a8894
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -53,4 +53,4 @@ Physics2DSettings:
m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432}
m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745}
m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804}
m_LayerCollisionMatrix: ffd9ffffffd8ffffffd8ffffffffffffffd8ffffffd8ffffffffffffffffffffc9feffffc8fdffffc8fbffffffffffffffffffffc8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3fffffffbf
\ No newline at end of file
m_LayerCollisionMatrix: ffdbffffffd8ffffffd8ffffffffffffffd8ffffffd8ffffffffffffffffffffc9feffffc9fdffffc8fbffffffffffffffffffffc8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff3fffffffbf
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment