Beispiel #1
0
    private void FixedUpdate()
    {
        if (gameMgr != null && gameMgr.P1_Left != null && gameMgr.P2_Right != null)
        {
            bool bothReady = (gameMgr.P1_Left.ready && gameMgr.P2_Right.ready);

            if (bothReady)
            {
                if (gameMgr.enableTimeUpdate)
                {
                    gameMgr.defaultUiCtrl.FixedUpdateGOF();
                }
                if (gameMgr.defaultUiCtrl.isPaused)
                {
                    return;
                }

                cameraControl.FixedUpdateGOF();
                if (gameMgr.defaultUiCtrl.OnGetCurrentPlayTime() <= 0 && gameMgr.defaultUiCtrl.OnGetRunning())
                {
                    float p1Life = gameMgr.P1_Left.myCharacterInfo.currentLifePoints / (float)gameMgr.P1_Left.myCharacterInfo.maxLifePoints;
                    float p2Life = gameMgr.P2_Right.myCharacterInfo.currentLifePoints / (float)gameMgr.P2_Right.myCharacterInfo.maxLifePoints;
                    lockMovement = true;
                    lockInputs   = true;

                    gameMgr.defaultUiCtrl.OnSetRunning(false);
                    gameMgr.defaultUiCtrl.OnTimeOverView(true);
                    CGameManager.PlaySoundFX(CSceneManager.Instance.announcerSounds.timeOver);

                    if (p1Life > p2Life)
                    {
                        gameMgr.P2_Right.EndRound(3f);
                    }
                    else if (p1Life == p2Life)
                    {
                        gameMgr.P1_Left.NewRound(3f);
                    }
                    else
                    {
                        gameMgr.P1_Left.EndRound(3f);
                    }
                }

                if (gameMgr.P1_Left.moveSetScript != null && gameMgr.P1_Left.moveSetScript.MecanimControl != null)
                {
                    gameMgr.P1_Left.moveSetScript.MecanimControl.FixedUpdateGOF();
                    if (gameMgr.P1_Left.projectiles.Count > 0)
                    {
                        // item => item.IsDestroyed()는      delegate( item ) { item.IsDestroyed(); }
                        // 무명 함수의 첫번째 인자
                        gameMgr.P1_Left.projectiles.RemoveAll(item => item.IsDestroyed() || item == null);

                        foreach (ProjectileMoveScript projectileMoveScript in gameMgr.P1_Left.projectiles)
                        {
                            if (projectileMoveScript != null)
                            {
                                projectileMoveScript.FixedUpdateGOF();
                            }
                        }
                    }
                    gameMgr.P1_Left.FixedUpdateGOF();
                }

                if (gameMgr.P2_Right.moveSetScript != null && gameMgr.P2_Right.moveSetScript.MecanimControl != null)
                {
                    gameMgr.P2_Right.moveSetScript.MecanimControl.FixedUpdateGOF();
                    // projectile update
                    if (gameMgr.P2_Right.projectiles.Count > 0)
                    {
                        gameMgr.P2_Right.projectiles.RemoveAll(item => item.IsDestroyed() || item == null);

                        foreach (ProjectileMoveScript projectileMoveScript in gameMgr.P2_Right.projectiles)
                        {
                            if (projectileMoveScript != null)
                            {
                                projectileMoveScript.FixedUpdateGOF();
                            }
                        }
                    }
                    gameMgr.P2_Right.FixedUpdateGOF();
                }
            }
        }
    }