This commit is contained in:
2022-12-03 18:25:08 +05:30
parent 786cd95f19
commit 9915446d1c
39 changed files with 10038 additions and 138 deletions

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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)