e
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
public class SceneMonsterManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField, Header("怪物列表")] private List<GameObject> monsters = new List<GameObject>();
|
||||
|
||||
[SerializeField, Header("怪物生成速率")] private float timer;
|
||||
|
||||
public Transform teleporte;
|
||||
public bool isTeleport = false;
|
||||
|
||||
public GameObject box;
|
||||
|
||||
private int count = 0;
|
||||
|
||||
private float t = 0;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
foreach (var item in monsters)
|
||||
{
|
||||
item.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
t += Time.deltaTime;
|
||||
if (t >= timer)
|
||||
{
|
||||
Debug.Log(isTeleport);
|
||||
ABC();
|
||||
ProtectedMonster();
|
||||
}
|
||||
}
|
||||
void ProtectedMonster()
|
||||
{
|
||||
if (count >= monsters.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
monsters[count].SetActive(true);
|
||||
count += 1;
|
||||
t = 0;
|
||||
}
|
||||
void ABC()
|
||||
{
|
||||
if(transform.childCount==0&&!isTeleport)
|
||||
{
|
||||
//UIManager.Instance.Show<UILottery>();
|
||||
Instantiate(box);
|
||||
isTeleport = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c6d37fb46cffe1408e982d6d1b9a190
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,49 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Manager
|
||||
{
|
||||
class SenceManager:MonoSingleton<SenceManager>
|
||||
{
|
||||
UnityAction<float> onProgress = null;
|
||||
|
||||
public void LoadScene(int name)
|
||||
{
|
||||
StartCoroutine(LoadLevel(name));
|
||||
|
||||
}
|
||||
|
||||
IEnumerator LoadLevel( int id)
|
||||
{
|
||||
Debug.LogFormat("LoadLevel: {0}", name);
|
||||
AsyncOperation async = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(id);
|
||||
|
||||
async.allowSceneActivation = true;
|
||||
async.completed += LevelLoadCompleted;
|
||||
|
||||
//保存数据
|
||||
PlayerInfo.Instance.info.currentMap=id;
|
||||
SaveSystem.SaveDate(PlayerInfo.Instance.info.DatePath, PlayerInfo.Instance.info);
|
||||
|
||||
while (!async.isDone)
|
||||
{
|
||||
if (onProgress != null)
|
||||
onProgress(async.progress);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void LevelLoadCompleted(AsyncOperation obj)
|
||||
{
|
||||
if (onProgress != null)
|
||||
onProgress(1f);
|
||||
Debug.Log("LevelLoadCompleted:" + obj.progress);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36641df8733b77f4fb770f6bcfcc598f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,119 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
namespace Manager
|
||||
{
|
||||
public class SoundManager : MonoSingleton<SoundManager>
|
||||
{
|
||||
public AudioMixer audioMixer;//»ìÒôÆ÷
|
||||
public AudioSource MusicSource;
|
||||
public AudioSource SoundSource;
|
||||
|
||||
const string MusicPath = "Music/";
|
||||
const string SoundPath = "Sound/";
|
||||
|
||||
private bool musicOn;
|
||||
public bool MusicOn
|
||||
{
|
||||
get { return musicOn; }
|
||||
set
|
||||
{
|
||||
musicOn = value;
|
||||
this.MusicMute(!musicOn);
|
||||
}
|
||||
}
|
||||
private bool soundOn;
|
||||
public bool SoundOn
|
||||
{
|
||||
get { return soundOn; }
|
||||
set
|
||||
{
|
||||
soundOn = value;
|
||||
this.SoundMute(!soundOn);
|
||||
}
|
||||
}
|
||||
|
||||
private int musicVolume;
|
||||
public int MusicVolume
|
||||
{
|
||||
get { return musicVolume; }
|
||||
set
|
||||
{
|
||||
musicVolume = value;
|
||||
if (musicOn) this.SetVolume("MusicVolume", musicVolume);
|
||||
}
|
||||
}
|
||||
private int soundVolume;
|
||||
public int SoundVolume
|
||||
{
|
||||
get { return soundVolume; }
|
||||
set
|
||||
{
|
||||
soundVolume = value;
|
||||
if (soundOn) this.SetVolume("SoundVolume", soundVolume);
|
||||
}
|
||||
}
|
||||
|
||||
public void SoundMute(bool mute)
|
||||
{
|
||||
this.SetVolume("SoundVolume", mute ? 0 : soundVolume);
|
||||
}
|
||||
public void MusicMute(bool mute)
|
||||
{
|
||||
this.SetVolume("MusicVolume", mute ? 0 : musicVolume);
|
||||
}
|
||||
|
||||
void SetVolume(string name, int value)
|
||||
{
|
||||
float volume = value * 0.5f - 50f;
|
||||
this.audioMixer.SetFloat(name, volume);
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
this.MusicVolume = SystemConfig.MusicVolume;
|
||||
this.SoundVolume = SystemConfig.SoundVolume;
|
||||
this.MusicOn = SystemConfig.MusicOn;
|
||||
this.soundOn = SystemConfig.SoundOn;
|
||||
}
|
||||
|
||||
public void PlayMusic(string name)
|
||||
{
|
||||
AudioClip clip = Resloader.Load<AudioClip>(MusicPath + name);
|
||||
if (clip == null)
|
||||
{
|
||||
Debug.LogWarningFormat("PlayMusic:{0} not existed", name);
|
||||
return;
|
||||
}
|
||||
if (MusicSource.isPlaying)
|
||||
{
|
||||
MusicSource.Stop();
|
||||
}
|
||||
MusicSource.clip = clip;
|
||||
MusicSource.Play();
|
||||
}
|
||||
public void PlaySound(string name)
|
||||
{
|
||||
AudioClip clip = Resloader.Load<AudioClip>(SoundPath + name);
|
||||
if (clip == null)
|
||||
{
|
||||
Debug.LogWarningFormat("PlaySound:{0} not existed", name);
|
||||
return;
|
||||
}
|
||||
SoundSource.PlayOneShot(clip);
|
||||
}
|
||||
|
||||
public void PlayEffect(AudioSource audio,AudioClip clip)
|
||||
{
|
||||
if (clip == null)
|
||||
{
|
||||
Debug.LogWarningFormat("PlaySound:{0} not existed", name);
|
||||
return;
|
||||
}
|
||||
audio.PlayOneShot(clip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e3d9918daf58924b994f65a2ebd4d19
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user