Exemplo n.º 1
0
    void Dash(Collider other)    //冲锋
    {
        switch (other.gameObject.layer)
        {
        case MyTags.Fruit_Layer:
            FruitScript fruit = other.transform.GetComponent <FruitScript> ();
            fruit.CutFruit();
            break;

        case MyTags.Obstacle_Layer:
            //播放音效
            MyAudio.PlayAudio(StaticParameter.s_Obstacle_Break, false, StaticParameter.s_Obstacle_Break_Volume);
            //Destroy (other.gameObject);
            try
            {
                StaticParameter.DestroyOrDespawn(other.transform);
                GameObject _obstacle = (GameObject)StaticParameter.LoadObject("Other", "BrokenObstacle");
                GameObject copy      = Instantiate(_obstacle, other.transform.position, Quaternion.identity) as GameObject;
                Destroy(copy, 2);

                SkinnedMeshRenderer huamnRenderer = other.transform.GetComponent <SkinnedMeshRenderer>();
                huamnRenderer.material.DOFade(0, 1);
            }
            catch (Exception)
            {
            }

            //摄像机震动
            CameraShake.Is_Shake_Camera = true;

            break;

        case MyTags.Spring_Layer:
            //播放音效
            MyAudio.PlayAudio(StaticParameter.s_Obstacle_Break, false, StaticParameter.s_Obstacle_Break_Volume);
            //摄像机震动
            CameraShake.Is_Shake_Camera = true;
            //播放破坏动画
            Animator ani = other.transform.GetComponent <Animator>();
            ani.SetBool(StaticParameter.Ani_Key_Broke, true);
            //摄像机震动
            CameraShake.Is_Shake_Camera = true;

            break;
        }
    }
Exemplo n.º 2
0
        protected override void UpdatePrefabAfterSimulation()
        {
            base.UpdatePrefabAfterSimulation();

            /*
             * if (m_cue != null && m_cue.Value.IsPlaying)
             * {
             *  MyAudio.CalculateOcclusion(m_cue.Value, m_cue.Value.Center);
             * }
             */

            PlaySound();
            if (m_cue != null && m_cue.Value.IsPlaying)
            {
                MyAudio.UpdateCuePosition(m_cue, Vector3.Transform(m_pointLocalMatrix.Translation, base.WorldMatrix), WorldMatrix.Forward, WorldMatrix.Up, Physics.LinearVelocity);
            }
        }
Exemplo n.º 3
0
 //分数动效
 void ScoreEffect()
 {
     if (_auto && _score < MyKeys.Game_Score)
     {
         int temp = _score / _add_Once;
         if (temp < _add_Times)
         {
             _score += _add_Once;
         }
         else
         {
             _score++;
         }
         _now_Score.text = _score.ToString();
         MyAudio.PlayAudio(StaticParameter.s_Count, false, StaticParameter.s_Count_Volume);
     }
 }
Exemplo n.º 4
0
        public override void UpdateAfterSimulation()
        {
            base.UpdateAfterSimulation();

            // HACK: Multiplayer
            if (IsDummy && CurrentState == MyDrillStateEnum.Drilling)
            {
                Shot(null);
            }

            switch (CurrentState)
            {
            case MyDrillStateEnum.InsideShip:
                // If drill isnt active we stop sound that might not be stopped before
                StopDustEffect();
                StopIdleCue();
                return;

            case MyDrillStateEnum.Deactivated:
                PullDrillBack();
                return;

            case MyDrillStateEnum.Activated:
                EjectDrill();
                break;

            case MyDrillStateEnum.Drilling:
                Drill();
                break;
            }

            if ((m_drillCue != null) && m_drillCue.Value.IsPlaying)
            {
                MyAudio.UpdateCuePosition(m_drillCue, WorldMatrix.Translation,
                                          WorldMatrix.Forward, WorldMatrix.Up, this.Parent.Physics.LinearVelocity);
            }

            if ((MyMinerGame.TotalGamePlayTimeInMilliseconds - m_lastTimeStarted) > 100)
            {
                CurrentState = MyDrillStateEnum.Activated;
                StopDrillingCue();
                StopDustEffect();
                //StopMovingCue();
            }
        }
        public override void Load() // Code in that block will be called on the load of the sector
        {
            base.Load();
            MyAudio.ApplyTransition(MyMusicTransitionEnum.HeavyFight, 3); // Sets music group to be played in the sector - no matter if the mission is running or not
            MyScriptWrapper.SetPlayerFaction(MyMwcObjectBuilder_FactionEnum.Rainiers);
            MyScriptWrapper.SetFactionRelation(MyMwcObjectBuilder_FactionEnum.Russian, MyMwcObjectBuilder_FactionEnum.China, -100);


            base.Load();

            m_Detector1 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector1));
            m_Detector1.OnEntityEnter += Detector1Action;
            m_Detector1.On();

            m_Detector2 = MyScriptWrapper.GetDetector(MyScriptWrapper.GetEntity((uint)EntityID.Detector2));
            m_Detector2.OnEntityEnter += Detector2Action;
            m_Detector2.On();
        }
Exemplo n.º 6
0
    /// <summary>
    /// 购买护盾
    /// </summary>
    public void BuyProtect()
    {
        MyAudio.PlayAudio(StaticParameter.s_UI_OK, false, StaticParameter.s_UI_OK_Volume);

        if (MyKeys.Diamond_Value > MyKeys.BuyProtectCost)
        {
            MyKeys.Diamond_Value -= MyKeys.BuyProtectCost;
            HumanManager.Nature.HumanManager_Script.ItemState = ItemState.Protect;
            UMManager.Event(EventID.InGame_Protect);
        }
        else
        {
            MyKeys.Pause_Game = true;
            GameUITool.Instance.SetTheActive(GameUI.GameUI_ShopDiamond);
            //EventSystem.current.currentSelectedGameObject.GetComponent<Image>().raycastTarget = false;
            MyAudio.PlayAudio(StaticParameter.s_Buy, false, StaticParameter.s_Buy_Volume);
        }
    }
Exemplo n.º 7
0
    IEnumerator Wait()
    {
        yield return(new WaitForSeconds(1));

        transform.GetChild(_index).gameObject.SetActive(false);
        _index++;
        if (_index == 1)
        {
            MyAudio.PlayAudio(StaticParameter.s_Rankup, false, StaticParameter.s_Rankup_Volume);

            transform.GetChild(1).gameObject.SetActive(true);
            _tempList = _rankupList;
            times     = 0;
            Next();
            int index = (MyKeys.GetHeroLevel(MyKeys.CurrentSelectedHero) - 1) % 5;
            transform.GetChild(1).localPosition = Vector3.right * transform.GetChild(1).localPosition.x + Vector3.up * _rankup_Positions[index];
        }
    }
Exemplo n.º 8
0
        /// <summary>
        /// Called when [world position changed].
        /// </summary>
        /// <param name="source">The source object that caused this event.</param>
        public override void OnWorldPositionChanged(object source)
        {
            base.OnWorldPositionChanged(source);

            if (Physics != null && m_thrusterCue != null)
            {
                //  Update thruster cue/sound
                MyAudio.UpdateCuePosition(m_thrusterCue, GetPosition(), WorldMatrix.Forward, WorldMatrix.Up,
                                          Physics.LinearVelocity);
            }

            //  Update light position
            if (m_light != null)
            {
                m_light.SetPosition(GetPosition());
                m_light.Color = MyMissileHelperUtil.GetMissileLightColor();
                m_light.Range = MyMissileConstants.MISSILE_LIGHT_RANGE;
            }
        }
Exemplo n.º 9
0
    }                                         //切了水果的数量
    // Use this for initialization
    void Start()
    {
        //播放音效
        switch (MyKeys.CurrentSelectedHero)
        {
        case MyKeys.CurrentHero.GuiYuZi:
            MyAudio.PlayAudio(StaticParameter.s_GuiYuZi_Win, false, StaticParameter.s_GuiYuZi_Win_Volume);
            break;

        case MyKeys.CurrentHero.CiShen:
            MyAudio.PlayAudio(StaticParameter.s_CiShen_Win, false, StaticParameter.s_CiShen_Win_Volume);
            break;

        case MyKeys.CurrentHero.YuZi:
            MyAudio.PlayAudio(StaticParameter.s_YuZi_Win, false, StaticParameter.s_YuZi_Win_Volume);
            break;
        }
        StartCoroutine(Wait());
    }
Exemplo n.º 10
0
    public void OnExecute()
    {
        if (ItemColliction.SuperMan.WhetherSpeedUp())
        {
            _human.Translate(0, _y_Speed * 1.5f, 0, Space.World);
        }
        else
        {
            _human.Translate(0, _y_Speed, 0, Space.World);
        }

        _time += Time.deltaTime;
        if (_time > 0.2f)
        {
            _time = 0;
            //播放音效
            MyAudio.PlayAudio(StaticParameter.s_Run, false, StaticParameter.s_Run_Volume);
        }
    }
Exemplo n.º 11
0
        private static void UpdateShouts()
        {
            // check for new shout to start
            if (m_actualShoutCue == null || !m_actualShoutCue.Value.IsPlaying)
            {
                // check if we can start new shout
                if (m_nextShoutTime < MyMinerGame.TotalGamePlayTimeInMilliseconds)
                {
                    // gets random faction to shout (from detected factions by radar)
                    MyMwcObjectBuilder_FactionEnum?factionToShout = GetRandomDetectedFaction();
                    if (factionToShout != null)
                    {
                        MySoundCuesEnum shoutCue = GetRandomShout(factionToShout.Value);
                        m_actualShoutCue = MyAudio.AddCue2D(shoutCue);
                        if (m_actualShoutCue != null)
                        {
                            // because shouts can be ambient cues, so we must set correct volume for these cues
                            if (m_actualShoutCue.Value.IsAmbientSound)
                            {
                                MyAudio.UpdateCueAmbVolume(m_actualShoutCue, 100f);
                            }
                            else
                            {
                                MyAudio.UpdateCueVolume(m_actualShoutCue, 0.9f);
                            }
                            m_actualShoutFaction = factionToShout;
                            m_lastShoutCue       = shoutCue;

                            // calculate new time for next shout
                            m_nextShoutTime = MyMinerGame.TotalGamePlayTimeInMilliseconds + MyMwcUtils.GetRandomInt(INTERVAL_BETWEEN_SHOUTS_MIN, INTERVAL_BETWEEN_SHOUTS_MAX);
                        }
                    }
                }
            }
            // check for old shout to stop
            else
            {
                if (!m_detectedFactions.Contains(m_actualShoutFaction.Value))
                {
                    StopShout();
                }
            }
        }
Exemplo n.º 12
0
        public override void ChangeValueDown()
        {
            MyAudio.AddCue2D(MySoundCuesEnum.SfxHudRadarMode);
            switch (m_current)
            {
            case MyHudRadarTypesEnum.Normal3D:
                m_current = MyHudRadarTypesEnum.Solar2D;
                break;

            case MyHudRadarTypesEnum.Player2D:
                m_current = MyHudRadarTypesEnum.Normal3D;
                break;

            case MyHudRadarTypesEnum.Solar2D:
                m_current = MyHudRadarTypesEnum.Player2D;
                break;
            }
            base.ChangeValueDown();
        }
Exemplo n.º 13
0
    /// <summary>
    /// 导航步骤间的转换
    /// </summary>
    /// <param name="from"></param>
    /// <param name="to"></param>
    /// <param name="timeToChange"></param>
    protected void ConvertGuidance(int from, int to, float timeToChange)
    {
        if (GuidanceBase.GuidanceMark == 1 && from == 1)
        {
        }
        else
        {
            if (!UI_Guidance_List[from].activeSelf)
            {
                return;
            }
        }

        //tips声音
        MyAudio.PlayAudio(StaticParameter.s_Tips, false, StaticParameter.s_Tips_Volume);

        UI_Guidance_List[from].SetActive(false);
        StartCoroutine(Wait(to, timeToChange));
    }
Exemplo n.º 14
0
 //  Switch pause on or off, depending on what mode is now
 public static void SwitchPause()
 {
     MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyMinerGame::SwitchPause");
     if (m_pauseActive)
     {
         //  Going from PAUSED game to non-paused game
         m_totalPauseTimeInMilliseconds += TotalTimeInMilliseconds - m_pauseStartTimeInMilliseconds;
         m_pauseActive = false;
         MyAudio.Resume();
     }
     else
     {
         //  Going from non-paused game to PAUSED game
         m_pauseStartTimeInMilliseconds = TotalTimeInMilliseconds;
         m_pauseActive = true;
         MyAudio.Pause();
     }
     MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
 }
Exemplo n.º 15
0
    public void StartGame(int mission)
    {
        MyAudio.PlayAudio(StaticParameter.s_UI_OK, false, StaticParameter.s_UI_OK_Volume);

        UI_Guidance_List[UI_Guidance_List.Count - 1].SetActive(false);

        if (mission == 2)
        {
            GuidanceMark = 3;
        }

        //体力大于0,直接开始加载场景
        //开始游戏减去一点体力,通过游戏会加一点体力
        TimeManager.ReducePhysicalPower();
        MyKeys.NowPlayingMission = mission;
        int index = mission + 1;

        //显示加载界面
        Loading(index);
    }
Exemplo n.º 16
0
    void SpringExecute(GameResource.HumanNature nature, Transform spring)
    {
        //播放音效
        MyAudio.PlayAudio(StaticParameter.s_Spring, false, StaticParameter.s_Spring_Volume);

        HumanState state = HumanState.Jump;

        if (spring.tag.Contains(MyTags.Left_Tag))
        {
            HumanManager.WallMark = WallMark.Right;
        }
        else
        {
            HumanManager.WallMark = WallMark.Left;
        }

        HumanManager.JumpMark = JumpMark.SpeedUp;    //改变跳跃类型

        nature.HumanManager_Script.CurrentState = state;
    }
        //  Method returns true if input was captured by control, so no other controls, nor screen can use input in this update
        public override bool HandleInput(MyGuiInput input, bool hasKeyboardActiveControl, bool hasKeyboardActiveControlPrevious, bool isThisFirstHandleInput)
        {
            bool ret = base.HandleInput(input, hasKeyboardActiveControl, hasKeyboardActiveControlPrevious, isThisFirstHandleInput);

            if (ret == false)
            {
                if (((IsMouseOver() == true) && (input.IsNewLeftMousePressed() == true)) ||
                    ((hasKeyboardActiveControl == true) && ((input.IsNewKeyPress(Keys.Enter) || (input.IsNewKeyPress(Keys.Space))))))
                {
                    if (!Selected)
                    {
                        MyAudio.AddCue2D(MySoundCuesEnum.GuiMouseClick);
                        Selected = true;
                        ret      = true;
                    }
                }
            }

            return(ret);
        }
Exemplo n.º 18
0
        public override void UpdateBeforeSimulation()
        {
            if (MyMinerGame.TotalGamePlayTimeInMilliseconds > m_startTime + m_maxTime)
            {
                MarkForClose();
                return;
            }

            if (m_trailEffect != null)
            {
                m_trailEffect.WorldMatrix = Matrix.CreateWorld(this.WorldVolume.Center, m_trailEffect.WorldMatrix.Forward, m_trailEffect.WorldMatrix.Up);
            }

            if (m_burningCue != null)
            {
                MyAudio.UpdateCuePosition(m_burningCue, this.GetPosition(), this.GetForward(), Vector3.Up, Vector3.Zero);
            }

            base.UpdateBeforeSimulation();
        }
Exemplo n.º 19
0
    public void Click()
    {
        MyAudio.PlayAudio(StaticParameter.s_UI_OK, false, StaticParameter.s_UI_OK_Volume);

        switch (LogInTimeMark)
        {
        case 0:
            MyKeys.Gold_Value += 500;
            break;

        case 1:
            MyKeys.Diamond_Value += 10;
            break;

        case 2:
            MyKeys.Gold_Value += 1000;
            break;

        case 3:
            MyKeys.Diamond_Value += 15;
            break;

        case 4:
            MyKeys.Diamond_Value += 20;
            break;

        case 5:
            MyKeys.Gold_Value += 1500;
            break;

        case 6:
            MyKeys.Diamond_Value += 30;
            break;
        }

        FirstLogIn++;
        LogInTime = TimeManager.ConvertDateTimeInt(DateTime.Now);
        _award_Images[LogInTimeMark].color         = Color.gray;
        _award_Images[LogInTimeMark].raycastTarget = false;
        gameObject.SetActive(false);
    }
Exemplo n.º 20
0
    public void OnEnter()
    {
        _human.eulerAngles = Vector3.up * 180;

        //播放音效
        switch (MyKeys.CurrentSelectedHero)
        {
        case MyKeys.CurrentHero.GuiYuZi:
            MyAudio.PlayAudio(StaticParameter.s_GuiYuZi_Skill, false, StaticParameter.s_GuiYuZi_Skill_Volume);
            break;

        case MyKeys.CurrentHero.CiShen:
            MyAudio.PlayAudio(StaticParameter.s_CiShen_Skill, false, StaticParameter.s_CiShen_Skill_Volume);
            break;

        case MyKeys.CurrentHero.YuZi:
            MyAudio.PlayAudio(StaticParameter.s_YuZi_Skill, false, StaticParameter.s_YuZi_Skill_Volume);
            break;
        }
        MyAudio.PlayAudio(StaticParameter.s_Dash, false, StaticParameter.s_Dash_Volume);

        MoveToDashPosition(_nature);

        _Ani.SetInteger(StaticParameter.Ani_Key_HumanState, 6);

        //加载并实例化冲刺模型
        GameObject dash_Mobel = (GameObject)StaticParameter.LoadObject("Other", "Dash");
        GameObject temp       = Object.Instantiate(dash_Mobel);

        _dash_Mobel = temp.transform.GetChild(0);
        _dash_BG    = temp.transform.GetChild(1);
        //调整碰撞框大小及位置
        _item_Colloder_Transform = HumanColliderManager.Item_Collider.transform;
        _item_Colloder           = _item_Colloder_Transform.GetComponent <SphereCollider>();
        //_item_Colloder_Transform.localPosition = Vector3.up * (-1.42f);
        _item_Colloder.radius = 3.38f;
        //特效位置位置初始化
        _dash_Mobel.position = _human.position - Vector3.up * 2;
        _dash_BG.position    = Vector3.right * _dash_BG.position.x + Vector3.up * _human.position.y +
                               Vector3.forward * _human.position.z;
    }
Exemplo n.º 21
0
        private void Reset( )
        {
            SteamReset( );

            /*
             * if (MyAPIGateway.Session != null)
             * {
             *      MyAPIGateway.Session.UnloadDataComponents();
             *      MyAPIGateway.Session.UnloadMultiplayer();
             *      MyAPIGateway.Session.Unload();
             * }
             */

            MyAudio.Static.UnloadData( );
            MyAudio.UnloadData( );
            MyFileSystem.Reset( );

            InputReset( );

            PhysicsReset( );
        }
Exemplo n.º 22
0
    /// <summary>
    /// 返回按钮调用方法
    /// </summary>
    public void Return()
    {
        MyAudio.PlayAudio(StaticParameter.s_Cancel, false, StaticParameter.s_Cancel_Volume);
        if (!SceneManager.GetActiveScene().name.Equals("UI"))
        {
            //GameUITool.Instance.Prefab_Dictionary[GameUITool.Instance.TheActiveStack.Pop()].SetActive(false);
            //GameUITool.Instance.Prefab_Dictionary[GameUITool.Instance.TheActiveStack.Peek()].SetActive(true);
            //GameUITool.Instance.Prefab_Dictionary[GameUI.GameUI_MyMask].SetActive(false);
            //GameUITool.Instance.SetTheActive(GameUI.GameUI_DuMiao);

            //Debug.Log(MainUITool.Instance.TheActiveStack.Peek());
            //MainUITool.Instance.Prefab_Dictionary[MainUITool.Instance.TheActiveStack.Pop()].SetActive(false);
            //MainUITool.Instance.Prefab_Dictionary[WindowID.WindowID_MyMask].SetActive(false);

            GameUITool.Instance.Return();
        }
        else
        {
            MainUITool.Instance.ReturnPrevious();
        }
    }
Exemplo n.º 23
0
        protected void ChangeSound(float influenceStrength)
        {
            Debug.Assert(IsSound);
            Volume = influenceStrength * (MyFakes.ENABLE_DEBUG_INFLUENCE_SPHERES_SOUNDS ? m_maxVolume : 100.0f);
            if (m_volume <= 0.0f)
            {
                if (m_cue.HasValue)
                {
                    m_cue.Value.Stop(SharpDX.XACT3.StopFlags.Release);
                }
            }
            else
            {
                if ((m_cue.HasValue == false) || (m_cue.Value.IsPlaying == false))
                {
                    m_cue = MyAudio.AddCue2D(m_cueEnum, m_volume);
                }

                MyAudio.UpdateCueAmbVolume(m_cue, m_volume);
            }
        }
Exemplo n.º 24
0
        //  Method returns true if input was captured by control, so no other controls, nor screen can use input in this update
        public override bool HandleInput(MyGuiInput input, bool hasKeyboardActiveControl, bool hasKeyboardActiveControlPrevious, bool receivedFocusInThisUpdate)
        {
            bool captureInput = base.HandleInput(input, hasKeyboardActiveControl, hasKeyboardActiveControlPrevious, receivedFocusInThisUpdate);

            if (captureInput == false)
            {
                if (((IsMouseOver() == true) && ((input.IsNewLeftMouseReleased() == true))) ||
                    ((hasKeyboardActiveControl == true) && (m_canHandleKeyboardInput == true) && ((input.IsJoystickButtonNewPressed(MyJoystickButtonsEnum.J01)) || (input.IsNewKeyPress(Keys.Enter)) || (input.IsNewKeyPress(Keys.Space)))))
                {
                    if (m_implementedFeature == false)
                    {
                        MyAudio.AddCue2D(MySoundCuesEnum.GuiMouseClick);
                        MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.FeatureNotYetImplemented,
                                                                         MyTextsWrapperEnum.MessageBoxCaptionFeatureDisabled, MyTextsWrapperEnum.Ok, null));
                    }
                    else if (m_accessForbiddenReason != null)
                    {
                        MyAudio.AddCue2D(MySoundCuesEnum.GuiMouseClick);
                        MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, m_accessForbiddenReason.Value,
                                                                         MyTextsWrapperEnum.MessageBoxCaptionFeatureDisabled, MyTextsWrapperEnum.Ok, null));
                    }
                    else if (Enabled || UseSwitchMode)
                    {
                        MyAudio.AddCue2D(MySoundCuesEnum.GuiMouseClick);
                        if (m_onButtonClick != null)
                        {
                            m_onButtonClick(this);
                        }
                        else if (m_onIndexedButtonClick != null)
                        {
                            m_onIndexedButtonClick(m_buttonIndex);
                        }
                    }

                    captureInput = true;
                }
            }

            return(captureInput);
        }
Exemplo n.º 25
0
    void Update()
    {
        if (StartGame.First_In)
        {
            return;
        }
        if (Input.GetMouseButtonDown(0))
        {
            if (!_is_Lock)
            {
                return;
            }

            //若在新手引导界面,并且不再第一关,跳出函数
            if (GuidanceBase.GuidanceMark == 0 && !transform.name.Equals("1"))
            {
                return;
            }

            if (EventSystem.current.currentSelectedGameObject != null)
            {
                string name = EventSystem.current.currentSelectedGameObject.name;
                if (name.Contains("jueshe") || name.Contains("jia"))
                {
                    return;
                }
            }

            Vector3 temp = transform.position - Input.mousePosition;

            if (Mathf.Abs(temp.x) < 30 && Mathf.Abs(temp.y) < 30 &&
                MainUITool.Instance.TheActiveStack.Peek() == WindowID.WindowID_MainMenu)
            {
                UIManager.MissionName = transform.name;
                MyKeys.MissionName    = new StringBuilder(transform.name);
                UIManager.ActiveWindow(WindowID.WindowID_MissionPreparation);
                MyAudio.PlayAudio(StaticParameter.s_UI_OK, false, StaticParameter.s_UI_OK_Volume);
            }
        }
    }
        /// <summary>
        /// Remove all action entities
        /// </summary>
        protected virtual void RemoveFromScene()
        {
            foreach (MyEntity actionEntity in ActionEntities)
            {
                //dont delete player ship
                if (actionEntity == MySession.PlayerShip)
                {
                    continue;
                }

                MyEditorGizmo.RemoveEntityFromSelection(actionEntity);

                if (actionEntity == MyEditor.Static.GetEditedPrefabContainer())
                {
                    MyEditor.Static.ResetActivePrefabContainer();
                }

                MyEditor.Static.DeleteEntityFromCollidingList(actionEntity);

                if (!(actionEntity is MyPrefabBase))
                {
                    if (m_activeContainer == null && MyEditor.Static.IsEditingPrefabContainer())
                    {
                        MyEditor.Static.ExitActivePrefabContainer();
                    }
                }
                else
                {
                    MyEditor.Static.EditPrefabContainer(m_activeContainer);
                }

                actionEntity.MarkForClose();

                MyEditor.Static.RecheckAllColidingEntitesAndClearNonColiding();
            }

            ActionEntities.Clear();

            MyAudio.AddCue2D(MySoundCuesEnum.GuiEditorObjectDelete);
        }
Exemplo n.º 27
0
 public override void CloseScreenNow()
 {
     if (m_progressCue != null && m_progressCue.Value.IsPlaying)
     {
         m_progressCue.Value.Stop(SharpDX.XACT3.StopFlags.Immediate);
     }
     if (GetValue() < SUCCESS_VALUE)
     {
         if (m_cancelCueEnum != null && (m_cancelCue == null || !m_cancelCue.Value.IsPlaying))
         {
             m_cancelCue = MyAudio.AddCue2D(m_cancelCueEnum.Value);
         }
     }
     else
     {
         if (m_successCueEnum != null && (m_successCue == null || !m_successCue.Value.IsPlaying))
         {
             m_successCue = MyAudio.AddCue2D(m_successCueEnum.Value);
         }
     }
     base.CloseScreenNow();
 }
Exemplo n.º 28
0
        /// <summary>
        /// Unloads the data.
        /// </summary>
        private void UnloadData()
        {
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyMinerGame::UnloadData");
            MyMwcLog.WriteLine("MyMinerGame.UnloadData() - START");
            MyMwcLog.IncreaseIndent();

            // TODO: Unload data probably not necessery because all data are loaded at start and dies at the end. No partial unload.

            //  We must unload XACT sounds here, not in the background thread, because on Windows XP every XACT sound loaded in
            //  not-main thread is then not player (I can't hear it).
            MyAudio.UnloadData();

            MyGameplayCheats.UnloadData();

            // Not using now
            //MyClientServer.UnloadData();
            MyPerformanceTimer.UnloadData();

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyMinerGame.UnloadData() - END");
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
        }
Exemplo n.º 29
0
    /// <summary>
    /// 交易函数,0:购买钻石,1:购买金币,2:购买体力
    /// </summary>
    /// <param name="x"></param>
    public void Business(int x)
    {
        switch (x)
        {
        case 0:
            break;

        case 1:    //使用钻石购买金币
            if (MyKeys.Diamond_Value > 6)
            {
                MyKeys.Diamond_Value -= 6;
                MyKeys.Gold_Value    += 60;
            }
            else
            {
                UIManager.ActiveWindow(WindowID.WindowID_ShopDiamond);
            }
            break;

        case 2:    //使用钻石购买体力
            if (MyKeys.Diamond_Value >= MyKeys.BuyPhysicalPowerCost)
            {
                MyKeys.Diamond_Value        -= MyKeys.BuyPhysicalPowerCost;
                MyKeys.Physical_Power_Value += 1;
                UMManager.Event(EventID.Buy_Power);
            }
            else
            {
                //UIManager.ActiveWindow(WindowID.WindowID_ShopZuanShi);
                MyAudio.PlayAudio(StaticParameter.s_No, false, StaticParameter.s_No_Volume);
            }
            break;

        default:
            Debug.Log("购买行为标记错误");
            break;
        }
    }
Exemplo n.º 30
0
        /// <summary>
        /// Initialize flares to fire
        /// </summary>
        private void FireFlares()
        {
            m_flareDeploy = MyAudio.AddCue2dOr3d(this, MySoundCuesEnum.SfxFlareDeploy,
                                                 GetPosition(), WorldMatrix.Forward, WorldMatrix.Up, Physics.LinearVelocity);

            MyAudio.UpdateCuePosition(m_flareDeploy, GetPosition(), GetForward(), GetUp(), Physics.LinearVelocity);

            foreach (FlareParticle particle in m_particles)
            {
                particle.Position = WorldMatrix.Translation;
                Matrix rot = Matrix.CreateFromAxisAngle(WorldMatrix.Forward, MyMwcUtils.GetRandomFloat(0.0f, MathHelper.TwoPi));
                particle.Dir     = Vector3.TransformNormal(MyUtilRandomVector3ByDeviatingVector.GetRandom(WorldMatrix.Up, 0.2f), rot);
                particle.FlyTime = MyMwcUtils.GetRandomFloat(500, 8000);
                particle.Life    = MyMwcUtils.GetRandomFloat(8000, MyDecoyFlareConstants.MAX_LIVING_TIME);

                var effect = MyParticlesManager.CreateParticleEffect((int)MyParticleEffectsIDEnum.UniversalLauncher_DecoyFlare);
                effect.UserBirthMultiplier = 0.3f;
                particle.ParticleEffect    = effect;
            }

            m_startParticleTime = MyMinerGame.TotalGamePlayTimeInMilliseconds;
            m_flaresFired       = true;
        }
Exemplo n.º 31
0
    // Use this for initialization
    void Start()
    {
        allSounds["child_scream"] = new MyAudio();
        allSounds["child_scream"].SetSound("Sounds/Child_scream");

        allSounds["coins"] = new MyAudio();
        allSounds["coins"].SetSound("Sounds/coins");

        allSounds["death"] = new MyAudio();
        allSounds["death"].SetSound("Sounds/death");

        allSounds["heart_loss"] = new MyAudio();
        allSounds["heart_loss"].SetSound("Sounds/heart_loss");

        allSounds["sewing"] = new MyAudio();
        allSounds["sewing"].SetSound("Sounds/sewing");

        allSounds["sewing_fast"] = new MyAudio();
        allSounds["sewing_fast"].SetSound("Sounds/sewing_fast");

        allSounds["shoe_not_ok"] = new MyAudio();
        allSounds["shoe_not_ok"].SetSound("Sounds/shoe_not_ok");

        allSounds["shoe_ok"] = new MyAudio();
        allSounds["shoe_ok"].SetSound("Sounds/shoe_ok");

        allSounds["whip_bigl"] = new MyAudio();
        allSounds["whip_bigl"].SetSound("Sounds/whip_bigl");

        allSounds["whip_small"] = new MyAudio();
        allSounds["whip_small"].SetSound("Sounds/whip_small");

        allSounds["child_placed"] = new MyAudio();
        allSounds["child_placed"].SetSound("Sounds/StawianieDziecka");

        allSounds["worker_placed"] = new MyAudio();
        allSounds["worker_placed"].SetSound("Sounds/StawianieLudka");

        allSounds["worker_switch"] = new MyAudio();
        allSounds["worker_switch"].SetSound("Sounds/Switch");

        allSounds["click"] = new MyAudio();
        allSounds["click"].SetSound("Sounds/Click");

        musicMain = SoundMgr.Instance.gameObject.AddComponent<AudioSource>();
        musicMain.clip = Resources.Load("Music/flute") as AudioClip; ;
        musicMain.loop = true;
        musicMain.volume = 0;

        musicFast = SoundMgr.Instance.gameObject.AddComponent<AudioSource>();
        musicFast.clip = Resources.Load("Music/fast_music") as AudioClip; ;
        musicFast.loop = true;
        musicFast.volume = 0;

        musicConveyor = SoundMgr.Instance.gameObject.AddComponent<AudioSource>();
        musicConveyor.clip = Resources.Load("Music/conveyor") as AudioClip; ;
        musicConveyor.loop = true;
        musicConveyor.volume = 0;

        musicOutro = SoundMgr.Instance.gameObject.AddComponent<AudioSource>();
        musicOutro.clip = Resources.Load("Music/ending_music") as AudioClip; ;
        musicOutro.volume = 0.0f;

        Debug.Log("I'm alive");

        PlayMainLoop();
    }