SHADE_Y3/Assets/Scripts/Gameplay/SC_ScoringZone.cs

37 lines
1.1 KiB
C#
Raw Permalink Normal View History

using SHADE;
2023-02-03 19:37:18 +08:00
using SHADE_Scripting.Audio;
using System;
public class ScoringZone : Script
{
2023-03-24 20:30:01 +08:00
private ParticleEmitter particle;
public int startingParticleCount = 10;
protected override void awake()
2023-03-24 20:30:01 +08:00
{
particle = GetComponentInChildren<ParticleEmitter>();
if (!particle)
Debug.LogError("PARTICLE MISSING");
}
protected override void update()
{
}
protected override void onTriggerEnter(CollisionInfo info)
{
if (GameManager.Instance && info.GameObject.GetScript<Item>() && info.GameObject.IsActiveSelf && !info.GameObject.GetComponent<Collider>().GetCollisionShape(0).IsTrigger )
{
2023-04-01 19:14:30 +08:00
if (GameManager.Instance.currMultiplierCombo > 1)
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo;
else
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score;
GameManager.Instance.ItemScored();
2023-03-24 20:30:01 +08:00
particle.EmissionCount = startingParticleCount * GameManager.Instance.currMultiplierCombo;
particle.Emit();
info.GameObject.SetActive(false);
}
}
}