예제 #1
0
 //When enemy is destroyed, the apple returns to stack
 private void OnDestroy()
 {
     if (haveApple)
     {
         appleStack.AddApple();
     }
 }
예제 #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Apple" && collision.gameObject.activeSelf)
        {
            if (stack.IsFull())
            {
                return;
            }

            impulseSource.GenerateImpulseAt(transform.position, Vector3.one * 0.25f);
            cam.BaseEffect(1f);

            var a = collision.gameObject.GetComponent <ColorObject>();
            if (a)
            {
                stack.AddApple(a.colorIndex);
            }
            collision.gameObject.SetActive(false);
        }
    }