示例#1
0
    private void Update()
    {
        float num  = humanPt / humanPtMax;
        float num2 = titanPt / titanPtMax;

        if (!base.photonView.isMine)
        {
            humanCyc.transform.localScale = new Vector3(num, num, 1f);
            titanCyc.transform.localScale = new Vector3(num2, num2, 1f);
            syncTimer += Time.deltaTime;
            if (syncTimer > syncInterval)
            {
                syncTimer = 0f;
                checkIfBeingCapture();
            }
            return;
        }
        switch (state)
        {
        case CheckPointState.None:
            if (playerOn && !titanOn)
            {
                humanGetsPoint();
                titanLosePoint();
            }
            else if (titanOn && !playerOn)
            {
                titanGetsPoint();
                humanLosePoint();
            }
            else
            {
                humanLosePoint();
                titanLosePoint();
            }
            break;

        case CheckPointState.Human:
            if (titanOn && !playerOn)
            {
                titanGetsPoint();
            }
            else
            {
                titanLosePoint();
            }
            getPtsTimer += Time.deltaTime;
            if (getPtsTimer > getPtsInterval)
            {
                getPtsTimer = 0f;
                if (!isBase)
                {
                    fengGame.PVPhumanScore++;
                }
                fengGame.CheckPvPPoints();
            }
            break;

        case CheckPointState.Titan:
            if (playerOn && !titanOn)
            {
                humanGetsPoint();
            }
            else
            {
                humanLosePoint();
            }
            getPtsTimer += Time.deltaTime;
            if (getPtsTimer > getPtsInterval)
            {
                getPtsTimer = 0f;
                if (!isBase)
                {
                    fengGame.PVPtitanScore++;
                }
                fengGame.CheckPvPPoints();
            }
            spawnTitanTimer += Time.deltaTime;
            if (spawnTitanTimer > titanInterval)
            {
                spawnTitanTimer = 0f;
                if (FengGameManagerMKII.Level.Map == "The City I")
                {
                    if (GameObject.FindGameObjectsWithTag("titan").Length < 12)
                    {
                        NewTitan();
                    }
                }
                else if (GameObject.FindGameObjectsWithTag("titan").Length < 20)
                {
                    NewTitan();
                }
            }
            break;
        }
        syncTimer += Time.deltaTime;
        if (syncTimer > syncInterval)
        {
            syncTimer = 0f;
            checkIfBeingCapture();
            SyncPoints();
        }
        num  = humanPt / humanPtMax;
        num2 = titanPt / titanPtMax;
        humanCyc.transform.localScale = new Vector3(num, num, 1f);
        titanCyc.transform.localScale = new Vector3(num2, num2, 1f);
    }
示例#2
0
    private void Update()
    {
        float humanPercent = humanPt / humanPtMax;
        float titanPercent = titanPt / titanPtMax;

        humanCyc.transform.localScale = new Vector3(humanPercent, humanPercent, 1f);
        titanCyc.transform.localScale = new Vector3(titanPercent, titanPercent, 1f);

        syncTimer += Time.deltaTime;

        if (!base.photonView.isMine)
        {
            if (syncTimer > syncInterval)
            {
                syncTimer = 0f;
                CheckIfBeingCaptured();
            }

            return;
        }

        float lastHumanPt = humanPt;
        float lastTitanPt = titanPt;

        switch (state)
        {
        case CheckPointState.None:
            if (playerOn && !titanOn)
            {
                humanGetsPoint();
                titanLosePoint();
            }
            else if (titanOn && !playerOn)
            {
                titanGetsPoint();
                humanLosePoint();
            }
            else
            {
                humanLosePoint();
                titanLosePoint();
            }
            break;

        case CheckPointState.Human:
            if (titanOn && !playerOn)
            {
                titanGetsPoint();
            }
            else
            {
                titanLosePoint();
            }
            getPtsTimer += Time.deltaTime;
            if (getPtsTimer > getPtsInterval)
            {
                getPtsTimer = 0f;
                if (!isBase)
                {
                    fengGame.PVPhumanScore++;
                }
                fengGame.CheckPvPPoints();
            }
            break;

        case CheckPointState.Titan:
            if (playerOn && !titanOn)
            {
                humanGetsPoint();
            }
            else
            {
                humanLosePoint();
            }
            getPtsTimer += Time.deltaTime;
            if (getPtsTimer > getPtsInterval)
            {
                getPtsTimer = 0f;
                if (!isBase)
                {
                    fengGame.PVPtitanScore++;
                }
                fengGame.CheckPvPPoints();
            }
            spawnTitanTimer += Time.deltaTime;
            if (spawnTitanTimer > titanInterval)
            {
                spawnTitanTimer = 0f;
                if (FengGameManagerMKII.Level.Map == "The City I")
                {
                    if (FengGameManagerMKII.Instance.AllTitans.Count < 12)
                    {
                        NewTitan();
                    }
                }
                else if (FengGameManagerMKII.Instance.AllTitans.Count < 20)
                {
                    NewTitan();
                }
            }
            break;
        }

        if (syncTimer > syncInterval)
        {
            syncTimer = 0f;
            CheckIfBeingCaptured();

            if (lastHumanPt != humanPt)
            {
                base.photonView.RPC("changeHumanPt", PhotonTargets.Others, humanPt);
            }
            if (lastTitanPt != titanPt)
            {
                base.photonView.RPC("changeTitanPt", PhotonTargets.Others, titanPt);
            }
        }
    }