示例#1
0
        private void OnTriggerStay2D(Collider2D other)
        {
            mg_jr_Collectable component = other.GetComponent <mg_jr_Collectable>();

            if (component == null)
            {
                ObstacleCollision();
            }
        }
示例#2
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            mg_jr_Collectable component = other.GetComponent <mg_jr_Collectable>();

            if (!(component != null))
            {
                return;
            }
            bool flag = false;

            if (component is mg_jr_Coin)
            {
                if (this.CoinCollected != null)
                {
                    this.CoinCollected(component.Quantity);
                }
                flag = true;
            }
            else if (component is mg_jr_RobotPenguin)
            {
                if (this.RobotPenguinCollected != null)
                {
                    this.RobotPenguinCollected(component as mg_jr_RobotPenguin);
                }
                flag = true;
            }
            else if (component is mg_jr_TurboPickup)
            {
                if (this.TurboCollected != null)
                {
                    this.TurboCollected(component.Quantity);
                }
                flag = true;
            }
            if (flag)
            {
                component.OnCollection();
            }
        }