Exemplo n.º 1
0
    public void playerStateUpdate(int attackPlayerNum)
    {
        //if (!pv.isMine)
        //{
        //    return;
        //}
        //else
        //{
        sbm.HpBarSlider.value = (currHp * 0.01f);
        if (currHp <= 0 && playerStateNum != Constants.DEAD)
        {
            playerStateNum = Constants.DEAD;

            //모든 루틴 멈춰야할지?
            StopAllCoroutines();
            CancelInvoke();
            pv.RPC("AddScore", PhotonTargets.AllBufferedViaServer, attackPlayerNum);

            //순서 중요
            hpBarObj.SetActive(false);
            //NGUI는 바로 Destroy..를 해야 에러가 안뜸..
            //otherUIobj.SetActive(false);
            Destroy(otherUIobj);

            optionManager.InventoryObj.SetActive(false);
            Camera.main.transform.position    = new Vector3(deathCamPivot.transform.position.x, deathCamPivot.transform.position.y, deathCamPivot.transform.position.z);
            Camera.main.transform.eulerAngles = new Vector3(deathCamPivot.transform.eulerAngles.x, deathCamPivot.transform.eulerAngles.y, deathCamPivot.transform.eulerAngles.z);

            charMove.AnimBool("death", true);
            Invoke("DelayGameOverTime", 5.0f);
        }
        else if (currHp > 0 && playerStateNum != Constants.DEAD)
        {
            //플레이어 상태가 Constants.NONE 이면 Visble 작업 처리 하지 않음.
            pv.RPC("SetPlayerVisible", PhotonTargets.AllBufferedViaServer, true, currHp, Constants.NONE);
        }
        //}
    }