コード例 #1
0
        public bool CollisionSpecialBlock(GameObject pObject)
        {
            if (pObject.CanKill && (pObject.GetType() == typeof(HBlock) || pObject.GetType() == typeof(HSpike)))
            {
                isDeath = true;
                return true;
            }

            if (pObject.GetType() == typeof(HEnemy))
            {
                if (Typ == HEnum.GeometryTyp.Viereck)
                {
                    HEnemy e = (HEnemy)pObject;
                    e.IsDead = true;
                }
                else
                    isDeath = true;
                return true;
            }

            if (pObject.GetType() == typeof(HBlock))
            {
                HBlock b = (HBlock)pObject;
                if (b.IsDestructible && !b.IsSwitchable)
                {
                    b.ActiveDestruct = true;
                }
            }

            if (pObject.GetType() == typeof(HUpgrade))
            {
                HUpgrade u = (HUpgrade)pObject;
                _actUpgradeStage = u.UpgradeId;
                SwitchForm(_actUpgradeStage);
                u.Collected = true;
                HKeyboard.GamePadVibration(0.5f, 0.5f, 500);
                return true;
            }

            if (pObject.GetType() == typeof(HCollectable))
            {
                HCollectable c = (HCollectable)pObject;
                c.Collected = true;
                HKeyboard.GamePadVibration(0.5f, 0.5f, 500);
                return true;
            }

            if (pObject.GetType() == typeof(HSwitch))
            {
                HSwitch s = (HSwitch)pObject;
                s.StartAction = true;
                return true;
            }

            if (pObject.GetType() == typeof(HJump))
            {
                HJump j = (HJump)pObject;
                if (j.Degrees == 0)
                {
                    jumpPlatform = true;
                    JumpTimeY = 0;
                }
                else if (j.Degrees == 90)
                {
                    jumpPlatformRight = true;
                    jumpPlatformLeft = false;
                    JumpTimeX = 0;
                }
                else if (j.Degrees == 270)
                {
                    jumpPlatformLeft = true;
                    jumpPlatformRight = false;
                    JumpTimeX = 0;
                }

                return true;
            }

            return false;
        }