예제 #1
0
    // Update is called once per frame
    void Update()
    {
        // Check if has platform
        if (character.HasPlatform())
        {
            if (character.IsWalled() && !character.IsBigWalled())
            {
                // Character jump
                character.Move(moveDirection, false, true);
                Debug.Log("Jump Wall");
            }
            else
            {
                // Change direction
                if (character.IsBigWalled() && !character.CanCrouch())
                {
                    if (moveDirection == right)
                    {
                        moveDirection = left;
                    }
                    else
                    {
                        moveDirection = right;
                    }
                    Debug.Log("Change Direction");
                }

                if (character.IsBigWalled() && character.CanCrouch())
                {
                    // Character walk crouched
                    character.Move(moveDirection, true, false);
                    Debug.Log("Walk crouched");
                }
                else
                {
                    // Character walk
                    character.Move(moveDirection, false, false);
                    Debug.Log("Walking");
                }
            }
        }
        else if (!character.HasPlatformBelow())
        {
            // Character jump
            character.Move(moveDirection, false, true);
            Debug.Log("Jump Spikes/Platforms");
        }
        else
        {
            // Character walk
            character.Move(moveDirection, false, false);
            Debug.Log("Walking");
        }
    }