37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using SHADE;
|
|
using SHADE_Scripting.Audio;
|
|
using System;
|
|
public class ScoringZone : Script
|
|
{
|
|
|
|
private ParticleEmitter particle;
|
|
public int startingParticleCount = 10;
|
|
|
|
protected override void awake()
|
|
{
|
|
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 )
|
|
{
|
|
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();
|
|
particle.EmissionCount = startingParticleCount * GameManager.Instance.currMultiplierCombo;
|
|
particle.Emit();
|
|
info.GameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
} |