예제 #1
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;
        }
    }
예제 #2
0
파일: Player.cs 프로젝트: prim4t/rocketeers
    /******************** Utility ********************/

    void InitPlayerSettings()
    {
        foreach (InputDevice id in InputManager.Devices)
        {
            if (id.Meta == input.Meta)
            {
                input = id;
                print("What's going on");
            }
        }

        // Init Player Settings
        sprend.sprite = charSettings.GetSprite();
        animator.runtimeAnimatorController = charSettings.GetAnimator();
        projectilePrefab = charSettings.GetProjectile();
        ufo_manager.GetComponent <UFOManager>().UFOLakitu = charSettings.GetUFOManager();
        offscreen_arrow_manager.arrowPrefab         = charSettings.GetOffscreenIndicator();
        GetComponent <LocationArrow> ().arrowPrefab = charSettings.GetLocationArrow();

        // Init Team Settings
        teamNum          = teamSettings.teamNum;
        placementMask    = teamSettings.GetPlacementMask();
        platformsMask    = teamSettings.GetPlatformsMask();
        gameObject.layer = LayerMask.NameToLayer("Team" + teamNum + "Player");
        jetpackObj.transform.Find("Sprite").GetComponent <SpriteRenderer>().sprite = teamSettings.GetJetpack();
        aimSprend.sprite = teamSettings.GetWeapon();
        if (teamNum == 1)
        {
            point_manager.ui_pts_left = GameObject.Find("Team1Points").GetComponent <UnityEngine.UI.Text> ();
        }
        else
        {
            point_manager.ui_pts_left = GameObject.Find("Team2Points").GetComponent <UnityEngine.UI.Text> ();
        }
    }