Fire off impulses on booster taps
This commit is contained in:
@@ -11,6 +11,7 @@ GameObject:
|
||||
- component: {fileID: 5228380266581535650}
|
||||
- component: {fileID: 7671014600744692184}
|
||||
- component: {fileID: 4981820558408988033}
|
||||
- component: {fileID: 4448843358972162772}
|
||||
m_Layer: 0
|
||||
m_Name: BoosterOpeningPage
|
||||
m_TagString: Untagged
|
||||
@@ -82,6 +83,60 @@ MonoBehaviour:
|
||||
cardSpacing: 50
|
||||
cardRevealDelay: 0.5
|
||||
boosterDisappearDuration: 0.5
|
||||
impulseSource: {fileID: 4448843358972162772}
|
||||
--- !u!114 &4448843358972162772
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 498445838423597154}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 180ecf9b41d478f468eb3e9083753217, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineImpulseSource
|
||||
ImpulseDefinition:
|
||||
ImpulseChannel: -1
|
||||
ImpulseShape: 2
|
||||
CustomImpulseShape:
|
||||
serializedVersion: 2
|
||||
m_Curve: []
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
ImpulseDuration: 0.2
|
||||
ImpulseType: 0
|
||||
DissipationRate: 0.25
|
||||
RawSignal: {fileID: 0}
|
||||
AmplitudeGain: 1
|
||||
FrequencyGain: 1
|
||||
RepeatMode: 0
|
||||
Randomize: 1
|
||||
TimeEnvelope:
|
||||
AttackShape:
|
||||
serializedVersion: 2
|
||||
m_Curve: []
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
DecayShape:
|
||||
serializedVersion: 2
|
||||
m_Curve: []
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
AttackTime: 0
|
||||
SustainTime: 0.2
|
||||
DecayTime: 0.7
|
||||
ScaleWithImpact: 1
|
||||
HoldForever: 0
|
||||
ImpactRadius: 100
|
||||
DirectionMode: 0
|
||||
DissipationMode: 2
|
||||
DissipationDistance: 100
|
||||
PropagationSpeed: 343
|
||||
DefaultVelocity: {x: -0.2, y: -1, z: 0}
|
||||
--- !u!1 &2154569789549533728
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -450309,6 +450309,7 @@ GameObject:
|
||||
- component: {fileID: 1137411210}
|
||||
- component: {fileID: 1137411214}
|
||||
- component: {fileID: 1137411213}
|
||||
- component: {fileID: 1137411215}
|
||||
m_Layer: 0
|
||||
m_Name: CinemachineCamera
|
||||
m_TagString: Untagged
|
||||
@@ -450413,6 +450414,30 @@ MonoBehaviour:
|
||||
RotationDamping: {x: 1, y: 1, z: 1}
|
||||
QuaternionDamping: 1
|
||||
FollowOffset: {x: 0, y: 0, z: -10}
|
||||
--- !u!114 &1137411215
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1137411209}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 00b2d199b96b516448144ab30fb26aed, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineImpulseListener
|
||||
ApplyAfter: 2
|
||||
ChannelMask: 1
|
||||
Gain: 1
|
||||
Use2DDistance: 0
|
||||
UseCameraSpace: 1
|
||||
SignalCombinationMode: 0
|
||||
ReactionSettings:
|
||||
m_SecondaryNoise: {fileID: 0}
|
||||
AmplitudeGain: 1
|
||||
FrequencyGain: 1
|
||||
Duration: 1
|
||||
m_NoiseOffsets: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1137721150
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
"Unity.InputSystem",
|
||||
"Unity.TextMeshPro",
|
||||
"OptimizedRope",
|
||||
"Unity.Cinemachine",
|
||||
"AudioSourceEvents",
|
||||
"NewAssembly",
|
||||
"SkiaSharp.Unity",
|
||||
"SkiaSharp.Editor",
|
||||
"SkiaSharp"
|
||||
"SkiaSharp",
|
||||
"Unity.Cinemachine"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AppleHills.Data.CardSystem;
|
||||
@@ -7,8 +7,10 @@ using Pixelplacement;
|
||||
using UI.Core;
|
||||
using UI.CardSystem.DragDrop;
|
||||
using UI.DragAndDrop.Core;
|
||||
using Unity.Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI.CardSystem
|
||||
{
|
||||
@@ -35,6 +37,7 @@ namespace UI.CardSystem
|
||||
[Header("Settings")]
|
||||
[SerializeField] private float cardRevealDelay = 0.5f;
|
||||
[SerializeField] private float boosterDisappearDuration = 0.5f;
|
||||
[SerializeField] private CinemachineImpulseSource impulseSource;
|
||||
|
||||
private int _availableBoosterCount;
|
||||
private BoosterPackDraggable _currentBoosterInCenter;
|
||||
@@ -212,12 +215,22 @@ namespace UI.CardSystem
|
||||
{
|
||||
Debug.Log($"[BoosterOpeningPage] Booster tapped: {currentTaps}/{maxTaps}");
|
||||
|
||||
// Calculate shake intensity (increases with each tap)
|
||||
float shakeIntensity = currentTaps / (float)maxTaps;
|
||||
float shakeAmount = 10f + (shakeIntensity * 30f); // 10 to 40 units
|
||||
// Fire Cinemachine impulse with random velocity (excluding Z)
|
||||
if (impulseSource != null)
|
||||
{
|
||||
// Generate random velocity vector (X and Y only, Z = 0)
|
||||
Vector3 randomVelocity = new Vector3(
|
||||
Random.Range(-1f, 1f),
|
||||
Random.Range(-1f, 1f),
|
||||
0f
|
||||
);
|
||||
|
||||
// TODO: Shake visual feedback
|
||||
// This would be handled by BoosterPackVisual if we add a shake method
|
||||
// Normalize to ensure consistent strength
|
||||
randomVelocity.Normalize();
|
||||
|
||||
// Generate the impulse with strength 1 and random velocity
|
||||
impulseSource.GenerateImpulse(randomVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user