예제 #1
0
    void ShowAndAddBonusScore()
    {
        mIsShowScoreBonus = false;
        UIManager.sSingleton.ShowBonusScore(mBonusScore);

        if (GameManager.sSingleton.TotalNumOfPlayer() == 2)
        {
            int dividedScore = mBonusScore / 2;
            mPlayerController1.score += dividedScore;
            mPlayerController2.score += dividedScore;
        }
        else if (GameManager.sSingleton.IsThisPlayerActive(1))
        {
            mPlayerController1.score += mBonusScore;
        }
        else if (GameManager.sSingleton.IsThisPlayerActive(2))
        {
            mPlayerController2.score += mBonusScore;
        }

        if (GameManager.sSingleton.IsThisPlayerActive(1))
        {
            UIManager.sSingleton.UpdateScore(1, mPlayerController1.score);
        }
        if (GameManager.sSingleton.IsThisPlayerActive(2))
        {
            UIManager.sSingleton.UpdateScore(2, mPlayerController2.score);
        }

        StartCoroutine(CoroutineUtil.WaitFor(5.0f, AfterBossIsDead));
    }
예제 #2
0
 void ServerCountDown(Block block)
 {
     if (block == null)
     {
         Debug.LogError("block is empty! ");
         return;
     }
     if (!block.isShowModel)
     {
         return;
     }
     CoroutineUtil.WaitSeconds(() =>
     {
         // 这里是由于前面被消除了,因此这里是空的
         Singleton._sceneService.ShowBlock(block._index, (int index, bool isShow) =>
         {
             if (index != block._index)
             {
                 Debug.LogErrorFormat("index与服务器不一致 index={0}, block.index={1}", index, block._index);
                 return;
             }
             if (block != null)
             {
                 // 这里必须是false
                 // block.isShowModel = false;
                 if (isShow)
                 {
                     Debug.LogErrorFormat("服务器给了错误的数据 index={0}, isShow={1}", index, isShow);
                 }
                 block.isShowModel = isShow;
             }
         });
     }, block._vanishTime);
 }
예제 #3
0
    IEnumerator KeepTheFlow() //start waves and event pauses
    {
        int start_child = 0;

        Debug.Log("KEEPING THE FLOW\n");
        while (true)
        {
            if (Peripheral.Instance.WaveCountdownOngoing())
            {
                //   if (take_snapshots) TakeSnapshot(filename);
                if (Moon.Instance.current_wave == 0)
                {
                    yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(1f)));
                }
                else
                {
                    yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(wave_start_wait)));
                }

                Peripheral.Instance.StartWave();
            }


            if (Central.Instance.state == GameState.InGame && EagleEyes.Instance.events.transform.childCount > 0)
            {
                int max = EagleEyes.Instance.events.transform.childCount;
                for (int i = start_child; i < max; i++)
                {
                    Transform child = EagleEyes.Instance.events.transform.GetChild(i).GetChild(0);
                    start_child = i;
                    if (!child.gameObject.activeSelf)
                    {
                        continue;
                    }
                    if (EagleEyes.Instance.events.transform.GetChild(i).gameObject.name.Contains("hint"))
                    {
                        continue;
                    }
                    if (EagleEyes.Instance.events.transform.GetChild(i).gameObject.name.Contains("enemy_description"))
                    {
                        continue;
                    }
                    Button button = child.gameObject.GetComponent <Button>();
                    if (!button)
                    {
                        continue;
                    }
                    button.onClick.Invoke();
                }
            }

            /*
             * if (Central.Instance.state == GameState.InGame && Moon.Instance.current_wave == Moon.Instance.waves.Count)
             * {
             *  if (take_snapshots) TakeSnapshot(filename);
             * }
             */
            yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(0.1f)));
        }
    }
예제 #4
0
    IEnumerator GetReady()
    {
        oCamera.GetComponent <BlurOptimized>().enabled = true;
        Counting = true;
        AudioSource audio = GameController.GetComponent <AudioSource>();

        audio.Pause();
        GameController.GetComponent <MouseControl>().enabled = false;
        CountDown.SetActive(true);

        countText.text = "3";
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(COUNT_DOWN_WAIT_TIME)));

        countText.text = "2";
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(COUNT_DOWN_WAIT_TIME)));

        countText.text = "1";
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(COUNT_DOWN_WAIT_TIME)));

        countText.text = null;
        CountDown.SetActive(false);
        Counting = false;
        oCamera.GetComponent <BlurOptimized>().enabled = false;
        //Activating everything
        audio.Play();
        PauseButton.SetActive(true);
        GameController.GetComponent <MouseControl>().enabled = true;
        Time.timeScale = 1;
    }
예제 #5
0
    IEnumerator doanimation()
    {
        AudioSource.PlayClipAtPoint(animationSound, user.transform.position);
        tar.STUNNED(1f);
        Time.timeScale = 0.2f;
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(1f)));

        for (int c = 0; c < 5; ++c)
        {
            Time.timeScale += 0.2f;
            alpha          -= 0.2f;
            yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(0.05f)));
        }
        Time.timeScale = 1f;
        StartCoroutine(tar.FloatInDirection("Back"));
        yield return(new WaitForSeconds(0.1f));

        StartCoroutine(tar.FloatInDirection("Back"));
        yield return(new WaitForSeconds(0.1f));

        StartCoroutine(tar.FloatInDirection("Back"));
        yield return(new WaitForSeconds(0.1f));

        StartCoroutine(tar.FloatInDirection("Back"));
        yield return(new WaitForSeconds(0.1f));

        tar.LoseHealth(Mathf.CeilToInt(us.max_stamina * 1.21f));
        StartCoroutine(tar.FloatInDirection("Back"));
        Destroy(gameObject);
    }
예제 #6
0
        /// <inheritdoc/>
        public override ISensor[] CreateSensors()
        {
#if (UNITY_EDITOR)
            if (Application.isPlaying)
            {
                EditorUtil.HideBehaviorParametersEditor();

                CoroutineUtil.Stop(this, m_Debug_OnSensorCreated);
                m_Debug_OnSensorCreated = new InvokeAfterFrames(
                    this, Debug_ToggleDrawGridBuffer).Coroutine;
            }
#endif


            m_GridSensor = new GridSensor(
                m_SensorName, m_GridBuffer, m_CompressionType, m_ObservationType);

            if (m_ObservationStacks > 1)
            {
                return(new ISensor[]
                {
                    new StackingSensor(m_GridSensor, m_ObservationStacks)
                });
            }

            return(new ISensor[] { m_GridSensor });
        }
예제 #7
0
    protected virtual void Update()
    {
        if (transform.parent == null)
        {
            Destroy(gameObject);
        }
        else if (isStartPlanet == false)
        {
            if (transform.parent.GetComponent <Sector>().nowSectorTile.index == 4)
            {
                targetScale = 0.75f;
            }
            else if (transform.parent.GetComponent <Sector>().nowSectorTile.index == 3)
            {
                targetScale = 0.9f;
            }
            else if (transform.parent.GetComponent <Sector>().nowSectorTile.index == 2)
            {
                targetScale = 1.1f;
            }
            else if (transform.parent.GetComponent <Sector>().nowSectorTile.index == 1)
            {
                targetScale = 1.5f;
            }
        }

        if (isMove == false)
        {
            isMove = true;
            StartCoroutine(CoroutineUtil.LerpMove(this.gameObject, this.transform.position, targetPos, 2));
            StartCoroutine(CoroutineUtil.LerpScale(this.gameObject, this.transform.localScale, new Vector3(1f, 1f, 1f) * targetScale, 2));
        }
    }
예제 #8
0
    IEnumerator AfterBonusBooster()
    {
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(1)));

        UseBooster();
        //  startRotate = true;
    }
예제 #9
0
        /// <summary>
        /// Checks and sends if we took a screenshot
        /// </summary>
        public void CheckScreenshots()
        {
            if (GameSettings.TAKE_SCREENSHOT.GetKeyDown())
            {
                if (TimeUtil.IsInInterval(ref _lastTakenScreenshot, SettingsSystem.ServerSettings.MinScreenshotIntervalMs))
                {
                    var path = CommonUtil.CombinePaths(MainSystem.KspPath, "Screenshots");
                    CoroutineUtil.StartDelayedRoutine(nameof(CheckScreenshots), () =>
                    {
                        var photo = new DirectoryInfo(path).GetFiles().OrderByDescending(f => f.LastWriteTime).FirstOrDefault();
                        if (photo != null)
                        {
                            var imageData = ScaleScreenshot(File.ReadAllBytes(photo.FullName), 800, 600);
                            TaskFactory.StartNew(() =>
                            {
                                MessageSender.SendScreenshot(imageData);
                            });
                            LunaScreenMsg.PostScreenMessage(LocalizationContainer.ScreenText.ScreenshotTaken, 10f, ScreenMessageStyle.UPPER_CENTER);
                        }
                    }, 0.3f);
                }
                else
                {
                    var msg = LocalizationContainer.ScreenText.ScreenshotInterval.Replace("$1", TimeSpan.FromMilliseconds(SettingsSystem.ServerSettings.MinScreenshotIntervalMs).TotalSeconds
                                                                                          .ToString(CultureInfo.InvariantCulture));

                    LunaScreenMsg.PostScreenMessage(msg, 20f, ScreenMessageStyle.UPPER_CENTER);
                }
            }
        }
예제 #10
0
    public void Battle(Action onFinish)
    {
        bool hasGrandDaughter = GameData._isGrandDaughterInQueue;

        _onPlotFinish = () =>
        {
            if (onFinish != null)
            {
                onFinish();
            }
            if (hasGrandDaughter)
            {
                UIManager._Instance.SetMaskEnable(true);
                UIManager._Instance.SetSysMsgInfo(string.Format(SystemMessage._removePlayer, GameData._Instance._roleLib.GetRole(ERole.GrandDaughter)._name));
                GameData._isGrandDaughterInQueue = false;
                // 孙女离队,老人失去方向感
                // 生成孙女并设置位置
                MapManager.ResetMap(48, MapCode.NPC_GRAND_DAUGHTER, true);                 // TODO 写死位置不好吧
            }
            else
            {
                // 如果这里没有孙女那么就去除孙女的NPC信息
                Singleton._npcManager.RemoveNPC(ERole.GrandDaughter);
            }
            GameData._CanRotateCamera = true;
            PlotManager.status        = EPlotStatus.Battle;
        };
        _plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, hasGrandDaughter ? GameData._Instance._plot_Battle :
                                   GameData._Instance._plot_Battle_NoGrandDaughter);
        CoroutineUtil.Start(_plotRoutine);
    }
예제 #11
0
    IEnumerator UseBonus()
    {
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(0.5f)));

        bonusText.text = "% " + (MainBonus.count);

        iTween.ScaleTo(bonusText.gameObject,
                       iTween.Hash(
                           "scale", StaticValues.maxScaleTextInMenu,
                           "time", StaticValues.timeToScaleTextInMenu,
                           "ignoretimescale", true,
                           "easetype", iTween.EaseType.easeOutCubic
                           )
                       );

        iTween.ScaleTo(bonusText.gameObject,
                       iTween.Hash(
                           "scale", startScale,
                           "delay", StaticValues.timeToScaleTextInMenu,
                           "time", StaticValues.timeToScaleTextInMenu,
                           "ignoretimescale", true,
                           "easetype", iTween.EaseType.easeInCubic,
                           "oncomplete", (System.Action <object>)(newVal => {
            ShowFiveBonus();
        }),
                           "oncompletetarget", gameObject
                           )
                       );
    }
예제 #12
0
//	IEnumerator MoveBack(){
//		yield return StartCoroutine(CoroutineUtil.WaitForRealSeconds(3));
//		moveCameraClose = false;
//		moveBack = true;
//		//	generalCanvas.GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceCamera;
//		//	uiCanvas.GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceCamera;
//

//	}

    IEnumerator Deactivate()
    {
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(1)));

        //	yield return new WaitForSeconds(1 * Time.unscaledDeltaTime);
        gameObject.SetActive(false);
    }
    /*
     * public string LoadVehicleSounds(string filename, VehicleSounds vehicleSounds, Action<AudioClip, VehicleSounds> onSuccess) {
     *
     *      filename = GetFileName(filename);
     *
     *      var filePath = GetPersistentPath(filename);
     *      var file = "file://" + filePath;
     *
     *      currentFileName = filename;
     *
     *      LogUtil.Log( "Load: onSuccess: " + onSuccess );
     *      LogUtil.Log( "Load: filePath: " + filename );
     *
     *      var onFailure = new Action<string>( error => LogUtil.Log( error ) );
     *
     #if UNITY_STANDALONE_OSX
     #elif UNITY_STANDALONE_WIN
     #elif UNITY_ANDROID
     *      if(CheckIfSoundExists(filePath)) {
     *              CoroutineUtil.Start( loadAudioFileAtPathVehicles( file, vehicleSounds, onFailure, onSuccess ) );
     *      }
     #elif UNITY_WEBPLAYER
     #elif UNITY_IPHONE
     *      if(CheckIfSoundExists(filePath)) {
     *              CoroutineUtil.Start( loadAudioFileAtPathVehicles( file, vehicleSounds, onFailure, onSuccess ) );
     *      }
     #elif UNITY_EDITOR
     #endif
     *      LogUtil.Log( "Load: " + file );
     *      LogUtil.Log( "Load checked: " + filePath );
     *      return file;
     * }
     */

    public virtual string Load(string filename, Action <AudioClip> onSuccess)
    {
        filename = GetFileName(filename);

        var filePath = GetPersistentPath(filename);

        var file = "file://" + filePath;

        currentFileName = filename;

        LogUtil.Log("Load: onSuccess: " + onSuccess);
        LogUtil.Log("Load: filePath: " + filename);

#if !UNITY_WEBPLAYER
        var onFailure = new Action <string>(error => LogUtil.Log(error));
#endif
#if UNITY_STANDALONE_OSX
#elif UNITY_STANDALONE_WIN
#elif UNITY_ANDROID
        if (CheckIfSoundExists(filePath))
        {
            CoroutineUtil.Start(loadAudioFileAtPath(file, onFailure, onSuccess));
        }
#elif UNITY_WEBPLAYER
#elif UNITY_IPHONE
        if (CheckIfSoundExists(filePath))
        {
            CoroutineUtil.Start(loadAudioFileAtPath(file, onFailure, onSuccess));
        }
#elif UNITY_EDITOR
#endif
        LogUtil.Log("Load: " + file);
        LogUtil.Log("Load checked: " + filePath);
        return(file);
    }
예제 #14
0
    IEnumerator MaintainFF()
    {
        //if (ff != TimeScale.Fast) yield return null;
        Debug.Log("Maintaining FF " + ff + "\n");
        while (true)

        {
            if (ff == TimeScale.SuperFastPress && Peripheral.Instance.getCurrentTimeScale() != TimeScale.SuperFastPress && Peripheral.Instance.getCurrentTimeScale() != TimeScale.Pause)
            {
                Peripheral.Instance.ChangeTime(TimeScale.SuperFastPress);
            }

            if (ff == TimeScale.Normal && Peripheral.Instance.getCurrentTimeScale() != TimeScale.Normal && Peripheral.Instance.getCurrentTimeScale() != TimeScale.Pause)
            {
                Peripheral.Instance.ChangeTime(TimeScale.Normal);
            }

            if (ff == TimeScale.Fast && Peripheral.Instance.getCurrentTimeScale() != TimeScale.Fast && Peripheral.Instance.getCurrentTimeScale() != TimeScale.Pause)
            {
                Peripheral.Instance.ChangeTime(TimeScale.Fast);
            }

            yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(0.5f)));
        }
    }
예제 #15
0
    IEnumerator DisableTurtle()
    {
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(0.4f)));

        //	Debug.Log("disable turtle");
        GameObject.FindObjectOfType <FadeObjectUnscaled> ().FadeOut(green, 0.2f);
    }
        /// <summary>
        /// Called when a vessel is initiated.
        /// </summary>
        public void VesselInitialized(Vessel vessel, bool fromShipAssembly)
        {
            if (vessel == null)
            {
                return;
            }

            //The vessel is being created by the loader
            if (VesselLoader.CurrentlyLoadingVesselId == vessel.id || fromShipAssembly)
            {
                return;
            }

            //This happens when the vessel you're spectating crashes
            if (VesselCommon.IsSpectating)
            {
                VesselRemoveSystem.Singleton.KillVessel(vessel.id, true, "Tried to create a new vessel while spectating");
                return;
            }

            //It's a debris vessel that we made it
            if (!LockSystem.LockQuery.UnloadedUpdateLockExists(vessel.id))
            {
                //We delay it a bit because we must wait until the vessel is named correctly and so on.
                CoroutineUtil.StartDelayedRoutine("VesselInitialized", () => System.MessageSender.SendVesselMessage(vessel), 0.5f);
                LockSystem.Singleton.AcquireUnloadedUpdateLock(vessel.id, true);
            }
        }
예제 #17
0
    IEnumerator TimeStopSequence(float stopDur, float returnSpdDur)
    {
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(stopDur)));

        float currTime = 0;
        float maxVal   = (1 - mTimeScale);

        while (currTime < returnSpdDur)
        {
            while (UIManager.sSingleton.IsPauseGameOverMenu)
            {
                yield return(null);
            }

            currTime += Time.unscaledDeltaTime;

            float val = currTime / returnSpdDur * maxVal;
            if (val > maxVal)
            {
                val = maxVal;
            }

            Time.timeScale      = mTimeScale + val;
            Time.fixedDeltaTime = mFixedDeltaTime + (val / 100);
            yield return(null);
        }

        Time.timeScale      = 1;
        Time.fixedDeltaTime = mSavedFixedDT;
        mIsUsingBomb        = false;
        BombManager.sSingleton.isTimeStopBomb = false;

        mCurrPS.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
        Destroy(mCurrPS.gameObject);
    }
예제 #18
0
    public virtual void SetOut()
    {
        // Make bottommost page
        transform.SetAsFirstSibling();

        // State
        is_in = false;
        SetInteractable(false);

        // Deactivation
        if (deactivate_delay <= 0)
        {
            gameObject.SetActive(false);
        }
        else
        {
            deactivate_routine = StartCoroutine(CoroutineUtil.DoAfterDelay(
                                                    () => gameObject.SetActive(false), deactivate_delay));
        }

        // Events
        if (on_out != null)
        {
            on_out();
        }
        if (on_out_once != null)
        {
            on_out_once();
            on_out_once = null;
        }
    }
        public void SendVesselMessage(Vessel vessel, bool forceReload = false)
        {
            if (vessel == null || vessel.state == Vessel.State.DEAD || VesselRemoveSystem.Singleton.VesselWillBeKilled(vessel.id))
            {
                return;
            }

            if (!vessel.orbitDriver)
            {
                LunaLog.LogWarning($"Cannot send vessel {vessel.vesselName} - {vessel.id}. It's orbit driver is null!");
                return;
            }

            if (vessel.orbitDriver.Ready())
            {
                vessel.protoVessel = vessel.BackupVessel();
                SendVesselMessage(vessel.protoVessel, forceReload);
            }
            else
            {
                //Orbit driver is not ready so wait max 10 frames until it's ready
                CoroutineUtil.StartConditionRoutine("SendVesselMessage",
                                                    () => SendVesselMessage(vessel),
                                                    () => vessel.orbitDriver.Ready(), 10);
            }
        }
예제 #20
0
        /// <summary>
        /// Sends our vessel just when we start the flight
        /// </summary>
        public void FlightReady()
        {
            if (!VesselCommon.IsSpectating && FlightGlobals.ActiveVessel != null)
            {
                if (!System.CheckVessel(FlightGlobals.ActiveVessel))
                {
                    VesselRemoveSystem.Singleton.AddToKillList(FlightGlobals.ActiveVessel.id, "Vessel check not passed");
                    VesselRemoveSystem.Singleton.KillVessel(FlightGlobals.ActiveVessel.id, "Vessel check not passed");
                    return;
                }

                CoroutineUtil.StartDelayedRoutine(nameof(FlightReady), () =>
                {
                    if (VesselCommon.IsSpectating || FlightGlobals.ActiveVessel == null || FlightGlobals.ActiveVessel.id == Guid.Empty)
                    {
                        return;
                    }

                    System.MessageSender.SendVesselMessage(FlightGlobals.ActiveVessel, true, false);
                }, 5f);

                //Only show safety bubble text if safety bubble is active and player is spawning a new vessel
                if (SettingsSystem.ServerSettings.SafetyBubbleDistance > 0 && FlightGlobals.ActiveVessel.vesselSpawning)
                {
                    LunaScreenMsg.PostScreenMessage(LocalizationContainer.ScreenText.SafetyBubble, 10f, ScreenMessageStyle.UPPER_CENTER);
                }
            }
        }
예제 #21
0
    private IEnumerator StartTurn()
    {
        State = MatchState.TurnChange;

        int chaser_i = turn_num % 2;

        //Tools.Log(string.Format("turn {0}: chaser is p{1}", turn_num, chaser_i));

        // Set chara roles
        charas[chaser_i].SetChaser();
        for (int i = 0; i < charas.Length; ++i)
        {
            if (i != chaser_i)
            {
                charas[i].SetRunner();
            }
        }

        // Flash chase screen
        TimeScaleManager.SetFactor(0, ui_timescale_id);
        match_ui.ShowChaseScreen(charas[chaser_i], charas[1 - chaser_i]);

        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(0.5f)));

        match_ui.HideChaseScreen(GetChaser(), GetRunner());
        TimeScaleManager.SetFactor(1, ui_timescale_id);

        turn_start_time = Time.timeSinceLevelLoad;
        State           = MatchState.InPlay;
    }
예제 #22
0
        /// <summary>
        /// This event is called after a game is loaded. We use it to detect if the player has done a revert
        /// </summary>
        public void OnGameStatePostLoad(ConfigNode data)
        {
            if (FlightGlobals.ActiveVessel != null && !VesselCommon.IsSpectating)
            {
                LunaLog.Log("[LMP]: Detected a revert!");
                var vesselIdsToRemove = FlightGlobals.Vessels
                                        .Where(v => v.rootPart?.missionID == FlightGlobals.ActiveVessel.rootPart.missionID && v.id != FlightGlobals.ActiveVessel.id)
                                        .Select(v => v.id).Distinct();

                //We detected a revert, now pick all the vessel parts (debris) that came from our main active
                //vessel and remove them both from our game and server
                foreach (var vesselIdToRemove in vesselIdsToRemove)
                {
                    System.MessageSender.SendVesselRemove(vesselIdToRemove);
                    System.AddToKillList(vesselIdToRemove);
                }

                //Store it here so the delayed routine can access it!
                var activeVesselId = FlightGlobals.ActiveVessel.id;

                //Now tell the server to remove our old vessel
                CoroutineUtil.StartDelayedRoutine("SendProperVesselRemoveMsg", () =>
                {
                    //We delay the send vessel remove to wait until the proper scene is loaded.
                    //In case we revert to editor we must fully delete that vessel as when flying again we will get a new ID.
                    //Otherwise we say to not keep it in the vessels remove list as perhaps we are reverting to flight and then our vessel id will stay the same.
                    //If we set the keepvesselinremovelist to true then the server will ignore every change we do to our vessel!
                    System.MessageSender.SendVesselRemove(activeVesselId, HighLogic.LoadedSceneIsEditor);
                    if (HighLogic.LoadedSceneIsEditor)
                    {
                        System.AddToKillList(activeVesselId);
                    }
                }, 3);
            }
        }
예제 #23
0
    public void BattleAfter(Action onFinish)
    {
        var    hasGrandDaughter = Singleton._npcManager.GetNPC <GrandDaughter>(ERole.GrandDaughter) != null;
        Action a = onFinish;

        a += () =>
        {
            if (hasGrandDaughter)
            {
                _addPlayerRoutine = AddPlayerRoutine(ERole.GrandDaughter, HUDView._maxSysMsgTime / 2);
                StartCoroutine(_addPlayerRoutine);
                Player._Instance.transform.eulerAngles = Vector3.zero;
                GameData._CanRotateCamera = false;
                UIManager._Instance.SetMaskEnable(false);
                PlotManager.status = EPlotStatus.Battle_After;

                // 对话结束,销毁地图上的NPC
                var pos = MapManager.GetPos(MapCode.NPC_GRAND_DAUGHTER);
                MapManager.ResetMap(MapManager.CurIndex(pos._x, pos._y));
            }
        };

        _plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, hasGrandDaughter ?
                                   GameData._Instance._plot_BattleAfter : GameData._Instance._plot_BattleAfter_NoGrandDaughter, a);

//		_plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, GameData._Instance._plot_BattleAfter, onFinish);
        CoroutineUtil.Start(_plotRoutine);
    }
        /// <summary>
        /// Sends a vessel position update
        /// </summary>
        /// <param name="vessel">Vessel to send the position</param>
        /// <param name="doOrbitDriverReadyCheck">Set it to true if you want to check if the driver is ready.
        /// Avoid checking it unless is really needed as it uses reflection that's slow</param>
        public void SendVesselPositionUpdate(Vessel vessel, bool doOrbitDriverReadyCheck = false)
        {
            if (vessel == null)
            {
                return;
            }

            if (doOrbitDriverReadyCheck && !vessel.orbitDriver.Ready())
            {
                //Orbit driver is not ready so wait max 10 frames until it's ready
                CoroutineUtil.StartConditionRoutine("SendVesselPositionUpdate",
                                                    () => SendVesselPositionUpdate(vessel),
                                                    () => vessel.orbitDriver.Ready(), 10);
            }
            else
            {
                var msg = CreateMessageFromVessel(vessel);
                if (msg == null)
                {
                    return;
                }

                SendMessage(msg);
            }
        }
예제 #25
0
//---------------------------------------------------------------------------------------------------------------
    IEnumerator DestroyParent()
    {
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(1)));

        Time.timeScale = 1;
        Destroy(parent);
    }
예제 #26
0
    IEnumerator ZoomCoroutine()
    {
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(.05f)));

        Vector3 pos = new Vector3(Target.transform.position.x, Target.transform.position.y, transform.position.z);

        transform.position = pos;
        Target.gameObject.GetComponent <Player>().enabled = false;

        Time.timeScale = 0.05f;
        float camOriginalSize = cam.orthographicSize;
        float zoomRate        = (cam.orthographicSize - zoomSize) / zoomAmount;

        while (cam.orthographicSize > zoomSize)
        {
            cam.orthographicSize -= zoomRate;
            yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(zoomTime)));
        }

        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(pauseTime)));

        while (cam.orthographicSize < camOriginalSize)
        {
            cam.orthographicSize += zoomRate;
            yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(zoomTime)));
        }

        Time.timeScale = 1f;

        Target.gameObject.GetComponent <Player>().enabled = true;
    }
예제 #27
0
        /// <summary>
        /// Triggered when the vessel parts change.
        /// CAUTION!: When staging this method can be called a lot of times!
        /// Also, this method is called when docking/undocking and when reloading a vessel
        /// </summary>
        public void VesselPartCountChanged(Vessel vessel)
        {
            if (vessel == null)
            {
                return;
            }

            //The vessel is being created by the loader
            if (VesselLoader.CurrentlyLoadingVesselId == vessel.id)
            {
                return;
            }

            //When a vessel docks it's part count changes but we must not relay it as it's handled by the vessel dock system
            if (CurrentDockEvent.DominantVesselId == vessel.id || CurrentUndockEvent.UndockingVesselId == vessel.id)
            {
                return;
            }

            //This event is called when the vessel is being created and we don't want to send protos of vessels we don't own or while our vessel is not 100% loaded (FlightReady)
            if (vessel.vesselSpawning)
            {
                return;
            }

            //Vessel is scheduled to be killed so ignore this
            if (VesselRemoveSystem.Singleton.VesselWillBeKilled(vessel.id))
            {
                return;
            }

            //We are spectating and the vessel has been modified so trigger a reload
            if (VesselCommon.IsSpectating && FlightGlobals.ActiveVessel && FlightGlobals.ActiveVessel.id == vessel.id && vessel.protoVessel.protoPartSnapshots.Count != FlightGlobals.ActiveVessel.Parts.Count)
            {
                VesselLoader.LoadVessel(vessel.protoVessel);
                return;
            }

            if (!LockSystem.LockQuery.UpdateLockExists(vessel.id))
            {
                LockSystem.Singleton.AcquireUpdateLock(vessel.id, true);
                LockSystem.Singleton.AcquireUnloadedUpdateLock(vessel.id, true);
                VesselProtoSystem.Singleton.MessageSender.SendVesselMessage(vessel);
            }

            if (LockSystem.LockQuery.UpdateLockBelongsToPlayer(vessel.id, SettingsSystem.CurrentSettings.PlayerName))
            {
                //This method can be called a lot of times during staging (for every part that decouples)
                //For this reason we wait 0.5 seconds so we send all the changes at once.
                if (QueuedVessels.Contains(vessel.id))
                {
                    return;
                }

                QueuedVessels.Add(vessel.id);
                CoroutineUtil.StartDelayedRoutine("QueueVesselMessageAsPartsChanged", () => QueueNewVesselChange(vessel), 0.5f);
                VesselProtoSystem.Singleton.MessageSender.SendVesselMessage(vessel);
            }
        }
예제 #28
0
 public void Stop()
 {
     CoroutineUtil.StopCoroutine(CountDown());
     _count    = 0;
     _delay    = 0;
     _interval = 0;
     _callback = null;
 }
예제 #29
0
    IEnumerator DelayMinionsWin()
    {
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(0.5f)));

        AudioSource src = this.GetComponents <AudioSource> () [1];

        src.Play();         //Make the music-source play
    }
예제 #30
0
    IEnumerator ShowMenu()
    {
        yield return(StartCoroutine(CoroutineUtil.WaitForRealSeconds(1)));

        library.fullScore.SaveBigFullScore(fullScore);
        library.canvasController.GetBaraban().ConvertToMoney();
        // library.canvasController.ShowEndMenu();
    }