Пример #1
0
    public Entity UseCharacter(string c)
    {
        lastCharacter = character;

        if (c == "Dolphin")
        {
            character = dolphin;
        }
        else if (c == "Mekka")
        {
            character = mekka;
        }

        if (lastCharacter != character)
        {
            // Update character state
            character.Position(lastCharacter.Position());
            character.Velocity(lastCharacter.Velocity());
            character.Rotation(lastCharacter.Rotation());

            // Hide and disable old character
            lastCharacter.gameObject.SetActive(false);
            lastCharacter.spiritMeter.HideMeter();

            // Show and enable new character
            character.gameObject.SetActive(true);

            // Enable gravity
            if (character is Mekka)
                character.Fall();
        }

        return character;
    }