Commit ab099649 authored by wanqing's avatar wanqing

音效默认播放,爪子上升下降音效逻辑修改

parent 7e75d0a8
...@@ -27,7 +27,7 @@ public class SettingPanel : MonoBehaviour ...@@ -27,7 +27,7 @@ public class SettingPanel : MonoBehaviour
} }
else else
{ {
m_vibrationImageObj.SetActive(false); m_vibrationImageObj.SetActive(true);
} }
string varStr2 = GlobalConfig.SoundKey; string varStr2 = GlobalConfig.SoundKey;
if (LocalRecord.HasKey(varStr2)) if (LocalRecord.HasKey(varStr2))
...@@ -36,7 +36,7 @@ public class SettingPanel : MonoBehaviour ...@@ -36,7 +36,7 @@ public class SettingPanel : MonoBehaviour
} }
else else
{ {
m_soundImageObj.SetActive(false); m_soundImageObj.SetActive(true);
} }
string varStr3 = GlobalConfig.BgmKey; string varStr3 = GlobalConfig.BgmKey;
if (LocalRecord.HasKey(varStr3)) if (LocalRecord.HasKey(varStr3))
...@@ -45,7 +45,7 @@ public class SettingPanel : MonoBehaviour ...@@ -45,7 +45,7 @@ public class SettingPanel : MonoBehaviour
} }
else else
{ {
m_bgmImageObj.SetActive(false); m_bgmImageObj.SetActive(true);
} }
} }
//震动 //震动
......
...@@ -70,7 +70,9 @@ public class ChainRopeView : MonoBehaviour ...@@ -70,7 +70,9 @@ public class ChainRopeView : MonoBehaviour
private RectTransform m_thumbRT;//摇杆 private RectTransform m_thumbRT;//摇杆
private Outlinable m_outlinable;//插件脚本 private Outlinable m_outlinable;//插件脚本
private bool m_bIsClawUp = false;//是否爪子在上升 private bool m_bIsClawUp = false;//是否爪子在上升
private AudioSource m_clawDownOrUpAudioSource;//下降上升音乐,需要循环播放 //private AudioSource m_clawDownOrUpAudioSource;//下降上升音乐,需要循环播放
private bool m_bControlPlayAudio = true;//控制播放音效
void Awake() void Awake()
{ {
...@@ -268,7 +270,9 @@ public class ChainRopeView : MonoBehaviour ...@@ -268,7 +270,9 @@ public class ChainRopeView : MonoBehaviour
m_thumbRT.sizeDelta = varThumb; m_thumbRT.sizeDelta = varThumb;
if (rope.isLoaded && rope.restLength <= m_ropeStartLength) if (rope.isLoaded && rope.restLength <= m_ropeStartLength)
{ {
m_clawDownOrUpAudioSource = GameServices.audioServices.GetPlayAudioSource(GameServices.configService.audioConfig.clawDownOrUp); m_bControlPlayAudio = true;
GameServices.audioServices.PlayAudio(GameServices.configService.audioConfig.clawDownOrUp);
//m_clawDownOrUpAudioSource = GameServices.audioServices.GetPlayAudioSource(GameServices.configService.audioConfig.clawDownOrUp);
m_lightObj.SetParent(m_clawBody.parent.parent); m_lightObj.SetParent(m_clawBody.parent.parent);
if (m_bIsCatch) if (m_bIsCatch)
{ {
...@@ -459,11 +463,11 @@ public class ChainRopeView : MonoBehaviour ...@@ -459,11 +463,11 @@ public class ChainRopeView : MonoBehaviour
} }
DestroyImmediate(blueprint); DestroyImmediate(blueprint);
DetachHook(); DetachHook();
if (m_clawDownOrUpAudioSource) //if (m_clawDownOrUpAudioSource)
{ //{
GameServices.audioServices.AudioPlayFinished(m_clawDownOrUpAudioSource); // GameServices.audioServices.AudioPlayFinished(m_clawDownOrUpAudioSource);
m_clawDownOrUpAudioSource = null; // m_clawDownOrUpAudioSource = null;
} //}
} }
/** /**
...@@ -579,16 +583,21 @@ public class ChainRopeView : MonoBehaviour ...@@ -579,16 +583,21 @@ public class ChainRopeView : MonoBehaviour
//抓到的物体放在正确位置后绳子要回去 //抓到的物体放在正确位置后绳子要回去
if (rope.restLength > m_ropeStartLength) if (rope.restLength > m_ropeStartLength)
{ {
if(m_bControlPlayAudio)
{
m_bControlPlayAudio = false;
GameServices.audioServices.PlayAudio(GameServices.configService.audioConfig.clawDownOrUp);
}
m_bIsClawUp = true; m_bIsClawUp = true;
cursor.ChangeLength(rope.restLength - GameServices.configService.playerConfig.ropeReduceSpeed * Time.deltaTime); cursor.ChangeLength(rope.restLength - GameServices.configService.playerConfig.ropeReduceSpeed * Time.deltaTime);
} }
else else
{ {
if (m_clawDownOrUpAudioSource) //if (m_clawDownOrUpAudioSource)
{ //{
GameServices.audioServices.AudioPlayFinished(m_clawDownOrUpAudioSource); // GameServices.audioServices.AudioPlayFinished(m_clawDownOrUpAudioSource);
m_clawDownOrUpAudioSource = null; // m_clawDownOrUpAudioSource = null;
} //}
m_bIsCatch = false; m_bIsCatch = false;
m_bIsNeedRotate = true; m_bIsNeedRotate = true;
m_bIsCathchObjHitTarget = false; m_bIsCathchObjHitTarget = false;
...@@ -607,17 +616,22 @@ public class ChainRopeView : MonoBehaviour ...@@ -607,17 +616,22 @@ public class ChainRopeView : MonoBehaviour
{ {
if (rope.restLength > m_ropeStartLength) if (rope.restLength > m_ropeStartLength)
{ {
if (m_bControlPlayAudio)
{
m_bControlPlayAudio = false;
GameServices.audioServices.PlayAudio(GameServices.configService.audioConfig.clawDownOrUp);
}
m_bIsClawUp = true; m_bIsClawUp = true;
cursor.ChangeLength(rope.restLength - GameServices.configService.playerConfig.ropeReduceSpeed * Time.deltaTime); cursor.ChangeLength(rope.restLength - GameServices.configService.playerConfig.ropeReduceSpeed * Time.deltaTime);
} }
else else
{ {
SetJoyStickDirectTrans(m_topCollider.transform); SetJoyStickDirectTrans(m_topCollider.transform);
if (m_clawDownOrUpAudioSource) //if (m_clawDownOrUpAudioSource)
{ //{
GameServices.audioServices.AudioPlayFinished(m_clawDownOrUpAudioSource); // GameServices.audioServices.AudioPlayFinished(m_clawDownOrUpAudioSource);
m_clawDownOrUpAudioSource = null; // m_clawDownOrUpAudioSource = null;
} //}
} }
} }
} }
...@@ -651,16 +665,21 @@ public class ChainRopeView : MonoBehaviour ...@@ -651,16 +665,21 @@ public class ChainRopeView : MonoBehaviour
//碰到物体之后爪子最小角度开始绳子缩回去 //碰到物体之后爪子最小角度开始绳子缩回去
if (rope.restLength > m_ropeStartLength) if (rope.restLength > m_ropeStartLength)
{ {
if (m_bControlPlayAudio)
{
m_bControlPlayAudio = false;
GameServices.audioServices.PlayAudio(GameServices.configService.audioConfig.clawDownOrUp);
}
m_bIsClawUp = true; m_bIsClawUp = true;
cursor.ChangeLength(rope.restLength - GameServices.configService.playerConfig.ropeReduceSpeed * Time.deltaTime); cursor.ChangeLength(rope.restLength - GameServices.configService.playerConfig.ropeReduceSpeed * Time.deltaTime);
} }
else else
{ {
if (m_clawDownOrUpAudioSource) //if (m_clawDownOrUpAudioSource)
{ //{
GameServices.audioServices.AudioPlayFinished(m_clawDownOrUpAudioSource); // GameServices.audioServices.AudioPlayFinished(m_clawDownOrUpAudioSource);
m_clawDownOrUpAudioSource = null; // m_clawDownOrUpAudioSource = null;
} //}
m_bIsNeedRotate = true; m_bIsNeedRotate = true;
ResetLightPos(); ResetLightPos();
SetJoyStickDirectTrans(m_topCollider.transform); SetJoyStickDirectTrans(m_topCollider.transform);
......
...@@ -86,7 +86,7 @@ public class AudioServices : MonoBehaviour ...@@ -86,7 +86,7 @@ public class AudioServices : MonoBehaviour
public void PlayBgm(AudioClip clip) public void PlayBgm(AudioClip clip)
{ {
if(!LocalRecord.HasKey(GlobalConfig.BgmKey) || LocalRecord.GetIntRecord(GlobalConfig.BgmKey) == 0) if(LocalRecord.HasKey(GlobalConfig.BgmKey) && LocalRecord.GetIntRecord(GlobalConfig.BgmKey) == 0)
{ {
return; return;
} }
...@@ -114,7 +114,7 @@ public class AudioServices : MonoBehaviour ...@@ -114,7 +114,7 @@ public class AudioServices : MonoBehaviour
public void PlayAudio(AudioClip clip, bool isLoop = false, Action onPlayEnd = null) public void PlayAudio(AudioClip clip, bool isLoop = false, Action onPlayEnd = null)
{ {
if (!LocalRecord.HasKey(GlobalConfig.SoundKey) || LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0) if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
{ {
return; return;
} }
...@@ -131,7 +131,7 @@ public class AudioServices : MonoBehaviour ...@@ -131,7 +131,7 @@ public class AudioServices : MonoBehaviour
} }
public AudioSource GetPlayAudioSource(AudioClip clip) public AudioSource GetPlayAudioSource(AudioClip clip)
{ {
if (!LocalRecord.HasKey(GlobalConfig.SoundKey) || LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0) if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
{ {
return null; return null;
} }
...@@ -145,7 +145,7 @@ public class AudioServices : MonoBehaviour ...@@ -145,7 +145,7 @@ public class AudioServices : MonoBehaviour
public void AudioPlayFinished(AudioSource source) public void AudioPlayFinished(AudioSource source)
{ {
if (!LocalRecord.HasKey(GlobalConfig.SoundKey) || LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0) if (LocalRecord.HasKey(GlobalConfig.SoundKey) && LocalRecord.GetIntRecord(GlobalConfig.SoundKey) == 0)
{ {
return; return;
} }
......
...@@ -16,8 +16,8 @@ MonoBehaviour: ...@@ -16,8 +16,8 @@ MonoBehaviour:
moveSpeed: 1 moveSpeed: 1
xDirMinDis: -2.5 xDirMinDis: -2.5
xDirMaxDis: 2.5 xDirMaxDis: 2.5
yDirMinDis: -3 yDirMinDis: -4.2
yDirMaxDis: 3 yDirMaxDis: 4.2
clawMaxAngle: 34 clawMaxAngle: 34
clawRotateSpeed: 50 clawRotateSpeed: 50
ropeReduceSpeed: 2 ropeReduceSpeed: 2
......
Markdown is supported
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