Zakhar #1
@ -55,6 +55,7 @@ namespace Controller
|
|||||||
var paintedController = new PaintedController();
|
var paintedController = new PaintedController();
|
||||||
|
|
||||||
hexGrid.OnHexPainted += paintedController.SetHexColors;
|
hexGrid.OnHexPainted += paintedController.SetHexColors;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ namespace HexFiled
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
TMP_Text label = Object.Instantiate(_cellLabelPrefab, _gridCanvas.transform, false);
|
TMP_Text label = Object.Instantiate(_cellLabelPrefab, _gridCanvas.transform, false);
|
||||||
label.rectTransform.anchoredPosition =
|
label.rectTransform.anchoredPosition =
|
||||||
@ -109,6 +110,7 @@ namespace HexFiled
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
_cells = new HexCell[_height * _width];
|
_cells = new HexCell[_height * _width];
|
||||||
|
@ -22,13 +22,20 @@ public class MusicController
|
|||||||
_data = data;
|
_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayerAudioClip(AudioClip clip, GameObject source)
|
public void PlayAudioClip(AudioClip clip, GameObject source)
|
||||||
{
|
{
|
||||||
_sources[source].clip = clip;
|
_sources[source].clip = clip;
|
||||||
_sources[source].volume = _data.Settings.isSFXAllowed ? 1f : 0f;
|
_sources[source].volume = _data.Settings.isSFXAllowed ? 1f : 0f;
|
||||||
_sources[source].Play();
|
_sources[source].Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PlayRandomClip(List<AudioClip> clips, GameObject source)
|
||||||
|
{
|
||||||
|
_sources[source].clip = clips[Random.Range(0, clips.Count - 1)];
|
||||||
|
_sources[source].volume = _data.Settings.isSFXAllowed ? 1f : 0f;
|
||||||
|
_sources[source].Play();
|
||||||
|
}
|
||||||
|
|
||||||
public void AddAudioListener(GameObject gameObject)
|
public void AddAudioListener(GameObject gameObject)
|
||||||
{
|
{
|
||||||
_audioListener = gameObject.AddComponent<AudioListener>();
|
_audioListener = gameObject.AddComponent<AudioListener>();
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Chars;
|
using Chars;
|
||||||
using Data;
|
using Data;
|
||||||
using DefaultNamespace;
|
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using HexFiled;
|
using HexFiled;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -163,10 +162,10 @@ namespace Units
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var capturesMusic = MusicController.Instance.MusicData.SfxMusic.Captures;
|
|
||||||
MusicController.Instance.PlayerAudioClip(capturesMusic[Random.Range(0, capturesMusic.Count - 1)],
|
|
||||||
_cell.gameObject);
|
|
||||||
CaptureHex();
|
CaptureHex();
|
||||||
|
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures,
|
||||||
|
_cell.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
_isHardToCapture = false;
|
_isHardToCapture = false;
|
||||||
@ -190,7 +189,7 @@ namespace Units
|
|||||||
_instance.transform.forward + _instance.transform.position + new Vector3(0, 2),
|
_instance.transform.forward + _instance.transform.position + new Vector3(0, 2),
|
||||||
_instance.transform.rotation);
|
_instance.transform.rotation);
|
||||||
MusicController.Instance.AddAudioSource(ball);
|
MusicController.Instance.AddAudioSource(ball);
|
||||||
MusicController.Instance.PlayerAudioClip(_weapon.shotSound, ball);
|
MusicController.Instance.PlayAudioClip(_weapon.shotSound, ball);
|
||||||
ball.AddComponent<WeaponView>().SetWeapon(_weapon);
|
ball.AddComponent<WeaponView>().SetWeapon(_weapon);
|
||||||
ball.transform.DOMove(
|
ball.transform.DOMove(
|
||||||
new Vector3(_direction.normalized.x,
|
new Vector3(_direction.normalized.x,
|
||||||
@ -232,7 +231,7 @@ namespace Units
|
|||||||
_unitView.OnHit -= Damage;
|
_unitView.OnHit -= Damage;
|
||||||
_isAlive = false;
|
_isAlive = false;
|
||||||
_animator.SetTrigger("Death");
|
_animator.SetTrigger("Death");
|
||||||
MusicController.Instance.PlayerAudioClip(MusicController.Instance.MusicData.SfxMusic.Death, _instance);
|
MusicController.Instance.PlayAudioClip(MusicController.Instance.MusicData.SfxMusic.Death, _instance);
|
||||||
MusicController.Instance.RemoveAudioSource(_instance);
|
MusicController.Instance.RemoveAudioSource(_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +267,6 @@ namespace Units
|
|||||||
{
|
{
|
||||||
Death();
|
Death();
|
||||||
}
|
}
|
||||||
|
|
||||||
_hp -= dmg;
|
_hp -= dmg;
|
||||||
UpdateBarCanvas();
|
UpdateBarCanvas();
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class UnitView : MonoBehaviour
|
|||||||
_capureHex.Invoke();
|
_capureHex.Invoke();
|
||||||
captureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
|
captureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
|
||||||
captureBar.gameObject.SetActive(false);
|
captureBar.gameObject.SetActive(false);
|
||||||
MusicController.Instance.PlayerAudioClip(MusicController.Instance.MusicData.SfxMusic.HardCapture,
|
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures,
|
||||||
cell.gameObject);
|
cell.gameObject);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -101,9 +101,8 @@ public class UnitView : MonoBehaviour
|
|||||||
|
|
||||||
private void Land()
|
private void Land()
|
||||||
{
|
{
|
||||||
MusicController.Instance.PlayerAudioClip(
|
MusicController.Instance.PlayRandomClip(
|
||||||
MusicController.Instance.MusicData.SfxMusic.Step[
|
MusicController.Instance.MusicData.SfxMusic.Step, gameObject);
|
||||||
Random.Range(0, MusicController.Instance.MusicData.SfxMusic.Step.Count - 1)], gameObject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AttackEnd()
|
private void AttackEnd()
|
||||||
|
@ -24,6 +24,6 @@ public class WeaponView : MonoBehaviour
|
|||||||
go.AddComponent<VFXView>();
|
go.AddComponent<VFXView>();
|
||||||
MusicController.Instance.AddAudioSource(go);
|
MusicController.Instance.AddAudioSource(go);
|
||||||
MusicController.Instance.RemoveAudioSource(gameObject);
|
MusicController.Instance.RemoveAudioSource(gameObject);
|
||||||
MusicController.Instance.PlayerAudioClip(_weapon.hitSound, go);
|
MusicController.Instance.PlayAudioClip(_weapon.hitSound, go);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user