Example #1
0
    /**************** Internal Interface ****************/

    void SwitchCharacter(bool right)
    {
        CharacterSettings sets = null;

        if (right)
        {
            do
            {
                ++playerChoice;
                if (playerChoice >= MenuController.GetMenuController().characters.Length)
                {
                    playerChoice = 0;
                }
                sets = MenuController.GetMenuController().characters[playerChoice];
            } while(MenuController.GetMenuController().CharacterIsSelected(sets.GetCharacterType()));
        }
        else
        {
            do
            {
                --playerChoice;
                if (playerChoice < 0)
                {
                    playerChoice = MenuController.GetMenuController().characters.Length - 1;
                }
                sets = MenuController.GetMenuController().characters[playerChoice];
            } while (MenuController.GetMenuController().CharacterIsSelected(sets.GetCharacterType()));
        }
        switched     = true;
        charSettings = sets;
        UpdateSprite();
    }
Example #2
0
    void CharacterUpdate()
    {
        if (input.Action2.WasPressed)
        {
            state        = CharacterSelectState.Waiting;
            charSettings = null;

            waiting.SetActive(true);
            selecting.SetActive(false);
            confirm.SetActive(false);
            ufo.SetActive(false);
            SFXManager.GetSFXManager().PlaySFX(SFX.StopPilot);
        }

        if (input.Action1.WasPressed &&
            !MenuController.GetMenuController().CharacterIsSelected(charSettings.GetCharacterType()))
        {
            MenuController.GetMenuController().SetCharacterSelect(charSettings.GetCharacterType(), true);
            selecting.SetActive(false);

            SpriteRenderer domeSprite = ufo.transform.Find("dome").Find("sprite").GetComponent <SpriteRenderer>();
            domeSprite.sprite = charSettings.GetSprite();
            GameObject smoke = Instantiate(smokeEffect, domeSprite.transform.position, Quaternion.identity);
            smoke.GetComponent <LoopingAnimation>().StartAnimation();
            SFXManager.GetSFXManager().PlaySFX(SFX.StartPilot);
            StartCoroutine("RetractBeam");

            ufoSprend.color = Color.red;
            teamNum         = 2;
            state           = CharacterSelectState.Team;
            team.SetActive(true);
            return;
        }

        if (!switched)
        {
            if (input.LeftStick.Left)
            {
                SwitchCharacter(false);
            }
            else if (input.LeftStick.Right)
            {
                SwitchCharacter(true);
            }
        }
        else if (input.LeftStickX == 0)
        {
            switched = false;
        }
    }