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
|
ErrorInputCount: 0
|
||||||
ErrorStateCount: 0
|
ErrorStateCount: 0
|
||||||
RubberBandsCount: 0
|
RubberBandsCount: 0
|
||||||
|
DeathEffect: {fileID: 7331350358683325927, guid: 8c201be402a7d4944836d4e104499bb0, type: 3}
|
||||||
|
PickupEffect: {fileID: 3848734746219421256, guid: f8c0430f28bc6a743a366002b2fea52f, type: 3}
|
||||||
distanceFromCenter: 0
|
distanceFromCenter: 0
|
||||||
--- !u!114 &5995183602835295541
|
--- !u!114 &5995183602835295541
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
|
|
|
||||||
|
|
@ -9653,7 +9653,6 @@ GameObject:
|
||||||
- component: {fileID: 7455977575346049103}
|
- component: {fileID: 7455977575346049103}
|
||||||
- component: {fileID: 7250449672139357247}
|
- component: {fileID: 7250449672139357247}
|
||||||
- component: {fileID: 7218394794167734203}
|
- component: {fileID: 7218394794167734203}
|
||||||
- component: {fileID: 8958074554064743335}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: PlayerDieEffect
|
m_Name: PlayerDieEffect
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
|
@ -14575,18 +14574,6 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
randomPercent: 8
|
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
|
--- !u!1 &7331386412199724289
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ SpriteRenderer:
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 1
|
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_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 0
|
||||||
m_FlipY: 0
|
m_FlipY: 0
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ SpriteRenderer:
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 1
|
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_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 0
|
||||||
m_FlipY: 0
|
m_FlipY: 0
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ SpriteRenderer:
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 1
|
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_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 0
|
||||||
m_FlipY: 0
|
m_FlipY: 0
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ SpriteRenderer:
|
||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 1
|
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_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_FlipX: 0
|
m_FlipX: 0
|
||||||
m_FlipY: 0
|
m_FlipY: 0
|
||||||
|
|
|
||||||
|
|
@ -1429,8 +1429,8 @@ BoxCollider:
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Size: {x: 44.13504, y: 21.177668, z: 42.312885}
|
m_Size: {x: 44.13504, y: 14.73, z: 34}
|
||||||
m_Center: {x: 0, y: 0, z: 0}
|
m_Center: {x: 0.2, y: -2.39, z: -0.93}
|
||||||
--- !u!114 &7038491
|
--- !u!114 &7038491
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -1448,6 +1448,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!1 &7496276
|
--- !u!1 &7496276
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -120718,6 +120719,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!1001 &410054828
|
--- !u!1001 &410054828
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -226066,6 +226068,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!1001 &734058384
|
--- !u!1001 &734058384
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -268396,6 +268399,11 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 53edd1304ce7ec14fa61e457a4745d7a, type: 3}
|
m_Script: {fileID: 11500000, guid: 53edd1304ce7ec14fa61e457a4745d7a, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
Camera: {fileID: 0}
|
||||||
|
Rotate: 0
|
||||||
|
DecreaseCameraPanSpeed: 1
|
||||||
|
CameraUpperHeightBound: 0
|
||||||
|
CameraLowerHeightBound: 0
|
||||||
--- !u!4 &828023762
|
--- !u!4 &828023762
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -285965,6 +285973,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!4 &888537841 stripped
|
--- !u!4 &888537841 stripped
|
||||||
Transform:
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 4241811459315326, guid: b0c5c3f9b8286e14f95e62362776397f, type: 3}
|
m_CorrespondingSourceObject: {fileID: 4241811459315326, guid: b0c5c3f9b8286e14f95e62362776397f, type: 3}
|
||||||
|
|
@ -342958,6 +342967,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!114 &1134774561
|
--- !u!114 &1134774561
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -389830,6 +389840,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!65 &1246197563
|
--- !u!65 &1246197563
|
||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -449971,6 +449982,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!65 &1463485149
|
--- !u!65 &1463485149
|
||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -477897,6 +477909,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!65 &1550431836
|
--- !u!65 &1550431836
|
||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -484553,6 +484566,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!65 &1583058846
|
--- !u!65 &1583058846
|
||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -529612,6 +529626,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!1 &1698128106
|
--- !u!1 &1698128106
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -556268,6 +556283,7 @@ MonoBehaviour:
|
||||||
outlines:
|
outlines:
|
||||||
- {fileID: 943428140}
|
- {fileID: 943428140}
|
||||||
autoGetOutlines: 0
|
autoGetOutlines: 0
|
||||||
|
_lastCollected:
|
||||||
--- !u!65 &1783245364
|
--- !u!65 &1783245364
|
||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -556280,7 +556296,7 @@ BoxCollider:
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Size: {x: 33.814045, y: 25.173874, z: 36.91852}
|
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
|
--- !u!4 &1784015607 stripped
|
||||||
Transform:
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 4207568928025374, guid: 9dd3fb8ac8fed334fa8c89fad4607d76, type: 3}
|
m_CorrespondingSourceObject: {fileID: 4207568928025374, guid: 9dd3fb8ac8fed334fa8c89fad4607d76, type: 3}
|
||||||
|
|
@ -598412,6 +598428,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!4 &1904112555 stripped
|
--- !u!4 &1904112555 stripped
|
||||||
Transform:
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 4175980960680466, guid: befcb46639eb71546951890e87983293, type: 3}
|
m_CorrespondingSourceObject: {fileID: 4175980960680466, guid: befcb46639eb71546951890e87983293, type: 3}
|
||||||
|
|
@ -615286,6 +615303,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!65 &1970335797
|
--- !u!65 &1970335797
|
||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -634456,6 +634474,7 @@ MonoBehaviour:
|
||||||
additionalLevels:
|
additionalLevels:
|
||||||
outlines: []
|
outlines: []
|
||||||
autoGetOutlines: 1
|
autoGetOutlines: 1
|
||||||
|
_lastCollected:
|
||||||
--- !u!65 &2016105858
|
--- !u!65 &2016105858
|
||||||
BoxCollider:
|
BoxCollider:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -6099,8 +6099,6 @@ MonoBehaviour:
|
||||||
Pooled: []
|
Pooled: []
|
||||||
starPrefab: {fileID: 8298505072154104440, guid: 8cfd89c315493e64782e167885b4b498, type: 3}
|
starPrefab: {fileID: 8298505072154104440, guid: 8cfd89c315493e64782e167885b4b498, type: 3}
|
||||||
pickupItemsParent: {fileID: 41572335}
|
pickupItemsParent: {fileID: 41572335}
|
||||||
DeathEffectPrefab: {fileID: 7331350358683325927, guid: 8c201be402a7d4944836d4e104499bb0, type: 3}
|
|
||||||
EffectsParent: {fileID: 395348370}
|
|
||||||
loadingScreen: {fileID: 908570975}
|
loadingScreen: {fileID: 908570975}
|
||||||
metalTxt: {fileID: 1251195779}
|
metalTxt: {fileID: 1251195779}
|
||||||
--- !u!114 &332697611
|
--- !u!114 &332697611
|
||||||
|
|
@ -6129,6 +6127,7 @@ GameObject:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 395348370}
|
- component: {fileID: 395348370}
|
||||||
|
- component: {fileID: 395348371}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Effects
|
m_Name: Effects
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
|
@ -6150,6 +6149,19 @@ Transform:
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 12
|
m_RootOrder: 12
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
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
|
--- !u!1 &422557611
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
||||||
|
|
@ -10827,8 +10827,6 @@ MonoBehaviour:
|
||||||
Pooled: []
|
Pooled: []
|
||||||
starPrefab: {fileID: 8298505072154104440, guid: 8cfd89c315493e64782e167885b4b498, type: 3}
|
starPrefab: {fileID: 8298505072154104440, guid: 8cfd89c315493e64782e167885b4b498, type: 3}
|
||||||
pickupItemsParent: {fileID: 41572335}
|
pickupItemsParent: {fileID: 41572335}
|
||||||
DeathEffectPrefab: {fileID: 7331350358683325927, guid: 8c201be402a7d4944836d4e104499bb0, type: 3}
|
|
||||||
EffectsParent: {fileID: 646352076}
|
|
||||||
loadingScreen: {fileID: 908570975}
|
loadingScreen: {fileID: 908570975}
|
||||||
metalTxt: {fileID: 1251195779}
|
metalTxt: {fileID: 1251195779}
|
||||||
--- !u!114 &332697611
|
--- !u!114 &332697611
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,12 @@ public class Building : MonoBehaviour
|
||||||
public int[] additionalLevels;
|
public int[] additionalLevels;
|
||||||
public Outline[] outlines;
|
public Outline[] outlines;
|
||||||
public bool autoGetOutlines = true;
|
public bool autoGetOutlines = true;
|
||||||
|
private DateTime m_lastCollected;
|
||||||
public DateTime lastCollected;
|
public DateTime lastCollected{ get{return m_lastCollected;}set{
|
||||||
|
_lastCollected = value.ToString();
|
||||||
|
m_lastCollected = value;
|
||||||
|
}}
|
||||||
|
[SerializeField]private string _lastCollected;
|
||||||
|
|
||||||
ParticleSystem[] levelUps;
|
ParticleSystem[] levelUps;
|
||||||
|
|
||||||
|
|
@ -143,4 +147,9 @@ public class BuildingState{
|
||||||
position = m_position;
|
position = m_position;
|
||||||
lastCollectedTimestamp= _lastCollectedTimestamp;
|
lastCollectedTimestamp= _lastCollectedTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return JsonUtility.ToJson(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using EasyButtons;
|
using EasyButtons;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
@ -27,32 +28,18 @@ public class BuildingManager : MonoBehaviour
|
||||||
if(!building.gameObject.activeSelf){
|
if(!building.gameObject.activeSelf){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool buildingExists = false;
|
|
||||||
foreach (BuildingState buildingState in DBmanager.buildingStates){
|
|
||||||
if(buildingState.id == building.buildingData.buildingName){
|
|
||||||
buildingExists =true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!buildingExists){
|
if(DBmanager.buildingStates.ContainsKey(building.buildingData.buildingName)){
|
||||||
building.lastCollected = DateTime.Now.Subtract(TimeSpan.FromDays(1));
|
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);
|
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){
|
public void OnClickBuyBuilding(BuildingData buildingData){
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ public class CollectBtn : MonoBehaviour
|
||||||
|
|
||||||
public async void OnClick(){
|
public async void OnClick(){
|
||||||
// lastCollected = await DBmanager.GetNetworkTime();
|
// lastCollected = await DBmanager.GetNetworkTime();
|
||||||
|
DBmanager.CollectBuilding(buildingId);
|
||||||
|
|
||||||
switch (resourceType){
|
switch (resourceType){
|
||||||
case CollectablesData.ResourceType.Metal:
|
case CollectablesData.ResourceType.Metal:
|
||||||
collectableAmount= GetCollectableEnergy();
|
collectableAmount= GetCollectableEnergy();
|
||||||
|
|
@ -57,7 +59,6 @@ public class CollectBtn : MonoBehaviour
|
||||||
// DBmanager.SetOxygen(DBmanager.Trophies + (int)collectableAmount);
|
// DBmanager.SetOxygen(DBmanager.Trophies + (int)collectableAmount);
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
DBmanager.CollectBuilding(buildingId);
|
|
||||||
Selector.selectBuilding(null);
|
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;
|
networkCheckTimer += Time.deltaTime;
|
||||||
if (networkCheckTimer > NetworkCheckInterval)
|
if (networkCheckTimer > NetworkCheckInterval)
|
||||||
{
|
{
|
||||||
Debug.Log(Application.internetReachability);
|
// Debug.Log(Application.internetReachability);
|
||||||
if (Application.internetReachability == NetworkReachability.NotReachable)
|
if (Application.internetReachability == NetworkReachability.NotReachable)
|
||||||
{
|
{
|
||||||
networkErrorPopup.SetActive(true);
|
networkErrorPopup.SetActive(true);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
public class MaintainceChecker : MonoBehaviour
|
public class MaintainceChecker : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static int version = 16;
|
public static int version = 20;
|
||||||
public static MaintainceChecker instance;
|
public static MaintainceChecker instance;
|
||||||
public int checkInterval = 30;
|
public int checkInterval = 30;
|
||||||
float t;
|
float t;
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ public class MinigameManager : NetworkBehaviour
|
||||||
// public int maxTweps = 2;
|
// public int maxTweps = 2;
|
||||||
public Transform pickupItemsParent;
|
public Transform pickupItemsParent;
|
||||||
|
|
||||||
private List<DeathEffect> PooledDeathEffects = new List<DeathEffect>();
|
// private List<DeathEffect> PooledDeathEffects = new List<DeathEffect>();
|
||||||
[SerializeField]private GameObject DeathEffectPrefab;
|
// [SerializeField]private GameObject DeathEffectPrefab;
|
||||||
[SerializeField]private Transform EffectsParent;
|
// [SerializeField]private Transform EffectsParent;
|
||||||
// private List<PickupItem> ActiveMoons = new List<PickupItem>();
|
// private List<PickupItem> ActiveMoons = new List<PickupItem>();
|
||||||
// private List<PickupItem> ActiveStars = new List<PickupItem>();
|
// private List<PickupItem> ActiveStars = new List<PickupItem>();
|
||||||
// private List<PickupItem> ActiveTweps = new List<PickupItem>();
|
// private List<PickupItem> ActiveTweps = new List<PickupItem>();
|
||||||
|
|
@ -245,27 +245,27 @@ public class MinigameManager : NetworkBehaviour
|
||||||
pickup.Pooled.Add(item);
|
pickup.Pooled.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void ShowDeathEffect(Vector2 position){
|
// public void ShowDeathEffect(Vector2 position){
|
||||||
if(isServer){return;}
|
// if(isServer){return;}
|
||||||
if(PooledDeathEffects.Count > 0){
|
// if(PooledDeathEffects.Count > 0){
|
||||||
//Can use from pool [0]
|
// //Can use from pool [0]
|
||||||
DeathEffect pickedItem = PooledDeathEffects[0];
|
// DeathEffect pickedItem = PooledDeathEffects[0];
|
||||||
pickedItem.Play();
|
// pickedItem.Play();
|
||||||
StartCoroutine(PoolDeathEffect(pickedItem));
|
// StartCoroutine(PoolDeathEffect(pickedItem));
|
||||||
PooledDeathEffects.Remove(pickedItem);
|
// PooledDeathEffects.Remove(pickedItem);
|
||||||
}else{
|
// }else{
|
||||||
DeathEffect newEffect = Instantiate(DeathEffectPrefab, EffectsParent).GetComponent<DeathEffect>();
|
// DeathEffect newEffect = Instantiate(DeathEffectPrefab, EffectsParent).GetComponent<DeathEffect>();
|
||||||
newEffect.transform.position = position;
|
// newEffect.transform.position = position;
|
||||||
newEffect.Play();
|
// newEffect.Play();
|
||||||
StartCoroutine(PoolDeathEffect(newEffect));
|
// StartCoroutine(PoolDeathEffect(newEffect));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
IEnumerator PoolDeathEffect(DeathEffect effect){
|
// IEnumerator PoolDeathEffect(DeathEffect effect){
|
||||||
yield return new WaitForSeconds(1.5f);
|
// yield return new WaitForSeconds(1.5f);
|
||||||
|
|
||||||
PooledDeathEffects.Add(effect);
|
// PooledDeathEffects.Add(effect);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void SetRespawn(GameObject player)
|
public void SetRespawn(GameObject player)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ public class RocketUpgradePanel : MonoBehaviour
|
||||||
curEnergyLevel = data.energyLevel;
|
curEnergyLevel = data.energyLevel;
|
||||||
curBoostLevel = data.boostLevel;
|
curBoostLevel = data.boostLevel;
|
||||||
txtRocketLevel.text = "Level " + curRocketLevel;
|
txtRocketLevel.text = "Level " + curRocketLevel;
|
||||||
txtEnergyGain.text = $"{ curEnergy } Per moon";
|
txtEnergyGain.text = $"{ curEnergy } per Crystal";
|
||||||
txtSpeed.text = $"{curSpeed*100}%";
|
txtSpeed.text = $"{curSpeed*100}%";
|
||||||
txtBoostConsumption.text = $"{ curBoost *100}%";
|
txtBoostConsumption.text = $"{ curBoost *100}%";
|
||||||
int maxLevels =SkinShopManager.GetStatsForRarity(rarity).Length;
|
int maxLevels =SkinShopManager.GetStatsForRarity(rarity).Length;
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,8 @@ public class SpaceshipController : NetworkBehaviour
|
||||||
[SerializeField]private int ErrorInputCount;
|
[SerializeField]private int ErrorInputCount;
|
||||||
[SerializeField]private int ErrorStateCount;
|
[SerializeField]private int ErrorStateCount;
|
||||||
[SerializeField]private int RubberBandsCount;
|
[SerializeField]private int RubberBandsCount;
|
||||||
|
public GameObject DeathEffect;
|
||||||
|
public GameObject PickupEffect;
|
||||||
|
|
||||||
public float distanceFromCenter = 0;
|
public float distanceFromCenter = 0;
|
||||||
RocketLevel rocketStats;
|
RocketLevel rocketStats;
|
||||||
|
|
@ -546,7 +548,8 @@ public class SpaceshipController : NetworkBehaviour
|
||||||
}
|
}
|
||||||
public void ShowDeathEffect(Vector2 position){
|
public void ShowDeathEffect(Vector2 position){
|
||||||
if(isServer){
|
if(isServer){
|
||||||
MinigameManager.instance.ShowDeathEffect(position);
|
// MinigameManager.instance.ShowDeathEffect(position);
|
||||||
|
EffectPool.Spawn(DeathEffect, position);
|
||||||
RpcShowDeathEffect(position);
|
RpcShowDeathEffect(position);
|
||||||
}else{
|
}else{
|
||||||
CmdShowDeathEffect(position);
|
CmdShowDeathEffect(position);
|
||||||
|
|
@ -555,14 +558,16 @@ public class SpaceshipController : NetworkBehaviour
|
||||||
|
|
||||||
[Command]
|
[Command]
|
||||||
void CmdShowDeathEffect(Vector2 position){
|
void CmdShowDeathEffect(Vector2 position){
|
||||||
MinigameManager.instance.ShowDeathEffect(position);
|
EffectPool.Spawn(DeathEffect, position);
|
||||||
|
|
||||||
|
|
||||||
RpcShowDeathEffect(position);
|
RpcShowDeathEffect(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ClientRpc]
|
[ClientRpc]
|
||||||
void RpcShowDeathEffect(Vector2 position){
|
void RpcShowDeathEffect(Vector2 position){
|
||||||
MinigameManager.instance.ShowDeathEffect(position);
|
EffectPool.Spawn(DeathEffect, position);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnKill()
|
void OnKill()
|
||||||
|
|
@ -631,6 +636,7 @@ public class SpaceshipController : NetworkBehaviour
|
||||||
[ClientRpc]
|
[ClientRpc]
|
||||||
void RpcCollectPickup(PickupItem.PickupType type)
|
void RpcCollectPickup(PickupItem.PickupType type)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isLocalPlayer)
|
if (isLocalPlayer)
|
||||||
{
|
{
|
||||||
if (type == PickupItem.PickupType.Twep)
|
if (type == PickupItem.PickupType.Twep)
|
||||||
|
|
@ -646,6 +652,8 @@ public class SpaceshipController : NetworkBehaviour
|
||||||
|
|
||||||
AudioManager.instnace.CollectPickup();
|
AudioManager.instnace.CollectPickup();
|
||||||
}
|
}
|
||||||
|
ParticleSystem particle = EffectPool.Spawn(PickupEffect, transform.position).GetComponent<ParticleSystem>();
|
||||||
|
particle.startColor = type.GetColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Die(string killer)
|
public void Die(string killer)
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,7 @@ public class ShopBuildingButton : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh(){
|
public void refresh(){
|
||||||
bool exists = false;
|
bool exists = DBmanager.buildingStates.ContainsKey(buildingData.buildingName);
|
||||||
foreach (BuildingState buildingState in DBmanager.buildingStates){
|
|
||||||
if(buildingState.id == buildingData.buildingName){
|
|
||||||
exists=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gameObject.SetActive(!exists);
|
gameObject.SetActive(!exists);
|
||||||
btn.interactable = (DBmanager.Coins > buildingData.levels[0].price);
|
btn.interactable = (DBmanager.Coins > buildingData.levels[0].price);
|
||||||
txt.text = buildingData.levels[0].price.ToString();
|
txt.text = buildingData.levels[0].price.ToString();
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ public class DBmanager : MonoBehaviour
|
||||||
{
|
{
|
||||||
static RankLevel[] rankLevels;
|
static RankLevel[] rankLevels;
|
||||||
static RankLevel[] RankLevels {get{if(rankLevels==null){return Resources.Load<RankLevels>("ScriptableObjects/RankLevels").levels;}else{return 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 string username = null;
|
||||||
public static int userid=0;
|
public static int userid=0;
|
||||||
|
|
@ -32,7 +32,7 @@ public class DBmanager : MonoBehaviour
|
||||||
private static List<int> expPassCollected = new List<int>();
|
private static List<int> expPassCollected = new List<int>();
|
||||||
private static List<PurchasedSkin> skinsPurchased = new List<PurchasedSkin>(){defaultSkin};
|
private static List<PurchasedSkin> skinsPurchased = new List<PurchasedSkin>(){defaultSkin};
|
||||||
static PurchasedSkin defaultSkin => new PurchasedSkin(){name="Default"};
|
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 UnityEvent OnStateChanged = new UnityEvent();
|
||||||
|
|
||||||
public static int Xp => xp;
|
public static int Xp => xp;
|
||||||
|
|
@ -114,6 +114,7 @@ public class DBmanager : MonoBehaviour
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
Debug.LogError("Couldn't parse data into json");
|
Debug.LogError("Couldn't parse data into json");
|
||||||
Debug.LogError(e.Message);
|
Debug.LogError(e.Message);
|
||||||
|
Debug.LogWarning(jsonData);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -155,7 +156,9 @@ public class DBmanager : MonoBehaviour
|
||||||
|
|
||||||
return rank;
|
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()
|
public static async Task<DateTime> GetNetworkTime()
|
||||||
{
|
{
|
||||||
int unixTime = 0;
|
int unixTime = 0;
|
||||||
|
|
@ -178,6 +181,7 @@ public class DBmanager : MonoBehaviour
|
||||||
|
|
||||||
if (unixTime > 0)
|
if (unixTime > 0)
|
||||||
{
|
{
|
||||||
|
timeDifference = unixTime - unixTimestamp;
|
||||||
return DateTimeOffset.FromUnixTimeSeconds(unixTime).UtcDateTime;
|
return DateTimeOffset.FromUnixTimeSeconds(unixTime).UtcDateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -304,6 +308,7 @@ public class DBmanager : MonoBehaviour
|
||||||
WWWForm form = new WWWForm();
|
WWWForm form = new WWWForm();
|
||||||
form.AddField("name", username);
|
form.AddField("name", username);
|
||||||
form.AddField("coins", newValue);
|
form.AddField("coins", newValue);
|
||||||
|
int oldValue = coins;
|
||||||
coins = Mathf.Clamp(newValue,0,int.MaxValue);
|
coins = Mathf.Clamp(newValue,0,int.MaxValue);
|
||||||
if (justOffline) { return; }
|
if (justOffline) { return; }
|
||||||
using (UnityWebRequest www = UnityWebRequest.Post(phpRoot + "set_coins.php", form))
|
using (UnityWebRequest www = UnityWebRequest.Post(phpRoot + "set_coins.php", form))
|
||||||
|
|
@ -320,6 +325,7 @@ public class DBmanager : MonoBehaviour
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
coins = oldValue;
|
||||||
Debug.Log("Response : " + www.downloadHandler.text);
|
Debug.Log("Response : " + www.downloadHandler.text);
|
||||||
Debug.LogWarning("Failed to set coins to " + newValue);
|
Debug.LogWarning("Failed to set coins to " + newValue);
|
||||||
}
|
}
|
||||||
|
|
@ -859,13 +865,25 @@ public class DBmanager : MonoBehaviour
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
//try{
|
//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());
|
Debug.Log("Updating buildings data, isNull: " + (buildingStates == null).ToString());
|
||||||
if (buildingStates == null)
|
if (buildingStates == null)
|
||||||
{
|
{
|
||||||
buildingStates = new List<BuildingState>();
|
buildingStates = new Dictionary<string, BuildingState>();
|
||||||
}
|
}
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
// }catch(Exception e){
|
// }catch(Exception e){
|
||||||
// Debug.LogError(e.Message+'\n' + e.StackTrace);
|
// Debug.LogError(e.Message+'\n' + e.StackTrace);
|
||||||
|
|
@ -882,17 +900,13 @@ public class DBmanager : MonoBehaviour
|
||||||
|
|
||||||
public async static Task AddBuilding(BuildingData buildingData)
|
public async static Task AddBuilding(BuildingData buildingData)
|
||||||
{
|
{
|
||||||
|
if(buildingStates.ContainsKey(buildingData.buildingName)){
|
||||||
foreach (BuildingState buildingState in buildingStates)
|
Debug.Log("Building " + buildingData.buildingName + " Already exists");
|
||||||
{
|
|
||||||
if (buildingState.id == buildingData.buildingName)
|
|
||||||
{
|
|
||||||
Debug.LogError("Building already exists. Cannot add " + buildingState.id);
|
|
||||||
return;
|
return;
|
||||||
}
|
};
|
||||||
}
|
|
||||||
Debug.Log("adding new building " + buildingData.buildingName);
|
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);
|
Debug.Log("Added new building " + buildingData.buildingName);
|
||||||
await UpdateBuildingsToServer();
|
await UpdateBuildingsToServer();
|
||||||
OnStateChanged.Invoke();
|
OnStateChanged.Invoke();
|
||||||
|
|
@ -901,16 +915,8 @@ public class DBmanager : MonoBehaviour
|
||||||
|
|
||||||
public async static Task UpgradeBuilding(string id, int newLevel)
|
public async static Task UpgradeBuilding(string id, int newLevel)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buildingStates.Count; i++)
|
buildingStates[id].level = newLevel;
|
||||||
{
|
|
||||||
if (buildingStates[i].id == id)
|
|
||||||
{
|
|
||||||
buildingStates[i].level = newLevel;
|
|
||||||
Debug.Log("Upgrading " + id + " to " + newLevel);
|
Debug.Log("Upgrading " + id + " to " + newLevel);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await UpdateBuildingsToServer();
|
await UpdateBuildingsToServer();
|
||||||
|
|
||||||
OnStateChanged.Invoke();
|
OnStateChanged.Invoke();
|
||||||
|
|
@ -918,37 +924,33 @@ public class DBmanager : MonoBehaviour
|
||||||
|
|
||||||
public async static Task CollectBuilding(string id)
|
public async static Task CollectBuilding(string id)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buildingStates.Count; i++)
|
buildingStates[id].lastCollectedTimestamp = DateTimeOffset.FromUnixTimeSeconds(unixTimestampCached).UtcDateTime;;
|
||||||
{
|
buildingStates[id].lastCollectedTimestamp = await GetNetworkTime();
|
||||||
if (buildingStates[i].id == id)
|
|
||||||
{
|
BuildingManager.instance.UpdateBuildings();
|
||||||
buildingStates[i].lastCollectedTimestamp = await GetNetworkTime();
|
|
||||||
Debug.Log("Setting " + id + " last collected to " + buildingStates[i].lastCollectedTimestamp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await UpdateBuildingsToServer();
|
await UpdateBuildingsToServer();
|
||||||
|
|
||||||
OnStateChanged.Invoke();
|
OnStateChanged.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async static Task RelocateBuilding(string id, Vector3 newPosition)
|
// public async static Task RelocateBuilding(string id, Vector3 newPosition)
|
||||||
{
|
// {
|
||||||
for (int i = 0; i < buildingStates.Count; i++)
|
// for (int i = 0; i < buildingStates.Count; i++)
|
||||||
{
|
// {
|
||||||
if (buildingStates[i].id == id)
|
// if (buildingStates[i].id == id)
|
||||||
{
|
// {
|
||||||
buildingStates[i].position = newPosition;
|
// buildingStates[i].position = newPosition;
|
||||||
Debug.Log("Relocating " + id + " to " + newPosition);
|
// Debug.Log("Relocating " + id + " to " + newPosition);
|
||||||
// break;
|
// // break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
Debug.Log("Going to update to server" + JsonConvert.SerializeObject(buildingStates));
|
// Debug.Log("Going to update to server" + JsonConvert.SerializeObject(buildingStates));
|
||||||
await UpdateBuildingsToServer();
|
// await UpdateBuildingsToServer();
|
||||||
|
|
||||||
|
// OnStateChanged.Invoke();
|
||||||
|
// }
|
||||||
|
|
||||||
OnStateChanged.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async static Task UpdateBuildingsToServer()
|
public async static Task UpdateBuildingsToServer()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -139,5 +139,37 @@ namespace CustomExtensions{
|
||||||
|
|
||||||
return 0;
|
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(){
|
public static void resetMoving(){
|
||||||
if(movingBuilding!=null ){
|
if(movingBuilding!=null ){
|
||||||
if(movingPointValid) {
|
if(movingPointValid) {
|
||||||
DBmanager.RelocateBuilding(movingBuilding.buildingData.buildingName, movingBuilding.transform.position);
|
// DBmanager.RelocateBuilding(movingBuilding.buildingData.buildingName, movingBuilding.transform.position);
|
||||||
}else{
|
}else{
|
||||||
movingBuilding.transform.position = movingStartedPosition;
|
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:10: 1
|
||||||
16:9: 1
|
16:9: 1
|
||||||
Others: 1
|
Others: 1
|
||||||
bundleVersion: 0.18
|
bundleVersion: 0.20
|
||||||
preloadedAssets: []
|
preloadedAssets: []
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
wsaTransparentSwapchain: 0
|
wsaTransparentSwapchain: 0
|
||||||
|
|
@ -160,7 +160,7 @@ PlayerSettings:
|
||||||
iPhone: 0
|
iPhone: 0
|
||||||
tvOS: 0
|
tvOS: 0
|
||||||
overrideDefaultApplicationIdentifier: 1
|
overrideDefaultApplicationIdentifier: 1
|
||||||
AndroidBundleVersionCode: 18
|
AndroidBundleVersionCode: 20
|
||||||
AndroidMinSdkVersion: 22
|
AndroidMinSdkVersion: 22
|
||||||
AndroidTargetSdkVersion: 33
|
AndroidTargetSdkVersion: 33
|
||||||
AndroidPreferredInstallLocation: 1
|
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