Esempio n. 1
0
    IEnumerator SI()
    {
        yield return(new WaitForEndOfFrame());

        gameObject.SetActive(false);
        playerManager.Activate(this);
    }
Esempio n. 2
0
    //-------------------------------------------------------------------------

    // Update is called once per frame
    void Update()
    {
        if (m_LightManager.GetCurrentHealth() <= 0 || m_ShadeManager.GetCurrentHealth() <= 0 || m_TwiliManager.GetCurrentHealth() <= 0 || Input.GetKeyDown(KeyCode.Escape))
        {
            Application.LoadLevel("puzzleRoom");
        }

        if (m_IsGameOver)
        {
            // Display You Win Message
            m_YouWin.gameObject.SetActive(true);
            m_YouWin_2.gameObject.SetActive(true);
            m_Camera.transform.GetChild(0).gameObject.SetActive(true);
            return;
        }

        // TODO: Add abilities usage

        // Do Input Polling
        if (e_PlayerState == playerState.SPLIT)
        {
            // Movement
            m_LightPlayer.Move(Input.GetAxis("P1_Horizontal"), Input.GetAxis("P1_Vertical"));
            m_ShadowPlayer.Move(Input.GetAxis("P2_Horizontal"), Input.GetAxis("P2_Vertical"));

            // Weapon Pick up
            if (Input.GetButtonDown("P1_Pickup"))
            {
                m_LightPlayer.PickUpWeapon();
            }

            if (Input.GetButtonDown("P2_Pickup"))
            {
                m_ShadowPlayer.PickUpWeapon();
            }

            // Activation of Objects
            if (Input.GetButtonDown("P1_Activate"))
            {
                m_LightPlayer.Activate();
            }

            if (Input.GetButtonDown("P2_Activate"))
            {
                m_ShadowPlayer.Activate();
            }

            // Weapon Usage
            if (Input.GetButtonDown("P1_UseWeapon"))
            {
                m_LightPlayer.UseWeapon();
            }

            if (Input.GetButtonDown("P2_UseWeapon"))
            {
                m_ShadowPlayer.UseWeapon();
            }
        }
        else if (e_PlayerState == playerState.FUSED)
        {
            // Movement
            m_TwilightPlayer.Move(Input.GetAxis("P1_Horizontal"), Input.GetAxis("P1_Vertical"));

            // Pickup Weapon
            if (Input.GetButtonDown("P1_Pickup"))
            {
                m_TwilightPlayer.PickUpWeapon();
            }

            // Activation of Objects
            if (Input.GetButtonDown("P1_Activate"))
            {
                m_LightPlayer.UseWeapon();
            }

            // Weapon Usage
            if (Input.GetButtonDown("P1_UseWeapon"))
            {
                m_TwilightPlayer.UseWeapon();
            }
        }
    }