All Map + things
This commit is contained in:
parent
769264c79b
commit
ee2a5fdf08
93 changed files with 5374 additions and 27 deletions
31
Assets/Scripts/Singletons/GameManager.cs
Normal file
31
Assets/Scripts/Singletons/GameManager.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
// Delete, use only for Debug
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
StartFightForAll();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartFightForAll()
|
||||
{
|
||||
AbstractUnit[] units = FindObjectsByType<AbstractUnit>(FindObjectsSortMode.None);
|
||||
foreach (var unit in units)
|
||||
{
|
||||
unit.StartFight();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
2
Assets/Scripts/Singletons/GameManager.cs.meta
Normal file
2
Assets/Scripts/Singletons/GameManager.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3aa2eb264738746aab80b5768ad3206f
|
36
Assets/Scripts/Singletons/SoundManager.cs
Normal file
36
Assets/Scripts/Singletons/SoundManager.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SoundManager : MonoBehaviourSingletonPersistent<SoundManager>
|
||||
{
|
||||
// Audio players components.
|
||||
public AudioSource EffectsSource;
|
||||
public AudioSource MusicSource;
|
||||
|
||||
public Dictionary<string, AudioClip> Sounds;
|
||||
|
||||
// Play a single clip through the sound effects source.
|
||||
public void Play(AudioClip clip)
|
||||
{
|
||||
EffectsSource.clip = clip;
|
||||
EffectsSource.Play();
|
||||
}
|
||||
|
||||
// Play a single clip through the music source.
|
||||
public void PlayMusic(AudioClip clip)
|
||||
{
|
||||
MusicSource.clip = clip;
|
||||
MusicSource.Play();
|
||||
}
|
||||
|
||||
// Play a random clip from an array, and randomize the pitch slightly.
|
||||
public void RandomSoundEffect(params AudioClip[] clips)
|
||||
{
|
||||
int randomIndex = Random.Range(0, clips.Length);
|
||||
|
||||
EffectsSource.clip = clips[randomIndex];
|
||||
EffectsSource.Play();
|
||||
}
|
||||
|
||||
}
|
2
Assets/Scripts/Singletons/SoundManager.cs.meta
Normal file
2
Assets/Scripts/Singletons/SoundManager.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 674cc8c0eaaaff27c890e7968596e1ec
|
Loading…
Add table
Add a link
Reference in a new issue