示例#1
0
        public bool CharHitsPlatform(Character character, Platform platform)
        {
            DirCardinal dir = CollideDetect.GetDirectionOfCollision(character, platform);

            if (dir != DirCardinal.Down)
            {
                return(false);
            }

            // Character is "Dropping" through platforms:
            if (character.status.action is DropdownAction)
            {
                character.physics.touch.TouchMover(null);
                return(false);
            }

            // Activate the Platform
            platform.ActivatePlatform();
            character.physics.touch.TouchMover(platform);

            // Assign the Character with the "OnMover" action, which will maintain their momentum after leaving the platform.
            ActionMap.OnMover.StartAction(character);

            // Special Character Collision for Platforms.
            // Only the Character should run collision. Platform has no need to be touched, pushed, aligned, etc.
            // Additionally, it needs to skip the intend.Y test normally associated with CollideObjDown(platform).
            character.physics.touch.TouchDown();
            character.physics.AlignUp(platform);
            character.physics.StopY();

            return(true);
        }