FX done
This commit is contained in:
parent
786cd95f19
commit
9915446d1c
9751
Assets/Game/Prefabs/Minigame/PickupEffect.prefab
Normal file
9751
Assets/Game/Prefabs/Minigame/PickupEffect.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Game/Prefabs/Minigame/PickupEffect.prefab.meta
Normal file
7
Assets/Game/Prefabs/Minigame/PickupEffect.prefab.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f8c0430f28bc6a743a366002b2fea52f
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -378,6 +378,8 @@ MonoBehaviour:
|
|||
ErrorInputCount: 0
|
||||
ErrorStateCount: 0
|
||||
RubberBandsCount: 0
|
||||
DeathEffect: {fileID: 7331350358683325927, guid: 8c201be402a7d4944836d4e104499bb0, type: 3}
|
||||
PickupEffect: {fileID: 3848734746219421256, guid: f8c0430f28bc6a743a366002b2fea52f, type: 3}
|
||||
distanceFromCenter: 0
|
||||
--- !u!114 &5995183602835295541
|
||||
MonoBehaviour:
|
||||
|
|
|
|||
|
|
@ -9653,7 +9653,6 @@ GameObject:
|
|||
- component: {fileID: 7455977575346049103}
|
||||
- component: {fileID: 7250449672139357247}
|
||||
- component: {fileID: 7218394794167734203}
|
||||
- component: {fileID: 8958074554064743335}
|
||||
m_Layer: 0
|
||||
m_Name: PlayerDieEffect
|
||||
m_TagString: Untagged
|
||||
|
|
@ -14575,18 +14574,6 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
randomPercent: 8
|
||||
--- !u!114 &8958074554064743335
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7331350358683325927}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a038dc6419ea51e4ab51736b387cc6ce, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &7331386412199724289
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ SpriteRenderer:
|
|||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: 21300000, guid: 70135132204c44649ac53b468b0949e6, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 118075b516a904f66a2076973fc18fa8, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ SpriteRenderer:
|
|||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: 21300000, guid: 118075b516a904f66a2076973fc18fa8, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 03bf5599744f94a058179abeccd1cca2, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ SpriteRenderer:
|
|||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: 21300000, guid: 03bf5599744f94a058179abeccd1cca2, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 5a1e9e2eef07045b49c877107d73343f, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ SpriteRenderer:
|
|||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 1
|
||||
m_Sprite: {fileID: 21300000, guid: 5a1e9e2eef07045b49c877107d73343f, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: 70135132204c44649ac53b468b0949e6, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
|
|
|
|||
|
|
@ -1429,8 +1429,8 @@ BoxCollider:
|
|||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 44.13504, y: 21.177668, z: 42.312885}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 44.13504, y: 14.73, z: 34}
|
||||
m_Center: {x: 0.2, y: -2.39, z: -0.93}
|
||||
--- !u!114 &7038491
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1448,6 +1448,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!1 &7496276
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -120718,6 +120719,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!1001 &410054828
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -226066,6 +226068,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!1001 &734058384
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -268396,6 +268399,11 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 53edd1304ce7ec14fa61e457a4745d7a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Camera: {fileID: 0}
|
||||
Rotate: 0
|
||||
DecreaseCameraPanSpeed: 1
|
||||
CameraUpperHeightBound: 0
|
||||
CameraLowerHeightBound: 0
|
||||
--- !u!4 &828023762
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -285965,6 +285973,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!4 &888537841 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4241811459315326, guid: b0c5c3f9b8286e14f95e62362776397f, type: 3}
|
||||
|
|
@ -342958,6 +342967,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!114 &1134774561
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -389830,6 +389840,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!65 &1246197563
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -449971,6 +449982,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!65 &1463485149
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -477897,6 +477909,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!65 &1550431836
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -484553,6 +484566,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!65 &1583058846
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -529612,6 +529626,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!1 &1698128106
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -556268,6 +556283,7 @@ MonoBehaviour:
|
|||
outlines:
|
||||
- {fileID: 943428140}
|
||||
autoGetOutlines: 0
|
||||
_lastCollected:
|
||||
--- !u!65 &1783245364
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -556280,7 +556296,7 @@ BoxCollider:
|
|||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 33.814045, y: 25.173874, z: 36.91852}
|
||||
m_Center: {x: 0, y: 12.086937, z: 0}
|
||||
m_Center: {x: -5.89, y: 7.15, z: -1.87}
|
||||
--- !u!4 &1784015607 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4207568928025374, guid: 9dd3fb8ac8fed334fa8c89fad4607d76, type: 3}
|
||||
|
|
@ -598412,6 +598428,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!4 &1904112555 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4175980960680466, guid: befcb46639eb71546951890e87983293, type: 3}
|
||||
|
|
@ -615286,6 +615303,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!65 &1970335797
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -634456,6 +634474,7 @@ MonoBehaviour:
|
|||
additionalLevels:
|
||||
outlines: []
|
||||
autoGetOutlines: 1
|
||||
_lastCollected:
|
||||
--- !u!65 &2016105858
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -6099,8 +6099,6 @@ MonoBehaviour:
|
|||
Pooled: []
|
||||
starPrefab: {fileID: 8298505072154104440, guid: 8cfd89c315493e64782e167885b4b498, type: 3}
|
||||
pickupItemsParent: {fileID: 41572335}
|
||||
DeathEffectPrefab: {fileID: 7331350358683325927, guid: 8c201be402a7d4944836d4e104499bb0, type: 3}
|
||||
EffectsParent: {fileID: 395348370}
|
||||
loadingScreen: {fileID: 908570975}
|
||||
metalTxt: {fileID: 1251195779}
|
||||
--- !u!114 &332697611
|
||||
|
|
@ -6129,6 +6127,7 @@ GameObject:
|
|||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 395348370}
|
||||
- component: {fileID: 395348371}
|
||||
m_Layer: 0
|
||||
m_Name: Effects
|
||||
m_TagString: Untagged
|
||||
|
|
@ -6150,6 +6149,19 @@ Transform:
|
|||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 12
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &395348371
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 395348369}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0be9f0bd961873847bb0bfc1a846c50d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
EffectsParent: {fileID: 395348370}
|
||||
--- !u!1 &422557611
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -10827,8 +10827,6 @@ MonoBehaviour:
|
|||
Pooled: []
|
||||
starPrefab: {fileID: 8298505072154104440, guid: 8cfd89c315493e64782e167885b4b498, type: 3}
|
||||
pickupItemsParent: {fileID: 41572335}
|
||||
DeathEffectPrefab: {fileID: 7331350358683325927, guid: 8c201be402a7d4944836d4e104499bb0, type: 3}
|
||||
EffectsParent: {fileID: 646352076}
|
||||
loadingScreen: {fileID: 908570975}
|
||||
metalTxt: {fileID: 1251195779}
|
||||
--- !u!114 &332697611
|
||||
|
|
|
|||
|
|
@ -8,8 +8,12 @@ public class Building : MonoBehaviour
|
|||
public int[] additionalLevels;
|
||||
public Outline[] outlines;
|
||||
public bool autoGetOutlines = true;
|
||||
|
||||
public DateTime lastCollected;
|
||||
private DateTime m_lastCollected;
|
||||
public DateTime lastCollected{ get{return m_lastCollected;}set{
|
||||
_lastCollected = value.ToString();
|
||||
m_lastCollected = value;
|
||||
}}
|
||||
[SerializeField]private string _lastCollected;
|
||||
|
||||
ParticleSystem[] levelUps;
|
||||
|
||||
|
|
@ -143,4 +147,9 @@ public class BuildingState{
|
|||
position = m_position;
|
||||
lastCollectedTimestamp= _lastCollectedTimestamp;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return JsonUtility.ToJson(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using EasyButtons;
|
||||
using UnityEngine;
|
||||
|
||||
|
|
@ -21,38 +22,24 @@ public class BuildingManager : MonoBehaviour
|
|||
|
||||
|
||||
public async void UpdateBuildings(){
|
||||
|
||||
|
||||
//Add default buildings
|
||||
foreach (Building building in buildings){
|
||||
if(!building.gameObject.activeSelf){
|
||||
continue;
|
||||
}
|
||||
bool buildingExists = false;
|
||||
foreach (BuildingState buildingState in DBmanager.buildingStates){
|
||||
if(buildingState.id == building.buildingData.buildingName){
|
||||
buildingExists =true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!buildingExists){
|
||||
building.lastCollected = DateTime.Now.Subtract(TimeSpan.FromDays(1));
|
||||
if(DBmanager.buildingStates.ContainsKey(building.buildingData.buildingName)){
|
||||
Debug.Log(DBmanager.buildingStates[building.buildingData.buildingName]);
|
||||
building.curLevel = DBmanager.buildingStates[building.buildingData.buildingName].level;
|
||||
building.lastCollected = DBmanager.buildingStates[building.buildingData.buildingName].lastCollectedTimestamp;
|
||||
|
||||
}else{
|
||||
await DBmanager.AddBuilding(building.buildingData);
|
||||
building.curLevel = DBmanager.buildingStates[building.buildingData.buildingName].level;
|
||||
building.lastCollected = DBmanager.buildingStates[building.buildingData.buildingName].lastCollectedTimestamp;
|
||||
}
|
||||
}
|
||||
foreach (Building building in buildings){
|
||||
bool buildingExists = false;
|
||||
foreach (BuildingState buildingState in DBmanager.buildingStates){
|
||||
if(buildingState.id == building.buildingData.buildingName){
|
||||
buildingExists =true;
|
||||
building.curLevel = buildingState.level;
|
||||
// building.transform.position = (buildingState.position != Vector3.zero) ? buildingState.position : building.transform.position;
|
||||
building.lastCollected = buildingState.lastCollectedTimestamp;
|
||||
Debug.Log(building.lastCollected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// building.gameObject.SetActive(buildingExists);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClickBuyBuilding(BuildingData buildingData){
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ public class CollectBtn : MonoBehaviour
|
|||
|
||||
public async void OnClick(){
|
||||
// lastCollected = await DBmanager.GetNetworkTime();
|
||||
DBmanager.CollectBuilding(buildingId);
|
||||
|
||||
switch (resourceType){
|
||||
case CollectablesData.ResourceType.Metal:
|
||||
collectableAmount= GetCollectableEnergy();
|
||||
|
|
@ -57,7 +59,6 @@ public class CollectBtn : MonoBehaviour
|
|||
// DBmanager.SetOxygen(DBmanager.Trophies + (int)collectableAmount);
|
||||
// break;
|
||||
}
|
||||
DBmanager.CollectBuilding(buildingId);
|
||||
Selector.selectBuilding(null);
|
||||
}
|
||||
|
||||
|
|
|
|||
80
Assets/Game/Scripts/EffectPool.cs
Normal file
80
Assets/Game/Scripts/EffectPool.cs
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EffectPool : MonoBehaviour
|
||||
{
|
||||
[SerializeField]private Dictionary<string, List<GameObject>> pool = new Dictionary<string, List<GameObject>>();
|
||||
[SerializeField]private Dictionary<string, List<GameObject>> active= new Dictionary<string, List<GameObject>>();
|
||||
[SerializeField]private Transform EffectsParent;
|
||||
public static EffectPool instance {get; private set;}
|
||||
|
||||
void Awake(){
|
||||
instance = this;
|
||||
pool = new Dictionary<string, List<GameObject>>();
|
||||
active= new Dictionary<string, List<GameObject>>();
|
||||
}
|
||||
|
||||
public static GameObject Spawn(GameObject prefab, Vector3 position){
|
||||
return instance.m_Spawn(prefab,position);
|
||||
}
|
||||
|
||||
GameObject m_Spawn(GameObject prefab, Vector3 position, float delay = 2f){
|
||||
if(pool.ContainsKey(prefab.name)){
|
||||
if(pool[prefab.name].Count > 0){
|
||||
//Has in pool
|
||||
GameObject reactivated = Reactivate(prefab.name,pool[prefab.name][0], position);
|
||||
StartCoroutine(AutoDeactivate(prefab.name, reactivated,delay));
|
||||
return reactivated;
|
||||
}
|
||||
}
|
||||
|
||||
//Not in pool
|
||||
GameObject newItem = Instantiate(prefab, EffectsParent);
|
||||
if(!active.ContainsKey(prefab.name)){
|
||||
active.Add(prefab.name, new List<GameObject>());
|
||||
}
|
||||
active[prefab.name].Add(newItem);
|
||||
StartCoroutine(AutoDeactivate(prefab.name, newItem,delay));
|
||||
|
||||
return newItem;
|
||||
}
|
||||
|
||||
IEnumerator AutoDeactivate(string name, GameObject item, float delay){
|
||||
yield return new WaitForSeconds(delay);
|
||||
|
||||
m_deactivate(name,item);
|
||||
}
|
||||
|
||||
void m_deactivate(string name, GameObject item){
|
||||
active[name].Remove(item);
|
||||
if(!pool.ContainsKey(name)){
|
||||
pool.Add(name, new List<GameObject>());
|
||||
}
|
||||
|
||||
pool[name].Add(item);
|
||||
}
|
||||
|
||||
|
||||
GameObject Reactivate(string name,GameObject item, Vector3 position){
|
||||
if(!pool.ContainsKey(name)){
|
||||
throw new System.NullReferenceException("Item not available in pool");
|
||||
}
|
||||
pool[name].Remove(item);
|
||||
active[name].Add(item);
|
||||
|
||||
item.transform.position= position;
|
||||
|
||||
ParticleSystem[] particles = item.GetComponentsInChildren<ParticleSystem>();
|
||||
foreach(ParticleSystem particle in particles){
|
||||
particle.Play();
|
||||
}
|
||||
|
||||
AudioSource[] audios = item.GetComponentsInChildren<AudioSource>();
|
||||
foreach(AudioSource audio in audios){
|
||||
audio.Play();
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
11
Assets/Game/Scripts/EffectPool.cs.meta
Normal file
11
Assets/Game/Scripts/EffectPool.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0be9f0bd961873847bb0bfc1a846c50d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -72,7 +72,7 @@ public class GameManager : MonoBehaviour
|
|||
networkCheckTimer += Time.deltaTime;
|
||||
if (networkCheckTimer > NetworkCheckInterval)
|
||||
{
|
||||
Debug.Log(Application.internetReachability);
|
||||
// Debug.Log(Application.internetReachability);
|
||||
if (Application.internetReachability == NetworkReachability.NotReachable)
|
||||
{
|
||||
networkErrorPopup.SetActive(true);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using UnityEngine.SceneManagement;
|
|||
|
||||
public class MaintainceChecker : MonoBehaviour
|
||||
{
|
||||
public static int version = 16;
|
||||
public static int version = 20;
|
||||
public static MaintainceChecker instance;
|
||||
public int checkInterval = 30;
|
||||
float t;
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ 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<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>();
|
||||
|
|
@ -245,27 +245,27 @@ public class MinigameManager : NetworkBehaviour
|
|||
pickup.Pooled.Add(item);
|
||||
}
|
||||
}
|
||||
public void ShowDeathEffect(Vector2 position){
|
||||
if(isServer){return;}
|
||||
if(PooledDeathEffects.Count > 0){
|
||||
//Can use from pool [0]
|
||||
DeathEffect pickedItem = PooledDeathEffects[0];
|
||||
pickedItem.Play();
|
||||
StartCoroutine(PoolDeathEffect(pickedItem));
|
||||
PooledDeathEffects.Remove(pickedItem);
|
||||
}else{
|
||||
DeathEffect newEffect = Instantiate(DeathEffectPrefab, EffectsParent).GetComponent<DeathEffect>();
|
||||
newEffect.transform.position = position;
|
||||
newEffect.Play();
|
||||
StartCoroutine(PoolDeathEffect(newEffect));
|
||||
}
|
||||
}
|
||||
// public void ShowDeathEffect(Vector2 position){
|
||||
// if(isServer){return;}
|
||||
// if(PooledDeathEffects.Count > 0){
|
||||
// //Can use from pool [0]
|
||||
// DeathEffect pickedItem = PooledDeathEffects[0];
|
||||
// pickedItem.Play();
|
||||
// StartCoroutine(PoolDeathEffect(pickedItem));
|
||||
// PooledDeathEffects.Remove(pickedItem);
|
||||
// }else{
|
||||
// DeathEffect newEffect = Instantiate(DeathEffectPrefab, EffectsParent).GetComponent<DeathEffect>();
|
||||
// newEffect.transform.position = position;
|
||||
// newEffect.Play();
|
||||
// StartCoroutine(PoolDeathEffect(newEffect));
|
||||
// }
|
||||
// }
|
||||
|
||||
IEnumerator PoolDeathEffect(DeathEffect effect){
|
||||
yield return new WaitForSeconds(1.5f);
|
||||
// IEnumerator PoolDeathEffect(DeathEffect effect){
|
||||
// yield return new WaitForSeconds(1.5f);
|
||||
|
||||
PooledDeathEffects.Add(effect);
|
||||
}
|
||||
// PooledDeathEffects.Add(effect);
|
||||
// }
|
||||
|
||||
public void SetRespawn(GameObject player)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class RocketUpgradePanel : MonoBehaviour
|
|||
curEnergyLevel = data.energyLevel;
|
||||
curBoostLevel = data.boostLevel;
|
||||
txtRocketLevel.text = "Level " + curRocketLevel;
|
||||
txtEnergyGain.text = $"{ curEnergy } Per moon";
|
||||
txtEnergyGain.text = $"{ curEnergy } per Crystal";
|
||||
txtSpeed.text = $"{curSpeed*100}%";
|
||||
txtBoostConsumption.text = $"{ curBoost *100}%";
|
||||
int maxLevels =SkinShopManager.GetStatsForRarity(rarity).Length;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ public class SpaceshipController : NetworkBehaviour
|
|||
[SerializeField]private int ErrorInputCount;
|
||||
[SerializeField]private int ErrorStateCount;
|
||||
[SerializeField]private int RubberBandsCount;
|
||||
public GameObject DeathEffect;
|
||||
public GameObject PickupEffect;
|
||||
|
||||
public float distanceFromCenter = 0;
|
||||
RocketLevel rocketStats;
|
||||
|
|
@ -546,7 +548,8 @@ public class SpaceshipController : NetworkBehaviour
|
|||
}
|
||||
public void ShowDeathEffect(Vector2 position){
|
||||
if(isServer){
|
||||
MinigameManager.instance.ShowDeathEffect(position);
|
||||
// MinigameManager.instance.ShowDeathEffect(position);
|
||||
EffectPool.Spawn(DeathEffect, position);
|
||||
RpcShowDeathEffect(position);
|
||||
}else{
|
||||
CmdShowDeathEffect(position);
|
||||
|
|
@ -555,14 +558,16 @@ public class SpaceshipController : NetworkBehaviour
|
|||
|
||||
[Command]
|
||||
void CmdShowDeathEffect(Vector2 position){
|
||||
MinigameManager.instance.ShowDeathEffect(position);
|
||||
EffectPool.Spawn(DeathEffect, position);
|
||||
|
||||
|
||||
RpcShowDeathEffect(position);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
void RpcShowDeathEffect(Vector2 position){
|
||||
MinigameManager.instance.ShowDeathEffect(position);
|
||||
EffectPool.Spawn(DeathEffect, position);
|
||||
|
||||
}
|
||||
|
||||
void OnKill()
|
||||
|
|
@ -631,6 +636,7 @@ public class SpaceshipController : NetworkBehaviour
|
|||
[ClientRpc]
|
||||
void RpcCollectPickup(PickupItem.PickupType type)
|
||||
{
|
||||
|
||||
if (isLocalPlayer)
|
||||
{
|
||||
if (type == PickupItem.PickupType.Twep)
|
||||
|
|
@ -646,6 +652,8 @@ public class SpaceshipController : NetworkBehaviour
|
|||
|
||||
AudioManager.instnace.CollectPickup();
|
||||
}
|
||||
ParticleSystem particle = EffectPool.Spawn(PickupEffect, transform.position).GetComponent<ParticleSystem>();
|
||||
particle.startColor = type.GetColor();
|
||||
}
|
||||
|
||||
public void Die(string killer)
|
||||
|
|
|
|||
|
|
@ -26,13 +26,7 @@ public class ShopBuildingButton : MonoBehaviour
|
|||
}
|
||||
|
||||
public void refresh(){
|
||||
bool exists = false;
|
||||
foreach (BuildingState buildingState in DBmanager.buildingStates){
|
||||
if(buildingState.id == buildingData.buildingName){
|
||||
exists=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool exists = DBmanager.buildingStates.ContainsKey(buildingData.buildingName);
|
||||
gameObject.SetActive(!exists);
|
||||
btn.interactable = (DBmanager.Coins > buildingData.levels[0].price);
|
||||
txt.text = buildingData.levels[0].price.ToString();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class DBmanager : MonoBehaviour
|
|||
{
|
||||
static RankLevel[] rankLevels;
|
||||
static RankLevel[] RankLevels {get{if(rankLevels==null){return Resources.Load<RankLevels>("ScriptableObjects/RankLevels").levels;}else{return rankLevels;}}}
|
||||
public static string phpRoot = "http://vmi1005083.contaboserver.net/upf/";
|
||||
public static string phpRoot = "vmi1005083.contaboserver.net/upf/";
|
||||
|
||||
public static string username = null;
|
||||
public static int userid=0;
|
||||
|
|
@ -32,7 +32,7 @@ public class DBmanager : MonoBehaviour
|
|||
private static List<int> expPassCollected = new List<int>();
|
||||
private static List<PurchasedSkin> skinsPurchased = new List<PurchasedSkin>(){defaultSkin};
|
||||
static PurchasedSkin defaultSkin => new PurchasedSkin(){name="Default"};
|
||||
public static List<BuildingState> buildingStates = new List<BuildingState>();
|
||||
public static Dictionary<string, BuildingState> buildingStates = new Dictionary<string, BuildingState>();
|
||||
public static UnityEvent OnStateChanged = new UnityEvent();
|
||||
|
||||
public static int Xp => xp;
|
||||
|
|
@ -114,6 +114,7 @@ public class DBmanager : MonoBehaviour
|
|||
}catch (Exception e){
|
||||
Debug.LogError("Couldn't parse data into json");
|
||||
Debug.LogError(e.Message);
|
||||
Debug.LogWarning(jsonData);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -155,7 +156,9 @@ public class DBmanager : MonoBehaviour
|
|||
|
||||
return rank;
|
||||
}
|
||||
|
||||
private static int timeDifference;
|
||||
public static Int32 unixTimestamp {get{return (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;}}
|
||||
public static Int32 unixTimestampCached {get{return unixTimestamp + timeDifference;}}
|
||||
public static async Task<DateTime> GetNetworkTime()
|
||||
{
|
||||
int unixTime = 0;
|
||||
|
|
@ -178,6 +181,7 @@ public class DBmanager : MonoBehaviour
|
|||
|
||||
if (unixTime > 0)
|
||||
{
|
||||
timeDifference = unixTime - unixTimestamp;
|
||||
return DateTimeOffset.FromUnixTimeSeconds(unixTime).UtcDateTime;
|
||||
}
|
||||
|
||||
|
|
@ -304,6 +308,7 @@ public class DBmanager : MonoBehaviour
|
|||
WWWForm form = new WWWForm();
|
||||
form.AddField("name", username);
|
||||
form.AddField("coins", newValue);
|
||||
int oldValue = coins;
|
||||
coins = Mathf.Clamp(newValue,0,int.MaxValue);
|
||||
if (justOffline) { return; }
|
||||
using (UnityWebRequest www = UnityWebRequest.Post(phpRoot + "set_coins.php", form))
|
||||
|
|
@ -320,6 +325,7 @@ public class DBmanager : MonoBehaviour
|
|||
}
|
||||
else
|
||||
{
|
||||
coins = oldValue;
|
||||
Debug.Log("Response : " + www.downloadHandler.text);
|
||||
Debug.LogWarning("Failed to set coins to " + newValue);
|
||||
}
|
||||
|
|
@ -859,13 +865,25 @@ public class DBmanager : MonoBehaviour
|
|||
{
|
||||
bool success = false;
|
||||
//try{
|
||||
Debug.Log("Updating buildings");
|
||||
// List<BuildingState> m_buildingStates = JsonConvert.DeserializeObject<List<BuildingState>>(rawData);
|
||||
// Debug.Log("Updating buildings data, isNull: " + (m_buildingStates == null).ToString());
|
||||
// if (m_buildingStates == null)
|
||||
// {
|
||||
// m_buildingStates = new List<BuildingState>();
|
||||
// }
|
||||
|
||||
buildingStates = JsonConvert.DeserializeObject<List<BuildingState>>(rawData);
|
||||
// buildingStates = new Dictionary<string, BuildingState>();
|
||||
// foreach(BuildingState building in m_buildingStates){
|
||||
// buildingStates.Add(building.id, building);
|
||||
// }
|
||||
buildingStates = JsonConvert.DeserializeObject<Dictionary<string, BuildingState>>(rawData);
|
||||
Debug.Log("Updating buildings data, isNull: " + (buildingStates == null).ToString());
|
||||
if (buildingStates == null)
|
||||
{
|
||||
buildingStates = new List<BuildingState>();
|
||||
buildingStates = new Dictionary<string, BuildingState>();
|
||||
}
|
||||
|
||||
success = true;
|
||||
// }catch(Exception e){
|
||||
// Debug.LogError(e.Message+'\n' + e.StackTrace);
|
||||
|
|
@ -882,17 +900,13 @@ public class DBmanager : MonoBehaviour
|
|||
|
||||
public async static Task AddBuilding(BuildingData buildingData)
|
||||
{
|
||||
if(buildingStates.ContainsKey(buildingData.buildingName)){
|
||||
Debug.Log("Building " + buildingData.buildingName + " Already exists");
|
||||
return;
|
||||
};
|
||||
|
||||
foreach (BuildingState buildingState in buildingStates)
|
||||
{
|
||||
if (buildingState.id == buildingData.buildingName)
|
||||
{
|
||||
Debug.LogError("Building already exists. Cannot add " + buildingState.id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Debug.Log("adding new building " + buildingData.buildingName);
|
||||
buildingStates.Add(new BuildingState(buildingData.buildingName, 0, Vector3.zero, await GetNetworkTime()));
|
||||
buildingStates.Add(buildingData.buildingName,new BuildingState(buildingData.buildingName, 0, Vector3.zero, await GetNetworkTime()));
|
||||
Debug.Log("Added new building " + buildingData.buildingName);
|
||||
await UpdateBuildingsToServer();
|
||||
OnStateChanged.Invoke();
|
||||
|
|
@ -901,54 +915,42 @@ public class DBmanager : MonoBehaviour
|
|||
|
||||
public async static Task UpgradeBuilding(string id, int newLevel)
|
||||
{
|
||||
for (int i = 0; i < buildingStates.Count; i++)
|
||||
{
|
||||
if (buildingStates[i].id == id)
|
||||
{
|
||||
buildingStates[i].level = newLevel;
|
||||
Debug.Log("Upgrading " + id + " to " + newLevel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
buildingStates[id].level = newLevel;
|
||||
Debug.Log("Upgrading " + id + " to " + newLevel);
|
||||
await UpdateBuildingsToServer();
|
||||
|
||||
OnStateChanged.Invoke();
|
||||
}
|
||||
|
||||
public async static Task CollectBuilding(string id)
|
||||
{
|
||||
for (int i = 0; i < buildingStates.Count; i++)
|
||||
{
|
||||
if (buildingStates[i].id == id)
|
||||
{
|
||||
buildingStates[i].lastCollectedTimestamp = await GetNetworkTime();
|
||||
Debug.Log("Setting " + id + " last collected to " + buildingStates[i].lastCollectedTimestamp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
buildingStates[id].lastCollectedTimestamp = DateTimeOffset.FromUnixTimeSeconds(unixTimestampCached).UtcDateTime;;
|
||||
buildingStates[id].lastCollectedTimestamp = await GetNetworkTime();
|
||||
|
||||
BuildingManager.instance.UpdateBuildings();
|
||||
|
||||
await UpdateBuildingsToServer();
|
||||
|
||||
OnStateChanged.Invoke();
|
||||
}
|
||||
|
||||
public async static Task RelocateBuilding(string id, Vector3 newPosition)
|
||||
{
|
||||
for (int i = 0; i < buildingStates.Count; i++)
|
||||
{
|
||||
if (buildingStates[i].id == id)
|
||||
{
|
||||
buildingStates[i].position = newPosition;
|
||||
Debug.Log("Relocating " + id + " to " + newPosition);
|
||||
// break;
|
||||
}
|
||||
}
|
||||
Debug.Log("Going to update to server" + JsonConvert.SerializeObject(buildingStates));
|
||||
await UpdateBuildingsToServer();
|
||||
// public async static Task RelocateBuilding(string id, Vector3 newPosition)
|
||||
// {
|
||||
// for (int i = 0; i < buildingStates.Count; i++)
|
||||
// {
|
||||
// if (buildingStates[i].id == id)
|
||||
// {
|
||||
// buildingStates[i].position = newPosition;
|
||||
// Debug.Log("Relocating " + id + " to " + newPosition);
|
||||
// // break;
|
||||
// }
|
||||
// }
|
||||
// Debug.Log("Going to update to server" + JsonConvert.SerializeObject(buildingStates));
|
||||
// await UpdateBuildingsToServer();
|
||||
|
||||
// OnStateChanged.Invoke();
|
||||
// }
|
||||
|
||||
OnStateChanged.Invoke();
|
||||
}
|
||||
|
||||
public async static Task UpdateBuildingsToServer()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -139,5 +139,37 @@ namespace CustomExtensions{
|
|||
|
||||
return 0;
|
||||
}
|
||||
public static Color GetColor(this PickupItem.PickupType type){
|
||||
switch(type){
|
||||
case PickupItem.PickupType.Moon1:
|
||||
return Color.grey;
|
||||
break;
|
||||
|
||||
case PickupItem.PickupType.Moon2:
|
||||
return Color.green;;
|
||||
break;
|
||||
|
||||
case PickupItem.PickupType.Moon3:
|
||||
return Color.blue;
|
||||
break;
|
||||
|
||||
case PickupItem.PickupType.Moon4:
|
||||
return Color.magenta;
|
||||
break;
|
||||
|
||||
case PickupItem.PickupType.Moon5:
|
||||
return Color.yellow;
|
||||
break;
|
||||
|
||||
case PickupItem.PickupType.Star:
|
||||
return Color.grey;
|
||||
break;
|
||||
}
|
||||
|
||||
return Color.white;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ public static class Selector{
|
|||
public static void resetMoving(){
|
||||
if(movingBuilding!=null ){
|
||||
if(movingPointValid) {
|
||||
DBmanager.RelocateBuilding(movingBuilding.buildingData.buildingName, movingBuilding.transform.position);
|
||||
// DBmanager.RelocateBuilding(movingBuilding.buildingData.buildingName, movingBuilding.transform.position);
|
||||
}else{
|
||||
movingBuilding.transform.position = movingStartedPosition;
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -134,7 +134,7 @@ PlayerSettings:
|
|||
16:10: 1
|
||||
16:9: 1
|
||||
Others: 1
|
||||
bundleVersion: 0.18
|
||||
bundleVersion: 0.20
|
||||
preloadedAssets: []
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
|
|
@ -160,7 +160,7 @@ PlayerSettings:
|
|||
iPhone: 0
|
||||
tvOS: 0
|
||||
overrideDefaultApplicationIdentifier: 1
|
||||
AndroidBundleVersionCode: 18
|
||||
AndroidBundleVersionCode: 20
|
||||
AndroidMinSdkVersion: 22
|
||||
AndroidTargetSdkVersion: 33
|
||||
AndroidPreferredInstallLocation: 1
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
3c53b982c19839a778a4b03991272056ed312f66
|
||||
b6e9d97656d4a726604547f1d4e9c5fd4e8c3e58
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user