public void InitiViceWeapon(int index) { if (index >= _weaponList.Count) { return; } if (index >= 0) { var weapon = _weaponList[index]; if (weapon != null) { weapon.SetActive(true); _curViceWeapon = weapon.GetComponent <BaseVirusViceWeapon>(); if (_curViceWeapon != null) { _curViceWeapon.Initi(); } } if (index > 0) { if (IGamerProfile.Instance != null) { _weaponList[index].GetComponent <ViceWeaponEffect>().Ready(); Sequence sq = DOTween.Sequence(); sq.AppendCallback(() => { //_weaponList[index - 1].GetComponent<ViceWeaponEffect>().FadeIn(); _weaponList[0].GetComponent <ViceWeaponEffect>().FadeIn(); }); sq.AppendInterval(1.0f); sq.AppendCallback(() => { _weaponList[index].GetComponent <ViceWeaponEffect>().FadeOut(); VirusSoundMrg.Instance.PlaySound(VirusSoundType.Unlock); }); sq.AppendInterval(1.0f); //sq.AppendCallback(() => { _weaponList[index - 1].SetActive(false); }); sq.AppendCallback(() => { _weaponList[0].SetActive(false); }); } else { _weaponList[index].GetComponent <ViceWeaponEffect>().Ready(); Sequence sq = DOTween.Sequence(); sq.AppendCallback(() => { _weaponList[index - 1].GetComponent <ViceWeaponEffect>().FadeIn(); }); sq.AppendInterval(1.0f); sq.AppendCallback(() => { _weaponList[index].GetComponent <ViceWeaponEffect>().FadeOut(); VirusSoundMrg.Instance.PlaySound(VirusSoundType.Unlock); }); sq.AppendInterval(1.0f); sq.AppendCallback(() => { _weaponList[index - 1].SetActive(false); }); } } } }
public void SetPlayerState(bool isShoot, bool isControl) { _playerShoot.IsStartShoot = isShoot; _playerMove.OnAwake(); _playerMove.IsControl = isControl; _propCheck.IsControl = isControl; _shootAudioSource.enabled = isShoot; if (isShoot) { _shootAudioSource.Play(); } _shootEffect.IsShoot = isShoot; if (_curViceWeapon != null) { _curViceWeapon.IsUpdate = isShoot; _curViceWeapon.Initi(); } }
public void InitiViceWeapon(int index) { if (index >= _weaponList.Count) { return; } if (index >= 0) { var preIndex = VirusPlayerDataAdapter.GetCurWeaponLevel(); var weapon = _weaponList[index]; if (weapon != null) { weapon.SetActive(true); _curViceWeapon = weapon.GetComponent <BaseVirusViceWeapon>(); if (_curViceWeapon != null) { _curViceWeapon.Initi(); } } if (index > 0) { _weaponList[index].GetComponent <ViceWeaponEffect>().Ready(); Sequence sq = DOTween.Sequence(); sq.AppendCallback(() => { _weaponList[preIndex].GetComponent <ViceWeaponEffect>().FadeIn(); }); sq.AppendInterval(1.0f); sq.AppendCallback(() => { _weaponList[index].GetComponent <ViceWeaponEffect>().FadeOut(); VirusSoundMrg.Instance.PlaySound(VirusSoundType.Unlock); }); sq.AppendInterval(1.0f); sq.AppendCallback(() => { _weaponList[preIndex].SetActive(false); }); } VirusPlayerDataAdapter.SetCurWeaponLevel(index); } }