wip
This commit is contained in:
@@ -51,6 +51,8 @@ public class AccountSettings : MonoBehaviour
|
||||
linkPanel.SetActive(true);
|
||||
btn_link_register.interactable =false;
|
||||
usernameInput.text=passwordInput.text ="";
|
||||
|
||||
AudioManager.instnace.UIClick();
|
||||
}
|
||||
|
||||
async void OnLinkReg(){
|
||||
|
||||
@@ -10,18 +10,33 @@ public class AudioManager : MonoBehaviour
|
||||
[SerializeField]private AudioClip[] musics;
|
||||
[SerializeField]private AudioClip UI_click;
|
||||
[SerializeField]private AudioClip UI_popup;
|
||||
[SerializeField]private AudioClip collectGold;
|
||||
[SerializeField]private AudioClip UI_ShopButton;
|
||||
|
||||
[SerializeField]private AudioClip battleButton;
|
||||
[SerializeField]private AudioClip battleCasual,battleRanked;
|
||||
[SerializeField]private AudioClip spend;
|
||||
[SerializeField]private AudioClip chestOpenRiser;
|
||||
[SerializeField]private AudioClip chestOpen;
|
||||
[SerializeField]private AudioClip upgrade;
|
||||
[SerializeField]private AudioClip buildingUpgrade;
|
||||
[SerializeField]private AudioClip buildingUpgradeWhoosh;
|
||||
[SerializeField]private AudioClip[] rocketUpgrade;
|
||||
[SerializeField]private AudioClip rocketBuild;
|
||||
[SerializeField]private AudioClip[] bpOpen;
|
||||
[SerializeField]private AudioClip bpFound;
|
||||
[SerializeField]private AudioClip reward;
|
||||
[Header("Gold")]
|
||||
public AudioClip collectGoldBegin;
|
||||
public AudioClip[] collectGoldArray;
|
||||
// public float
|
||||
|
||||
[Header("Minigame")]
|
||||
[SerializeField]private AudioClip pickupCollected;
|
||||
[SerializeField]private AudioClip moonCollected;
|
||||
[SerializeField]private AudioClip starCollected;
|
||||
[SerializeField]private AudioClip minigameVictory;
|
||||
[SerializeField]private AudioClip minigameFailed;
|
||||
[SerializeField]private AudioClip minigameDied;
|
||||
[SerializeField]private AudioClip[] typewriters;
|
||||
[SerializeField]private AudioClip[] boostStart;
|
||||
|
||||
|
||||
|
||||
@@ -59,6 +74,11 @@ public class AudioManager : MonoBehaviour
|
||||
musicAudioSource.clip = musics[level];
|
||||
musicAudioSource.Play();
|
||||
}
|
||||
|
||||
public void SetCustomMusic(AudioClip musicClip){
|
||||
musicAudioSource.clip = musicClip;
|
||||
musicAudioSource.Play();
|
||||
}
|
||||
public void ToggleSFX() => ToggleSFX(!SFX_enabled);
|
||||
public void ToggleMusic()=>ToggleMusic(!Music_enabled);
|
||||
|
||||
@@ -87,12 +107,25 @@ public class AudioManager : MonoBehaviour
|
||||
public void UIPopup(){
|
||||
audioSrc.PlayOneShot(UI_popup);
|
||||
}
|
||||
|
||||
public void CollectGold(){
|
||||
audioSrc.PlayOneShot(collectGold);
|
||||
public void ShopButton(){
|
||||
audioSrc.PlayOneShot(UI_ShopButton);
|
||||
}
|
||||
public void CollectPickup(){
|
||||
audioSrc.PlayOneShot(pickupCollected, 0.3f);
|
||||
|
||||
public void BattleButton(){
|
||||
audioSrc.PlayOneShot(battleButton);
|
||||
}
|
||||
|
||||
public void BattleCasual(){
|
||||
audioSrc.PlayOneShot(battleCasual);
|
||||
}
|
||||
public void BattleRanked(){
|
||||
audioSrc.PlayOneShot(battleRanked);
|
||||
}
|
||||
public void CollectMoon(){
|
||||
audioSrc.PlayOneShot(moonCollected, 0.3f);
|
||||
}
|
||||
public void CollectStar(){
|
||||
audioSrc.PlayOneShot(moonCollected, 0.3f);
|
||||
}
|
||||
public void Spend(){
|
||||
audioSrc.PlayOneShot(spend);
|
||||
@@ -105,7 +138,34 @@ public class AudioManager : MonoBehaviour
|
||||
}
|
||||
|
||||
public void UpgradeBuilding(){
|
||||
audioSrc.PlayOneShot(upgrade);
|
||||
audioSrc.PlayOneShot(buildingUpgrade);
|
||||
audioSrc.PlayOneShot(buildingUpgradeWhoosh);
|
||||
// PlayWithDelay(buildingUpgrade.length, buildingUpgradeWhoosh);
|
||||
}
|
||||
|
||||
public void UpgradeRocket(){
|
||||
audioSrc.PlayOneShot(rocketUpgrade[Random.Range(0, rocketUpgrade.Length)]);
|
||||
}
|
||||
|
||||
public void BuildRocket(){
|
||||
audioSrc.PlayOneShot(rocketBuild);
|
||||
}
|
||||
|
||||
public void OpenBP(){
|
||||
audioSrc.PlayOneShot(bpOpen[Random.Range(0, bpOpen.Length)]);
|
||||
}
|
||||
|
||||
public void FindBP(){
|
||||
audioSrc.PlayOneShot(bpFound);
|
||||
}
|
||||
|
||||
void PlayWithDelay(float time, AudioClip clip){
|
||||
StartCoroutine(playWithDelay(time, clip));
|
||||
}
|
||||
|
||||
IEnumerator playWithDelay(float time,AudioClip clip){
|
||||
yield return new WaitForSeconds(time);
|
||||
audioSrc.PlayOneShot(clip);
|
||||
}
|
||||
public void Reward(){
|
||||
audioSrc.PlayOneShot(reward);
|
||||
@@ -117,8 +177,34 @@ public class AudioManager : MonoBehaviour
|
||||
public void MinigameLost(){
|
||||
audioSrc.PlayOneShot(minigameFailed);
|
||||
}
|
||||
public void MinigameDied(){
|
||||
audioSrc.PlayOneShot(minigameDied);
|
||||
}
|
||||
|
||||
public void TypeWriter(){
|
||||
audioSrc.PlayOneShot(typewriters[Random.Range(0, typewriters.Length)],0.1f);
|
||||
}
|
||||
|
||||
public void CollectGold(int amount){
|
||||
audioSrc.PlayOneShot(collectGoldBegin);
|
||||
|
||||
// int index = Mathf.Clamp((Mathf.Clamp(amount,0,100) / 100) * collectGoldArray.Length,0,collectGoldArray.Length-1);
|
||||
int index =0;
|
||||
if(amount < 10){
|
||||
index=0;
|
||||
}else if(amount < 100){
|
||||
index=1;
|
||||
}else if(amount < 1000){
|
||||
index = 2;
|
||||
}else if(amount < 10000){
|
||||
index = 3;
|
||||
}else{
|
||||
index = 4;
|
||||
}
|
||||
audioSrc.PlayOneShot(collectGoldArray[index]);
|
||||
}
|
||||
|
||||
public void Boost(){
|
||||
audioSrc.PlayOneShot(boostStart[Random.Range(0,boostStart.Length)]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,18 @@ public class AudioManagerHelper : MonoBehaviour
|
||||
public void PlayUIPopup(){
|
||||
AudioManager.instnace.UIPopup();
|
||||
}
|
||||
|
||||
public void ShopButton(){
|
||||
AudioManager.instnace.ShopButton();
|
||||
}
|
||||
|
||||
public void BattleButton(){
|
||||
AudioManager.instnace.BattleButton();
|
||||
}
|
||||
public void BattleCasual(){
|
||||
AudioManager.instnace.BattleCasual();
|
||||
}
|
||||
public void BattleRanked(){
|
||||
AudioManager.instnace.BattleRanked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class CollectBtn : MonoBehaviour
|
||||
case CollectablesData.ResourceType.Metal:
|
||||
collectableAmount= GetCollectableEnergy();
|
||||
DBmanager.SetMetal(DBmanager.Metal + (int)collectableAmount);
|
||||
CollectEffect.instance.Show(resourceType);
|
||||
CollectEffect.instance.Show(resourceType,(int)collectableAmount);
|
||||
|
||||
break;
|
||||
|
||||
@@ -51,8 +51,8 @@ public class CollectBtn : MonoBehaviour
|
||||
collectableAmount= GetCollectableGold();
|
||||
|
||||
DBmanager.SetCoins(DBmanager.Coins + (int)collectableAmount);
|
||||
CollectEffect.instance.Show(resourceType);
|
||||
AudioManager.instnace.CollectGold();
|
||||
CollectEffect.instance.Show(resourceType,(int)collectableAmount);
|
||||
AudioManager.instnace.CollectGold((int)collectableAmount);
|
||||
break;
|
||||
|
||||
// case CollectablesData.ResourceType.Oxygen:
|
||||
|
||||
@@ -9,8 +9,9 @@ public class CollectEffect : MonoBehaviour
|
||||
public Transform solarPanel;
|
||||
public Transform goldMine;
|
||||
public RectTransform goldStats, metalStats;
|
||||
public Sprite energyIcon;
|
||||
public Sprite goldsIcon;
|
||||
public Animator GoldAnim, MetalAnim;
|
||||
public Transform GoldEffect, MetalEffect;
|
||||
public float EffectScale =1;
|
||||
|
||||
void Awake(){
|
||||
instance=this;
|
||||
@@ -18,50 +19,64 @@ public class CollectEffect : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void Show( CollectablesData.ResourceType type){
|
||||
gameObject.SetActive(true);
|
||||
switch(type){
|
||||
case CollectablesData.ResourceType.Gold:
|
||||
foreach(Image image in transform.GetComponentsInChildren<Image>(true)){
|
||||
image.sprite = goldsIcon;
|
||||
}
|
||||
StartCoroutine(startEffect(Camera.main.WorldToScreenPoint(goldMine.position), goldStats.position));
|
||||
public void Show(CollectablesData.ResourceType type, int amount){
|
||||
if(type == CollectablesData.ResourceType.Gold){
|
||||
GoldEffect.GetComponent<ParticleSystem>().maxParticles = (int)Mathf.Clamp(amount * EffectScale, 5, 100);
|
||||
StartCoroutine(PlayAnimation(GoldAnim, GoldEffect));
|
||||
}else{
|
||||
MetalEffect.GetComponent<ParticleSystem>().maxParticles = (int)Mathf.Clamp(amount * EffectScale, 5, 100);
|
||||
|
||||
break;
|
||||
case CollectablesData.ResourceType.Metal:
|
||||
foreach(Image image in transform.GetComponentsInChildren<Image>(true)){
|
||||
image.sprite = energyIcon;
|
||||
}
|
||||
StartCoroutine(startEffect(Camera.main.WorldToScreenPoint(solarPanel.position), metalStats.position));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
[Header("Animation tweaks")]
|
||||
public int steps = 500;
|
||||
public int offset = 10;
|
||||
IEnumerator startEffect(Vector3 start, Vector3 stop){
|
||||
Vector3 diff = stop - start;
|
||||
for(int i=0; i < transform.childCount; i++){
|
||||
StartCoroutine(travel(transform.GetChild(i), start,stop));
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
StartCoroutine(PlayAnimation(MetalAnim,MetalEffect));
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator travel(Transform item, Vector3 start, Vector3 stop){
|
||||
Vector3 diff = stop - start;
|
||||
item.gameObject.SetActive(true);
|
||||
|
||||
for(int i =0; i < steps; i++){
|
||||
item.position = start + (diff * ((float)i/(float)steps));
|
||||
item.localScale = Vector3.one * (1-(float)(Mathf.Abs(((float)steps/2f) - i)) / ((float)steps / 2f));
|
||||
yield return new WaitForFixedUpdate();
|
||||
IEnumerator PlayAnimation(Animator anim, Transform target){
|
||||
target.gameObject.SetActive(false);
|
||||
anim.Play("CollectAnim");
|
||||
yield return new WaitForSeconds(0.05f);
|
||||
target.gameObject.SetActive(true);
|
||||
while(anim.GetCurrentAnimatorStateInfo(0).IsName("CollectAnim")){
|
||||
target.position = anim.transform.position;
|
||||
yield return null;
|
||||
}
|
||||
|
||||
item.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// IEnumerator startEffect(Transform item,Vector3 start, Vector3 stop){
|
||||
// Vector3 diff = stop - start;
|
||||
// item.gameObject.SetActive(true);
|
||||
|
||||
// for(int i =0; i < steps; i++){
|
||||
// item.position = start + (diff * ((float)i/(float)steps));
|
||||
// item.localScale = Vector3.one * (1-(float)(Mathf.Abs(((float)steps/2f) - i)) / ((float)steps / 2f));
|
||||
// yield return new WaitForFixedUpdate();
|
||||
// }
|
||||
|
||||
// item.gameObject.SetActive(false);
|
||||
// }
|
||||
// [Header("Animation tweaks")]
|
||||
// public int steps = 500;
|
||||
// public int offset = 10;
|
||||
// IEnumerator startEffect(Vector3 start, Vector3 stop){
|
||||
// Vector3 diff = stop - start;
|
||||
// for(int i=0; i < transform.childCount; i++){
|
||||
// StartCoroutine(travel(transform.GetChild(i), start,stop));
|
||||
// yield return new WaitForSeconds(0.1f);
|
||||
// }
|
||||
// }
|
||||
|
||||
// IEnumerator travel(Transform item, Vector3 start, Vector3 stop){
|
||||
// Vector3 diff = stop - start;
|
||||
// item.gameObject.SetActive(true);
|
||||
|
||||
// for(int i =0; i < steps; i++){
|
||||
// item.position = start + (diff * ((float)i/(float)steps));
|
||||
// item.localScale = Vector3.one * (1-(float)(Mathf.Abs(((float)steps/2f) - i)) / ((float)steps / 2f));
|
||||
// yield return new WaitForFixedUpdate();
|
||||
// }
|
||||
|
||||
// item.gameObject.SetActive(false);
|
||||
// }
|
||||
}
|
||||
|
||||
34
Assets/Game/Scripts/ControlSettings.cs
Normal file
34
Assets/Game/Scripts/ControlSettings.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ControlSettings : MonoBehaviour
|
||||
{
|
||||
private const string ControlOnRightKey = "ControlOnRight";
|
||||
public Button left;
|
||||
public Button right;
|
||||
public static bool ControlIsOnRight = true;
|
||||
void Awake()
|
||||
{
|
||||
if(PlayerPrefs.HasKey(ControlOnRightKey)){
|
||||
ControlIsOnRight = PlayerPrefs.GetInt(ControlOnRightKey) == 1;
|
||||
}
|
||||
left.onClick.AddListener(()=>{ChangeControlSide(true);});
|
||||
right.onClick.AddListener(()=>{ChangeControlSide(false);});
|
||||
UpdateSettingsPage();
|
||||
}
|
||||
|
||||
void ChangeControlSide(bool value){
|
||||
ControlIsOnRight = value;
|
||||
PlayerPrefs.SetInt(ControlOnRightKey, value? 1: 0);
|
||||
PlayerPrefs.Save();
|
||||
UpdateSettingsPage();
|
||||
AudioManager.instnace.UIClick();
|
||||
}
|
||||
|
||||
void UpdateSettingsPage(){
|
||||
left.transform.GetChild(0).GetComponent<Image>().color = (!ControlIsOnRight) ? Color.blue : Color.green;
|
||||
right.transform.GetChild(0).GetComponent<Image>().color = (ControlIsOnRight) ? Color.blue : Color.green;
|
||||
}
|
||||
}
|
||||
11
Assets/Game/Scripts/ControlSettings.cs.meta
Normal file
11
Assets/Game/Scripts/ControlSettings.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83d1635355fe5db4d888450abde719f7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -177,7 +177,7 @@ public class DesignLab : MonoBehaviour
|
||||
DBmanager.SetCoins(DBmanager.Coins - buildGoldPrices[rarityIndex]);
|
||||
DBmanager.SetMetal(DBmanager.Metal - buildMetalPrices[rarityIndex]);
|
||||
DBmanager.BuildBlueprint(blueprintItems[selectedBlueprintIndex].name);
|
||||
AudioManager.instnace.ChestOpen();
|
||||
AudioManager.instnace.BuildRocket();
|
||||
}else{
|
||||
MessageDialog.instance.ShowMessage("Error", "Not enough resources to build this blueprint");
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public class DesignLab : MonoBehaviour
|
||||
|
||||
}
|
||||
|
||||
AudioManager.instnace.ChestOpen();
|
||||
AudioManager.instnace.OpenBP();
|
||||
newBoxPanel.SetActive(true);
|
||||
string rarityName = "Common";
|
||||
if(selectedBoxIndex == 1){
|
||||
@@ -225,20 +225,24 @@ public class DesignLab : MonoBehaviour
|
||||
|
||||
if(availableSkins.Count <= 0){
|
||||
Debug.LogError("No skin found to award");
|
||||
AwardGold((int)(boxPrices[selectedBoxIndex] / 4f));
|
||||
int amount = (int)(boxPrices[selectedBoxIndex] / 4f);
|
||||
AwardGold(amount);
|
||||
AudioManager.instnace.CollectGold(amount);
|
||||
|
||||
}else{
|
||||
AwardSkin(availableSkins[Random.Range(0, availableSkins.Count-1)]);
|
||||
AudioManager.instnace.FindBP();
|
||||
}
|
||||
}else{
|
||||
AwardGold((int)(boxPrices[selectedBoxIndex] / 4f));
|
||||
}
|
||||
newBoxPanel.SetActive(false);
|
||||
AudioManager.instnace.ChestOpen();
|
||||
}
|
||||
|
||||
void AwardSkin(SkinShopItemData skin){
|
||||
newSkinPanel.SetActive(true);
|
||||
newSkinPanel.transform.Find("img_skin").GetComponent<Image>().sprite = skin.image;
|
||||
UpgradeEffect.top_instance.Show(newSkinPanel.GetComponent<RectTransform>().position);
|
||||
|
||||
DBmanager.AddSkinBlueprint(skin);
|
||||
Refresh();
|
||||
@@ -247,6 +251,7 @@ public class DesignLab : MonoBehaviour
|
||||
void AwardGold(int amount){
|
||||
goldsPanel.SetActive(true);
|
||||
goldsPanel.transform.Find("txt_amount").GetComponent<TMP_Text>().text = amount.ToString();
|
||||
UpgradeEffect.top_instance.Show(goldsPanel.GetComponent<RectTransform>().position);
|
||||
|
||||
DBmanager.SetCoins(DBmanager.Coins + amount);
|
||||
Refresh();
|
||||
|
||||
@@ -157,6 +157,8 @@ public class GameManager : MonoBehaviour
|
||||
// await Task.Delay(1000);
|
||||
// SceneManager.LoadScene("Minigame");
|
||||
LoadingScreen.instance.LoadLevel("Minigame");
|
||||
AudioManager.instnace.BattleCasual();
|
||||
|
||||
}
|
||||
|
||||
public void LoadRanked(){
|
||||
@@ -165,6 +167,7 @@ public class GameManager : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
LoadingScreen.instance.LoadLevel("MinigameMatchmaking");
|
||||
AudioManager.instnace.BattleRanked();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,44 +3,56 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.Video;
|
||||
public class LoadingScreen : MonoBehaviour
|
||||
{
|
||||
public static LoadingScreen instance;
|
||||
CanvasGroup canvasGroup;
|
||||
public Slider loadingProgress;
|
||||
public TMPro.TMP_Text loadingProgressTxt;
|
||||
public VideoPlayer loadingScreenVideo;
|
||||
private static bool loading;
|
||||
public static bool Loading => loading;
|
||||
|
||||
void Awake(){
|
||||
instance =this;
|
||||
void Awake()
|
||||
{
|
||||
instance = this;
|
||||
Application.backgroundLoadingPriority = ThreadPriority.Low;
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
DontDestroyOnLoad(gameObject);
|
||||
canvasGroup = GetComponent<CanvasGroup>();
|
||||
canvasGroup = GetComponent<CanvasGroup>();
|
||||
}
|
||||
|
||||
public void LoadLevel(string levelName){
|
||||
if(loading){return;}loading=true;
|
||||
public void LoadLevel(string levelName)
|
||||
{
|
||||
if (loading) { return; }
|
||||
loading = true;
|
||||
StartCoroutine(loadlLevel(levelName));
|
||||
}
|
||||
|
||||
IEnumerator loadlLevel(string levelName){
|
||||
IEnumerator loadlLevel(string levelName)
|
||||
{
|
||||
AudioManager.instnace.SetMusic(-1);
|
||||
TutorialManager.instance=null;
|
||||
loading=true;
|
||||
canvasGroup.alpha=0;
|
||||
canvasGroup.blocksRaycasts=true;
|
||||
TutorialManager.instance = null;
|
||||
loading = true;
|
||||
canvasGroup.alpha = 0;
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
loadingScreenVideo.Play();
|
||||
SetProgress(0);
|
||||
while(canvasGroup.alpha< 1f){
|
||||
canvasGroup.alpha+=0.03f;
|
||||
while (canvasGroup.alpha < 1f)
|
||||
{
|
||||
canvasGroup.alpha += 0.03f;
|
||||
yield return new WaitForFixedUpdate();
|
||||
}
|
||||
while(RegionManager.selectedServer == null && levelName.Contains("Minigame")){
|
||||
loadingProgressTxt.text = "Preparing";
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
if (levelName.ToLower().Contains("minigame"))
|
||||
{
|
||||
while (RegionManager.selectedServer == null && levelName.Contains("Minigame"))
|
||||
{
|
||||
loadingProgressTxt.text = "Preparing";
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
}
|
||||
}
|
||||
AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(levelName);
|
||||
// asyncOperation.allowSceneActivation = false;
|
||||
@@ -54,29 +66,33 @@ public class LoadingScreen : MonoBehaviour
|
||||
}
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
|
||||
canvasGroup.blocksRaycasts=false;
|
||||
|
||||
while(canvasGroup.alpha> 0){
|
||||
canvasGroup.alpha-=0.03f;
|
||||
canvasGroup.blocksRaycasts = false;
|
||||
|
||||
while (canvasGroup.alpha > 0)
|
||||
{
|
||||
canvasGroup.alpha -= 0.03f;
|
||||
yield return new WaitForFixedUpdate();
|
||||
}
|
||||
loading=false;
|
||||
loading = false;
|
||||
}
|
||||
|
||||
void SetProgress(float value){
|
||||
void SetProgress(float value)
|
||||
{
|
||||
loadingProgress.value = value;
|
||||
loadingProgressTxt.text = (int)(value*100) + "%";
|
||||
loadingProgressTxt.text = (int)(value * 100) + "%";
|
||||
}
|
||||
|
||||
public void DeleteRankedRooms(int port){
|
||||
public void DeleteRankedRooms(int port)
|
||||
{
|
||||
StartCoroutine(CloseRoomClient(port));
|
||||
}
|
||||
|
||||
IEnumerator CloseRoomClient(int port){
|
||||
IEnumerator CloseRoomClient(int port)
|
||||
{
|
||||
Debug.Log("Clearing rooms for port " + port);
|
||||
WWWForm form = new WWWForm();
|
||||
form.AddField("port", port);
|
||||
WWW req = new WWW(DBmanager.phpRoot+"clear_ranked_room.php",form);
|
||||
WWW req = new WWW(DBmanager.phpRoot + "clear_ranked_room.php", form);
|
||||
yield return req;
|
||||
|
||||
Debug.Log(req.text);
|
||||
|
||||
@@ -104,7 +104,8 @@ public class LoginManager : MonoBehaviour
|
||||
|
||||
Debug.Log("XP : " + DBmanager.Xp);
|
||||
|
||||
UnityEngine.SceneManagement.SceneManager.LoadScene("GameScene");
|
||||
// UnityEngine.SceneManagement.SceneManager.LoadScene("GameScene");
|
||||
LoadingScreen.instance.LoadLevel("GameScene");
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@@ -6,7 +6,7 @@ using UnityEngine.SceneManagement;
|
||||
|
||||
public class MaintainceChecker : MonoBehaviour
|
||||
{
|
||||
public static int version = 20;
|
||||
public static int version = 23;
|
||||
public static MaintainceChecker instance;
|
||||
public int checkInterval = 30;
|
||||
float t;
|
||||
|
||||
@@ -41,7 +41,11 @@ public class MessageDialog : MonoBehaviour
|
||||
}
|
||||
|
||||
public void ShowMessage(string title, string message){
|
||||
Debug.Log(message + ", Already Showing : " + gameObject.activeSelf);
|
||||
Debug.Log(message + ", Already Showing : " + isActive);
|
||||
if(isActive){
|
||||
StartCoroutine(RescheduleMessage(title,message));
|
||||
return;
|
||||
}
|
||||
titleTxt.text = title;
|
||||
messageTxt.text = message;
|
||||
|
||||
@@ -54,6 +58,12 @@ public class MessageDialog : MonoBehaviour
|
||||
|
||||
// messageTxt.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
IEnumerator RescheduleMessage(string title, string message){
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
|
||||
ShowMessage(title, message);
|
||||
}
|
||||
UnityAction onYes = ()=>{};
|
||||
UnityAction onNo = ()=>{};
|
||||
|
||||
@@ -72,21 +82,24 @@ public class MessageDialog : MonoBehaviour
|
||||
AudioManager.instnace.UIPopup();
|
||||
}
|
||||
void OnClickedYes(){
|
||||
if(onYes!=null){onYes();}
|
||||
OnOkay();
|
||||
if(onYes!=null){onYes();}
|
||||
AudioManager.instnace.UIClick();
|
||||
}
|
||||
void OnClickedNo(){
|
||||
if(onNo!=null){onNo();}
|
||||
OnOkay();
|
||||
if(onNo!=null){onNo();}
|
||||
AudioManager.instnace.UIClick();
|
||||
}
|
||||
public void SetActive(bool value){
|
||||
GetComponent<CanvasGroup>().blocksRaycasts= value;
|
||||
GetComponent<CanvasGroup>().interactable= value;
|
||||
GetComponent<CanvasGroup>().alpha= (value) ? 1: 0;
|
||||
isActive=value;
|
||||
}
|
||||
|
||||
bool isActive;
|
||||
|
||||
void Refresh(){
|
||||
Canvas.ForceUpdateCanvases();
|
||||
GetComponentInChildren<VerticalLayoutGroup>().enabled=false;
|
||||
|
||||
@@ -6,6 +6,8 @@ public class CameraFollower : MonoBehaviour
|
||||
{
|
||||
public bool autoOffset = true;
|
||||
public Transform target;
|
||||
public bool isShaking = false;
|
||||
public float shakeIntensity = 1;
|
||||
public float minFOV = 11;
|
||||
public float FOVmultiplier = 5;
|
||||
public float smoothness = 0.1f;
|
||||
@@ -36,11 +38,14 @@ public class CameraFollower : MonoBehaviour
|
||||
if(updateMode!= CameraUpdateMode.Normal){return;}
|
||||
HandleFrame();
|
||||
}
|
||||
|
||||
Vector3 lastPos;
|
||||
public void HandleFrame(){
|
||||
if(target==null){return;}
|
||||
if(Mathf.Abs(target.position.x) > 1000 || Mathf.Abs(target.position.y )> 1000){return;}
|
||||
transform.position = Vector3.Lerp(transform.position, new Vector3(target.position.x, target.position.y,-10), smoothness * Time.deltaTime);
|
||||
transform.position = Vector3.Lerp(lastPos, new Vector3(target.position.x, target.position.y,-10), smoothness * Time.deltaTime);
|
||||
lastPos = transform.position;
|
||||
|
||||
if(isShaking){transform.position += Random.insideUnitSphere * shakeIntensity;}
|
||||
GetComponent<Camera>().orthographicSize = minFOV + ((target.localScale.x - 1) * FOVmultiplier);
|
||||
}
|
||||
|
||||
@@ -48,6 +53,17 @@ public class CameraFollower : MonoBehaviour
|
||||
target = Target;
|
||||
}
|
||||
|
||||
public void ShakeBoost(){
|
||||
StartCoroutine(shakeBoost());
|
||||
}
|
||||
|
||||
IEnumerator shakeBoost(){
|
||||
isShaking = true;
|
||||
yield return new WaitForSeconds(0.25f);
|
||||
|
||||
isShaking = false;
|
||||
}
|
||||
|
||||
public enum CameraUpdateMode{
|
||||
Fixed,
|
||||
Late,
|
||||
|
||||
@@ -18,7 +18,12 @@ public class Joystick : MonoBehaviour
|
||||
public RectTransform joyStick;
|
||||
|
||||
void Start(){
|
||||
defaultPosition = joyBG.position;
|
||||
defaultPosition = joyBG.localPosition;
|
||||
}
|
||||
|
||||
public void SetDefaultPosition(Vector2 newDef){
|
||||
defaultPosition = newDef;
|
||||
endJoy();
|
||||
}
|
||||
|
||||
public void onDrag(BaseEventData pointer)
|
||||
@@ -70,7 +75,7 @@ public class Joystick : MonoBehaviour
|
||||
void endJoy()
|
||||
{
|
||||
input=Vector2.zero;
|
||||
joyBG.position = defaultPosition;
|
||||
joyBG.localPosition = defaultPosition;
|
||||
joyStick.localPosition = Vector2.zero;
|
||||
joyBG.gameObject.SetActive(!DissappearOnEnd);
|
||||
joyStick.gameObject.SetActive(!DissappearOnEnd);
|
||||
|
||||
@@ -20,6 +20,7 @@ public class MatchMaker : MonoBehaviour
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
btn_cancel.onClick.AddListener(Cancel);
|
||||
AudioManager.instnace.SetMusic(2);
|
||||
|
||||
// StartCoroutine(StartMatchmaking());
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ using TMPro;
|
||||
public class MinigameManager : NetworkBehaviour
|
||||
{
|
||||
public static MinigameManager instance;
|
||||
public AudioClip[] musicClips;
|
||||
public RectTransform joystick;
|
||||
public RectTransform btn_boost;
|
||||
public bool isRanked;
|
||||
[SyncVar]
|
||||
public bool RankedGameStarted=false;
|
||||
@@ -32,20 +35,6 @@ public class MinigameManager : NetworkBehaviour
|
||||
// public int maxTweps = 2;
|
||||
public Transform pickupItemsParent;
|
||||
|
||||
// private List<DeathEffect> PooledDeathEffects = new List<DeathEffect>();
|
||||
// [SerializeField]private GameObject DeathEffectPrefab;
|
||||
// [SerializeField]private Transform EffectsParent;
|
||||
// private List<PickupItem> ActiveMoons = new List<PickupItem>();
|
||||
// private List<PickupItem> ActiveStars = new List<PickupItem>();
|
||||
// private List<PickupItem> ActiveTweps = new List<PickupItem>();
|
||||
|
||||
// List<PickupItem> MoonPool = new List<PickupItem>();
|
||||
// List<PickupItem> StarsPool = new List<PickupItem>();
|
||||
// List<PickupItem> TwepPool = new List<PickupItem>();
|
||||
// public GameObject moon;
|
||||
// public GameObject star;
|
||||
// public GameObject twepMoon;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// if(!DBmanager.LoggedIn){SceneManager.LoadScene(0);}
|
||||
@@ -56,6 +45,27 @@ public class MinigameManager : NetworkBehaviour
|
||||
UpdateMaterialValues();
|
||||
|
||||
safeZoneShrinkSpeed = mapRadius / safeZoneShrinkTime;
|
||||
if(ControlSettings.ControlIsOnRight){
|
||||
joystick.anchorMin = new Vector2(0,0);
|
||||
joystick.anchorMax = new Vector2(0.5f, 1);
|
||||
|
||||
btn_boost.anchorMin = new Vector2(1,0);
|
||||
btn_boost.anchorMax = new Vector2(1,0);
|
||||
btn_boost.position = new Vector2(Screen.width-100, btn_boost.position.y);
|
||||
}else{
|
||||
joystick.anchorMin = new Vector2(0.5f,0);
|
||||
joystick.anchorMax = new Vector2(1f, 1);
|
||||
btn_boost.anchorMin = new Vector2(0,0);
|
||||
btn_boost.anchorMax = new Vector2(0,0);
|
||||
btn_boost.position = new Vector2(100, btn_boost.position.y);
|
||||
Vector2 newDef = new Vector2(-joystick.transform.GetChild(0).GetComponent<RectTransform>().localPosition.x, joystick.transform.GetChild(0).GetComponent<RectTransform>().localPosition.y);
|
||||
|
||||
joystick.GetComponent<Joystick>().SetDefaultPosition(newDef);
|
||||
}
|
||||
}
|
||||
|
||||
void Start(){
|
||||
AudioManager.instnace.SetCustomMusic(musicClips[Random.Range(0,musicClips.Length)]);
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
||||
BIN
Assets/Game/Scripts/Minigame/NetworkTrail.zip
Normal file
BIN
Assets/Game/Scripts/Minigame/NetworkTrail.zip
Normal file
Binary file not shown.
7
Assets/Game/Scripts/Minigame/NetworkTrail.zip.meta
Normal file
7
Assets/Game/Scripts/Minigame/NetworkTrail.zip.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d6ae5bb607090a45b2e2f8fcde698e9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -2,17 +2,42 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Mirror;
|
||||
using CustomExtensions;
|
||||
|
||||
public class PickupItem : NetworkBehaviour
|
||||
{
|
||||
public PickupType type;
|
||||
public float radius=1;
|
||||
public Color gizmoColor = Color.green;
|
||||
public bool active = true;
|
||||
|
||||
private Vector3 position;
|
||||
public GameObject PickupEffect;
|
||||
|
||||
void Start(){
|
||||
position = transform.position;
|
||||
newPosition= transform.position;
|
||||
movementTime = Random.Range(0.7f,1f);
|
||||
}
|
||||
|
||||
Vector3 newPosition;
|
||||
float posTimer = 0;
|
||||
float movementTime = 0;
|
||||
void Update()
|
||||
{
|
||||
if(!isServer){return;}
|
||||
|
||||
if(!isServer){
|
||||
// transform.position = Vector3.Lerp(transform.position, new Vector3(position.x + ((radius/2f) * Random.Range(-1f,1f)),position.y + ((radius/2f) * Random.Range(-1f,1f))),0.01f);
|
||||
if(posTimer < movementTime){
|
||||
posTimer+=Time.deltaTime;
|
||||
}else{
|
||||
newPosition = new Vector3(position.x + ((radius/2f) * Random.Range(-1f,1f)),position.y + ((radius/2f)));
|
||||
|
||||
posTimer= 0;
|
||||
}
|
||||
transform.position = Vector3.Lerp(transform.position, newPosition, 0.008f * movementTime);
|
||||
return;
|
||||
}
|
||||
if(!active){return;}
|
||||
|
||||
Collider2D hit = Physics2D.OverlapCircle(transform.position, radius);
|
||||
@@ -20,7 +45,7 @@ public class PickupItem : NetworkBehaviour
|
||||
// Debug.Log(hit.GetComponent<SpaceshipController>().pname +$" collected me at {transform.position}");
|
||||
hit.GetComponent<SpaceshipController>().CollectPickup(type);
|
||||
active=false;
|
||||
Deactivate();
|
||||
Deactivate(hit.transform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,33 +74,49 @@ public class PickupItem : NetworkBehaviour
|
||||
void reposition(Vector3 newPosition){
|
||||
active=true;
|
||||
transform.position = newPosition;
|
||||
position= newPosition;
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void Deactivate(){
|
||||
public void Deactivate(Transform playerPos){
|
||||
if(isServer){
|
||||
deactivate();
|
||||
RpcDeactivate();
|
||||
deactivate(playerPos);
|
||||
RpcDeactivate(playerPos);
|
||||
}else{
|
||||
CmdDeactivate();
|
||||
CmdDeactivate(playerPos);
|
||||
}
|
||||
}
|
||||
|
||||
void deactivate(){
|
||||
void deactivate(Transform playerPos){
|
||||
active=false;
|
||||
gameObject.SetActive(false);
|
||||
// gameObject.SetActive(false);
|
||||
StartCoroutine(MoveToPlayer(playerPos));
|
||||
SceneData.GameManager.DeactivatePickupItem(this);
|
||||
}
|
||||
|
||||
IEnumerator MoveToPlayer(Transform position){
|
||||
float speed = 0.01f;
|
||||
while(Vector3.Distance(position.position, transform.position) > 1f){
|
||||
transform.position = Vector3.Lerp(transform.position, position.position, speed);
|
||||
speed+= 0.01f;
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
if(!isServer){
|
||||
ParticleSystem particle = EffectPool.Spawn(PickupEffect, transform.position).GetComponent<ParticleSystem>();
|
||||
particle.startColor = type.GetColor();
|
||||
}
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
[Command]
|
||||
void CmdDeactivate(){
|
||||
deactivate();
|
||||
RpcDeactivate();
|
||||
void CmdDeactivate(Transform playerPos){
|
||||
deactivate(playerPos);
|
||||
RpcDeactivate(playerPos);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcDeactivate(){
|
||||
deactivate();
|
||||
void RpcDeactivate(Transform playerPos){
|
||||
deactivate(playerPos);
|
||||
}
|
||||
|
||||
private void OnDrawGizmos() {
|
||||
|
||||
@@ -6,9 +6,12 @@ public class RankedGameSummary : MonoBehaviour
|
||||
{
|
||||
public TMP_Text txtGameOver;
|
||||
public TMP_Text txtTrophies;
|
||||
|
||||
public ParticleSystem VictoryEffect;
|
||||
|
||||
|
||||
public void ShowWin(){
|
||||
VictoryEffect.Play();
|
||||
txtGameOver.text = "You Won!";
|
||||
txtTrophies.text= "+30";
|
||||
txtTrophies.color = Color.green;
|
||||
|
||||
@@ -135,7 +135,7 @@ public class RocketUpgradePanel : MonoBehaviour
|
||||
DBmanager.UpgradeRocketSpeed(selectedRocket, nextSpeedStats);
|
||||
SkinShopManager.instance.Populate();
|
||||
// MessageDialog.instance.ShowMessage("Success","Rocket Upgraded Successfully!");
|
||||
AudioManager.instnace.CollectPickup();
|
||||
AudioManager.instnace.UpgradeRocket();
|
||||
// Hide();
|
||||
Show(selectedRocket);
|
||||
UpgradeEffect.top_instance.Show(txtSpeed.rectTransform.position);
|
||||
@@ -152,7 +152,8 @@ public class RocketUpgradePanel : MonoBehaviour
|
||||
DBmanager.UpgradeRocketBoost(selectedRocket, nextBoostStats);
|
||||
SkinShopManager.instance.Populate();
|
||||
// MessageDialog.instance.ShowMessage("Success","Rocket Upgraded Successfully!");
|
||||
AudioManager.instnace.CollectPickup();
|
||||
AudioManager.instnace.UpgradeRocket();
|
||||
|
||||
// Hide();
|
||||
Show(selectedRocket);
|
||||
|
||||
@@ -170,7 +171,8 @@ public class RocketUpgradePanel : MonoBehaviour
|
||||
DBmanager.UpgradeRocketEnergy(selectedRocket, nextEnergyStats);
|
||||
SkinShopManager.instance.Populate();
|
||||
// MessageDialog.instance.ShowMessage("Success","Rocket Upgraded Successfully!");
|
||||
AudioManager.instnace.CollectPickup();
|
||||
AudioManager.instnace.UpgradeRocket();
|
||||
|
||||
// Hide();
|
||||
Show(selectedRocket);
|
||||
UpgradeEffect.top_instance.Show(txtEnergyGain.rectTransform.position);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SceneDataHolder : MonoBehaviour
|
||||
if(!MinigameManager.instance.isRanked){
|
||||
survivalTimeTxt.text = SceneData.SecondsToText(survivalTime);
|
||||
mostTimeTxt.text = SceneData.SecondsToText(DBmanager.MostTime);
|
||||
AudioManager.instnace.MinigameLost();
|
||||
AudioManager.instnace.MinigameDied();
|
||||
|
||||
}else{
|
||||
// MinigameManager.instance.rankedSummary.ShowLoss();
|
||||
|
||||
@@ -47,14 +47,16 @@ public class SpaceshipControllerSolo : MonoBehaviour
|
||||
}
|
||||
|
||||
public void CollectPickup(PickupItemSolo.PickupType type){
|
||||
AudioManager.instnace.CollectPickup();
|
||||
switch(type){
|
||||
case PickupItemSolo.PickupType.Moon:
|
||||
AudioManager.instnace.CollectMoon();
|
||||
trailMgr.trail.time += TrailIncrementRate;
|
||||
MoonsCollected++;
|
||||
break;
|
||||
|
||||
case PickupItemSolo.PickupType.Star:
|
||||
AudioManager.instnace.CollectStar();
|
||||
|
||||
trailMgr.trail.time += TrailIncrementRate/2f;
|
||||
|
||||
break;
|
||||
|
||||
@@ -72,11 +72,13 @@ public class SpaceshipController : NetworkBehaviour
|
||||
[SerializeField]private int RubberBandsCount;
|
||||
public GameObject DeathEffect;
|
||||
public GameObject debrisEffect;
|
||||
public GameObject PickupEffect;
|
||||
// public GameObject PickupEffect;
|
||||
|
||||
public float distanceFromCenter = 0;
|
||||
RocketLevel rocketStats;
|
||||
|
||||
[Header("AudioFX")]
|
||||
public AudioSource engineAudio;
|
||||
public float normalPitch,boostedPitch;
|
||||
public void SetReady(bool value)
|
||||
{
|
||||
if (isServer)
|
||||
@@ -155,6 +157,7 @@ public class SpaceshipController : NetworkBehaviour
|
||||
{
|
||||
if (isLocalPlayer)
|
||||
{
|
||||
AudioManager.instnace.Boost();
|
||||
if (isServer)
|
||||
{
|
||||
boosting = true;
|
||||
@@ -163,6 +166,8 @@ public class SpaceshipController : NetworkBehaviour
|
||||
{
|
||||
CmdSetBoosting(true);
|
||||
}
|
||||
|
||||
CameraFollower.instance.ShakeBoost();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,6 +280,12 @@ public class SpaceshipController : NetworkBehaviour
|
||||
startedTime = NetworkTime.time;
|
||||
trailTime = 0;
|
||||
DecreaseTrail(0);
|
||||
}else{
|
||||
if(AudioManager.SFX_enabled){
|
||||
engineAudio.volume = 1;
|
||||
}else{
|
||||
engineAudio.volume= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,7 +408,7 @@ public class SpaceshipController : NetworkBehaviour
|
||||
if (boosting && scale > 1)
|
||||
{
|
||||
speed = movingSpeed * 2 * speedMultiplier;
|
||||
DecreaseTrail(Time.deltaTime * boostConsumption);
|
||||
DecreaseTrail(Time.deltaTime * boostConsumption * 0.5f);
|
||||
// scaleMultiplier -= Time.deltaTime;
|
||||
// if (scaleMultiplier < 1) { scaleMultiplier = 1; } //Clamp in case gets lower
|
||||
}
|
||||
@@ -405,10 +416,11 @@ public class SpaceshipController : NetworkBehaviour
|
||||
{
|
||||
speed = movingSpeed * speedMultiplier;
|
||||
}
|
||||
}else{ // not server
|
||||
engineAudio.pitch = Mathf.Lerp(engineAudio.pitch, (boosting) ? boostedPitch : normalPitch, 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HandleInput(Vector2 _input){
|
||||
// transform.Translate(transform.forward * _input.y);
|
||||
// transform.Rotate(transform.up * _input.x);
|
||||
@@ -651,10 +663,9 @@ public class SpaceshipController : NetworkBehaviour
|
||||
MinigameManager.instance.GainMetals(gainedEnergy);
|
||||
}
|
||||
|
||||
AudioManager.instnace.CollectPickup();
|
||||
AudioManager.instnace.CollectMoon();
|
||||
}
|
||||
ParticleSystem particle = EffectPool.Spawn(PickupEffect, transform.position).GetComponent<ParticleSystem>();
|
||||
particle.startColor = type.GetColor();
|
||||
|
||||
}
|
||||
|
||||
public void Die(string killer)
|
||||
|
||||
@@ -80,6 +80,7 @@ public class NewLoginManager : MonoBehaviour
|
||||
statusTxt.text = "Logging you in...";
|
||||
|
||||
WWWForm form = new WWWForm();
|
||||
yield return new WaitForSeconds(1);
|
||||
form.AddField("name", savedUsername);
|
||||
form.AddField("password", savedPassword);
|
||||
WWW www = new WWW(DBmanager.phpRoot + "login.php",form);
|
||||
@@ -89,10 +90,15 @@ public class NewLoginManager : MonoBehaviour
|
||||
|
||||
if(DBmanager.Login(www.text)==0){
|
||||
if(TutorialManager.justRegistered){
|
||||
SceneManager.LoadScene("MinigameTutorial");
|
||||
// SceneManager.LoadScene("MinigameTutorial");
|
||||
LoadingScreen.instance.LoadLevel("MinigameTutorial");
|
||||
|
||||
// SceneManager.LoadScene("GameScene");
|
||||
}else{
|
||||
SceneManager.LoadScene("GameScene");
|
||||
// SceneManager.LoadScene("GameScene");
|
||||
LoadingScreen.instance.LoadLevel("GameScene");
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
statusTxt.text = "Failed!";
|
||||
|
||||
@@ -59,9 +59,34 @@ public class SelectedItemMenu : MonoBehaviour
|
||||
btn_gold_cap.onClick.AddListener(OnGoldmineCapUpgrade);
|
||||
btn_gold_prod.onClick.AddListener(OnGoldmineProdUpgrade);
|
||||
}
|
||||
Building lastSelectedBuilding = null;
|
||||
IEnumerator DoubleClickTimer(Building b){
|
||||
yield return new WaitForSeconds(0.05f);
|
||||
lastSelectedBuilding = Selector.selectedBuilding;
|
||||
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
lastSelectedBuilding = null;
|
||||
Debug.Log("Reset tap");
|
||||
|
||||
}
|
||||
|
||||
void OnSelectionChanged()
|
||||
{
|
||||
if(lastSelectedBuilding == null){
|
||||
Debug.Log("First tap");
|
||||
}else{
|
||||
//Double Clicked
|
||||
Debug.Log("Second tap");
|
||||
|
||||
if(Selector.selectedData == rocketRepair){
|
||||
OpenSkinMenu();
|
||||
}else if(Selector.selectedData == tradePost){
|
||||
OpenTradingPost();
|
||||
}else if(Selector.selectedData == designLabBuilding){
|
||||
OpenDesignLab();
|
||||
}
|
||||
}
|
||||
StartCoroutine(DoubleClickTimer(Selector.selectedBuilding));
|
||||
if (Selector.selectedBuilding != null)
|
||||
{
|
||||
infoBtn.gameObject.SetActive(true);
|
||||
|
||||
@@ -139,6 +139,8 @@ public static class Selector{
|
||||
selectedBuilding = e;
|
||||
if(insideHall){selectedBuilding=null;}
|
||||
OnSelectedChanged.Invoke();
|
||||
|
||||
AudioManager.instnace.UIClick();
|
||||
}
|
||||
|
||||
public static void selectHuman(HumanInteractor e){
|
||||
|
||||
Reference in New Issue
Block a user