MOD!
This commit is contained in:
@@ -14,18 +14,23 @@ namespace Lofelt.NiceVibrations
|
||||
public MMUIShaker LogoShaker;
|
||||
public AudioSource EmphasisAudioSource;
|
||||
|
||||
#if MM_PHYSICS2D
|
||||
protected Rigidbody2D _rigidBody;
|
||||
#endif
|
||||
protected float _lastRaycastTimestamp = 0f;
|
||||
protected Animator _ballAnimator;
|
||||
protected int _hitAnimationParameter;
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
#if MM_PHYSICS2D
|
||||
_rigidBody = this.gameObject.GetComponent<Rigidbody2D>();
|
||||
#endif
|
||||
_ballAnimator = this.gameObject.GetComponent<Animator>();
|
||||
_hitAnimationParameter = Animator.StringToHash("Hit");
|
||||
}
|
||||
|
||||
#if MM_PHYSICS2D
|
||||
protected virtual void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
if (WallMask == (WallMask | (1 << collision.gameObject.layer)))
|
||||
@@ -56,15 +61,18 @@ namespace Lofelt.NiceVibrations
|
||||
_rigidBody.AddForce(Vector2.up * 2500f);
|
||||
StartCoroutine(LogoShaker.Shake(0.2f));
|
||||
}
|
||||
#endif
|
||||
|
||||
protected virtual void HitWall()
|
||||
{
|
||||
#if MM_PHYSICS2D
|
||||
float amplitude = _rigidBody.linearVelocity.magnitude / 100f;
|
||||
HapticPatterns.PlayEmphasis(amplitude, 0.7f);
|
||||
EmphasisAudioSource.volume = amplitude;
|
||||
StartCoroutine(LogoShaker.Shake(0.2f));
|
||||
EmphasisAudioSource.Play();
|
||||
_ballAnimator.SetTrigger(_hitAnimationParameter);
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual void HitPusher()
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 183370
|
||||
packageName: Feel
|
||||
packageVersion: 5.7
|
||||
assetPath: Assets/Feel/NiceVibrations/Demo/DemoAssets/BallDemo/Scripts/BallDemoBall.cs
|
||||
uploadId: 779587
|
||||
packageVersion: 5.8
|
||||
assetPath: Assets/OtherPlugins/Feel/NiceVibrations/Demo/DemoAssets/BallDemo/Scripts/BallDemoBall.cs
|
||||
uploadId: 799856
|
||||
|
||||
@@ -15,7 +15,9 @@ namespace Lofelt.NiceVibrations
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
#if MM_PHYSICS2D
|
||||
Physics2D.gravity = Gravity;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 183370
|
||||
packageName: Feel
|
||||
packageVersion: 5.7
|
||||
assetPath: Assets/Feel/NiceVibrations/Demo/DemoAssets/BallDemo/Scripts/BallDemoManager.cs
|
||||
uploadId: 779587
|
||||
packageVersion: 5.8
|
||||
assetPath: Assets/OtherPlugins/Feel/NiceVibrations/Demo/DemoAssets/BallDemo/Scripts/BallDemoManager.cs
|
||||
uploadId: 799856
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Lofelt.NiceVibrations
|
||||
public class BallDemoWall : MonoBehaviour
|
||||
{
|
||||
protected RectTransform _rectTransform;
|
||||
#if MM_PHYSICS2D
|
||||
protected BoxCollider2D _boxCollider2D;
|
||||
|
||||
protected virtual void OnEnable()
|
||||
@@ -18,5 +19,6 @@ namespace Lofelt.NiceVibrations
|
||||
|
||||
_boxCollider2D.size = new Vector2(_rectTransform.rect.size.x, _rectTransform.rect.size.y);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 183370
|
||||
packageName: Feel
|
||||
packageVersion: 5.7
|
||||
assetPath: Assets/Feel/NiceVibrations/Demo/DemoAssets/BallDemo/Scripts/BallDemoWall.cs
|
||||
uploadId: 779587
|
||||
packageVersion: 5.8
|
||||
assetPath: Assets/OtherPlugins/Feel/NiceVibrations/Demo/DemoAssets/BallDemo/Scripts/BallDemoWall.cs
|
||||
uploadId: 799856
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Lofelt.NiceVibrations
|
||||
public BallDemoBall TargetBall;
|
||||
protected Vector2 _direction;
|
||||
|
||||
#if MM_PHYSICS2D
|
||||
protected virtual void OnTriggerEnter2D(Collider2D collider)
|
||||
{
|
||||
if (collider.gameObject != TargetBall.gameObject)
|
||||
@@ -25,5 +26,6 @@ namespace Lofelt.NiceVibrations
|
||||
collider.attachedRigidbody.AddForce(_direction * Force);
|
||||
TargetBall.HitPusher();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 183370
|
||||
packageName: Feel
|
||||
packageVersion: 5.7
|
||||
assetPath: Assets/Feel/NiceVibrations/Demo/DemoAssets/BallDemo/Scripts/BallPusher.cs
|
||||
uploadId: 779587
|
||||
packageVersion: 5.8
|
||||
assetPath: Assets/OtherPlugins/Feel/NiceVibrations/Demo/DemoAssets/BallDemo/Scripts/BallPusher.cs
|
||||
uploadId: 799856
|
||||
|
||||
@@ -13,6 +13,6 @@ AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 183370
|
||||
packageName: Feel
|
||||
packageVersion: 5.7
|
||||
assetPath: Assets/Feel/NiceVibrations/Demo/DemoAssets/BallDemo/Scripts/BallTouchZone.cs
|
||||
uploadId: 779587
|
||||
packageVersion: 5.8
|
||||
assetPath: Assets/OtherPlugins/Feel/NiceVibrations/Demo/DemoAssets/BallDemo/Scripts/BallTouchZone.cs
|
||||
uploadId: 799856
|
||||
|
||||
Reference in New Issue
Block a user