예제 #1
0
    // Use this for initialization
    void Awake()
    {
        if (m_Instance == null)
        {
            DontDestroyOnLoad(gameObject);
            m_Instance = this;
            m_First    = Player.PLAYER.P1;
            m_Second   = Player.PLAYER.P2;
            m_Third    = Player.PLAYER.P3;
            m_Fourth   = Player.PLAYER.P4;

            m_PickRewardText.text = "Choose reward: " + m_First.ToString();

            LoadRewards();
        }
        else
        {
            Destroy(gameObject);
        }
    }
예제 #2
0
    public void ChooseRewards()
    {
        EventSystem.current.currentSelectedGameObject.GetComponent <Button>().interactable = false;
        GameObject chosenWeapon = EventSystem.current.currentSelectedGameObject.GetComponent <Reward>().m_Reward;
        WEAPONTYPE weaponID     = chosenWeapon.GetComponent <WeaponID>().m_WeaponType;

        switch (m_PickCounter)
        {
        case 0:
            GameManager.m_Instance.m_Player1.weaponID = weaponID;
            Debug.Log("Player 1 weapon set as " + chosenWeapon.name);
            m_PickRewardText.text = "Choose reward: " + m_Second.ToString();
            break;

        case 1:
            GameManager.m_Instance.m_Player2.weaponID = weaponID;
            Debug.Log("Player 2 weapon set as " + chosenWeapon.name);
            m_PickRewardText.text = "Choose reward: " + m_Third.ToString();
            break;

        case 2:
            GameManager.m_Instance.m_Player3.weaponID = weaponID;
            Debug.Log("Player 3 weapon set as " + chosenWeapon.name);
            m_PickRewardText.text = "Choose reward: " + m_Fourth.ToString();
            break;

        case 3:
            Debug.Log("Player 4 weapon set as " + chosenWeapon.name);
            GameManager.m_Instance.m_Player4.weaponID = weaponID;

            PickNewLevel();
            Debug.Log("Rewards Given Out");
            break;
        }
        m_PickCounter++;
    }