Exemplo n.º 1
0
        private void CheckItemCollision(Collider2D p_other)
        {
            mg_ss_ItemObject component = p_other.GetComponent <mg_ss_ItemObject>();

            if (component != null && component.Collidable)
            {
                if (component.ToeStub)
                {
                    Jump();
                    m_playerObject.PlayToeStub();
                }
                else if (State == mg_ss_EPlayerState.FALLING && (component.IsItemOnConveyor() || (!component.ChaosItem && !component.PowerUp)))
                {
                    SetCollision(mg_ss_EPlayerState.COLLISION);
                }
                if (component.IsItemOnConveyor())
                {
                    m_swipeTimer = 0f;
                }
                component.OnCollided(Action);
                switch (component.ItemType)
                {
                case mg_ss_EItemTypes.PINEAPPLE:
                    component.transform.position -= new Vector3(0f, 0.5f, 0f);
                    break;

                case mg_ss_EItemTypes.BLUEBERRY:
                    component.transform.position -= new Vector3(0f, 1f, 0f);
                    break;

                default:
                    component.transform.position -= new Vector3(0f, 0.25f, 0f);
                    break;
                }
                ConveyorCollidedWith = false;
            }
        }