60 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using UnityEngine;
 | |
| 
 | |
| public class VibrationManager : SingletonMonoBehaviour<VibrationManager> {
 | |
| 
 | |
|     private bool isEnable = true;
 | |
|     public bool IsEnable {
 | |
|         get{ return isEnable; }
 | |
|     }
 | |
| 
 | |
|     void Awake(){
 | |
|         if(CheckInstance()){
 | |
|             return;
 | |
|         }
 | |
|         isEnable = UsayaStorageManager.LoadOrDefault(UsayaStorageFilename.Settings_Data, Const.VibrationTag, true);
 | |
|     }
 | |
| 
 | |
|     public void SaveEnable(bool enable){
 | |
|         UsayaStorageManager.Save(UsayaStorageFilename.Settings_Data, Const.VibrationTag, enable);
 | |
|         isEnable = enable;
 | |
|     }
 | |
| 
 | |
|     public void PlayVibrationOnce(){
 | |
|         if(isEnable){
 | |
|             NativeUtils.PlayVibrationOnce();
 | |
|         }
 | |
|     }
 | |
|     public void PlayVibrationOnceStrong(){
 | |
|         if(isEnable){
 | |
|             NativeUtils.PlayVibrationOnceStrong();
 | |
|         }
 | |
|     }
 | |
|     public void PlayVibrationOnceWeak(){
 | |
|         if(isEnable){
 | |
|             NativeUtils.PlayVibrationOnceWeak();
 | |
|         }
 | |
|     }
 | |
|     public void PlayVibrationDoubleStrong(){
 | |
|         if(isEnable){
 | |
|             NativeUtils.PlayVibrationDoubleStrong();
 | |
|         }
 | |
|     }
 | |
|     public void PlayVibrationDoubleWeak(){
 | |
|         if(isEnable){
 | |
|             NativeUtils.PlayVibrationDoubleWeak();
 | |
|         }
 | |
|     }
 | |
|     public void PlayVibrationTriple(){
 | |
|         if(isEnable){
 | |
|             NativeUtils.PlayVibrationTriple();
 | |
|         }
 | |
|     }
 | |
|     public void PlayVibration(VibrationType vibrationType){
 | |
|         if(isEnable){
 | |
|             NativeUtils.PlayVibration(vibrationType);
 | |
|         }
 | |
|     }
 | |
| }
 |