Пример #1
0
    // could just move this into the hammer script, use new tag for outer wall
    private void OnTriggerEnter(Collider other)
    {
        Hammer hammer = other.GetComponent <Hammer>();

        if (hammer != null)
        {
            HammerSpawner.Release(hammer);
        }
    }
Пример #2
0
    private void OnTriggerEnter(Collider other)
    {
        PiggyBank pig = other.GetComponent <PiggyBank>();

        if (pig != null)
        {
            if (pig.tag == "Player")
            {
                Camera.main.GetComponent <AudioSource>().PlayOneShot(audioClip);
            }
            pig.RemoveValue(Mathf.Max(pig.value * damagePercent, minDamage));
            // TODO Add coin spray effect
            if (pig.value < 0)
            {
                PigSpawner.Release(pig);
                // TODO Shatter effect
            }
            HammerSpawner.Release(this);
        }
    }