Commit ab099649 authored by wanqing's avatar wanqing

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

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