Skip to content

Commit

Permalink
slightly imrove edge particle effect towards #32 (not finished)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealCatherine committed Jan 31, 2018
1 parent 430e37d commit f4c12a8
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 105 deletions.
102 changes: 53 additions & 49 deletions StageMechanic/Assets/Game Elements/Blocks/Interfaces/AbstractBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ internal IEnumerator AnimateMove(Vector3 origin, Vector3 target, float duration,
yield return null;
}
_gravityDirty = true;
MotionState = BlockMotionState.Unknown;
MotionState = BlockMotionState.Grounded;
UpdateNeighborsCache();
SetGravityEnabledByMotionState();
//TODO NotLikeThiiiiiiisssssss do it in the ice block class handling blocks on top
Expand Down Expand Up @@ -621,12 +621,12 @@ internal void SetMotionStateBySupport()
{
Profiler.BeginSample("Edged");
MotionState = BlockMotionState.Edged;
if (oldState == BlockMotionState.Falling && EdgeEffect != null)
if (oldState != BlockMotionState.Unknown && oldState != BlockMotionState.Edged && EdgeEffect != null)
{
if(blocksBelow[LEFT] != null)
BlockManager.PlayEffect(this, EdgeEffect, EdgeEffectScale, EdgeEffectDuration, new Vector3(-0.5f, -0.5f, -1f));
BlockManager.PlayEffect(this, EdgeEffect, EdgeEffectScale, -1, new Vector3(-0.5f, -0.5f, -0.5f));
if (blocksBelow[RIGHT] != null)
BlockManager.PlayEffect(this, EdgeEffect, EdgeEffectScale, EdgeEffectDuration, new Vector3(0.5f, -0.5f, -1f),Quaternion.Euler(0f,180f,0f));
BlockManager.PlayEffect(this, EdgeEffect, EdgeEffectScale, -1, new Vector3(0.5f, -0.5f, -0.5f));
//TODO get this on edged sides
}
if (MotionState != oldState)
Expand Down Expand Up @@ -738,54 +738,58 @@ private IEnumerator DoHoverAnimation()
_gravityDirty = true;
yield break;
}
rb.constraints = (RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezePosition);
transform.Rotate(0f, 0f, 5f);
yield return new WaitForSeconds(0.1f);
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
transform.Rotate(0f, 0f, -10f);
yield return new WaitForSeconds(0.1f);
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
transform.Rotate(0f, 0f, 10f);
yield return new WaitForSeconds(0.1f);
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
transform.Rotate(0f, 0f, -5f);
yield return new WaitForSeconds(0.1f);
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
transform.rotation = Quaternion.identity;
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
yield return new WaitForSeconds(0.5f);
if (MotionState != BlockMotionState.Hovering)
if (BlockManager.PlayMode)
{
_startedHover = false;
_gravityDirty = true;
yield break;
rb.constraints = (RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezePosition);
transform.Rotate(0f, 0f, 5f);
yield return new WaitForSeconds(0.1f);
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
transform.Rotate(0f, 0f, -10f);
yield return new WaitForSeconds(0.1f);
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
transform.Rotate(0f, 0f, 10f);
yield return new WaitForSeconds(0.1f);
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
transform.Rotate(0f, 0f, -5f);
yield return new WaitForSeconds(0.1f);
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
transform.rotation = Quaternion.identity;
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
yield return new WaitForSeconds(0.5f);
if (MotionState != BlockMotionState.Hovering)
{
_startedHover = false;
_gravityDirty = true;
yield break;
}
}
_startedHover = false;
_gravityDirty = true;
MotionState = BlockMotionState.Falling;
}
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GameObject:
- component: {fileID: 400000}
- component: {fileID: 19900002}
- component: {fileID: 19800002}
m_Layer: 0
m_Layer: 1
m_Name: Glow
m_TagString: Untagged
m_Icon: {fileID: 0}
Expand All @@ -27,9 +27,7 @@ GameObject:
- component: {fileID: 400004}
- component: {fileID: 19900000}
- component: {fileID: 19800000}
- component: {fileID: 13500000}
- component: {fileID: 11400000}
m_Layer: 0
m_Layer: 1
m_Name: Edge Effect
m_TagString: Untagged
m_Icon: {fileID: 0}
Expand All @@ -56,51 +54,24 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100004}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalPosition: {x: -0.5, y: -0.5, z: 0.5}
m_LocalScale: {x: 2, y: 2, z: 1}
m_Children:
- {fileID: 400000}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5d44a238286f6904198ab78e914c229d, type: 3}
m_Name:
m_EditorClassIdentifier:
effectAngle: 20
effectWidth: 2
effectDistance: 32
force: 140
--- !u!135 &13500000
SphereCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100004}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 16
m_Center: {x: 0, y: 0, z: 16}
--- !u!198 &19800000
ParticleSystem:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100004}
serializedVersion: 5
lengthInSec: 0.1
lengthInSec: 0.15
simulationSpeed: 1
stopAction: 0
looping: 1
looping: 0
prewarm: 0
playOnAwake: 1
useUnscaledTime: 0
Expand Down Expand Up @@ -338,8 +309,8 @@ ParticleSystem:
startSize:
serializedVersion: 2
minMaxState: 3
scalar: 1.4
minScalar: 1.2
scalar: 1
minScalar: 1
maxCurve:
serializedVersion: 2
m_Curve:
Expand Down Expand Up @@ -582,7 +553,7 @@ ParticleSystem:
m_PostInfinity: 2
m_RotationOrder: 4
randomizeRotationDirection: 0
maxNumParticles: 1000
maxNumParticles: 2000
size3D: 0
rotation3D: 0
gravityModifier:
Expand Down Expand Up @@ -641,7 +612,7 @@ ParticleSystem:
ShapeModule:
serializedVersion: 5
enabled: 0
type: 4
type: 2
angle: 1
length: 5
boxThickness: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -789,7 +760,7 @@ ParticleSystem:
rateOverTime:
serializedVersion: 2
minMaxState: 0
scalar: 80
scalar: 300
minScalar: 10
maxCurve:
serializedVersion: 2
Expand Down Expand Up @@ -905,26 +876,17 @@ ParticleSystem:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0.4821982
inSlope: 22.340551
outSlope: 22.340551
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.006385207
value: 0.6492229
time: 0.012615204
value: 1
inSlope: 0.06347895
outSlope: 0.06347895
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.22058833
time: 0.12933736
value: 0
inSlope: -0.7978762
outSlope: -0.7978762
tangentMode: 0
Expand Down Expand Up @@ -5356,16 +5318,16 @@ ParticleSystem:
m_Curve:
- serializedVersion: 3
time: 0
value: 0.09623331
value: 1
inSlope: 2.58101
outSlope: 2.58101
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.32146552
time: 0.022296797
value: 0
inSlope: -0.7978762
outSlope: -0.7978762
tangentMode: 0
Expand Down

0 comments on commit f4c12a8

Please sign in to comment.