Пример #1
0
    /// <summary>
    /// Shows notification
    /// </summary>
    /// <param name="notiKey">The key of the notification like 'PirateUp'</param>
    public void Notify(string notiKey)
    {
        //plays the sound of the notification
        AudioCollector.PlayOneShot(notiKey, 15);

        _allNotifications.Insert(0, notiKey);
        Show("");
    }
Пример #2
0
    // Update is called once per frame
    private void Update()
    {
        //means tht it has it loaded
        if (_gameTime == null)
        {
            return;
        }

        if (QuestManager == null)
        {
            QuestManager = new QuestManager();
        }

        QuestManager.Update();

        //if (EnemyManager == null)
        //{
        //    EnemyManager = new EnemyManager();
        //}
        //if (GameWasFullyLoadedAnd10SecAgo())
        //{
        //    EnemyManager.Update();
        //}

        AudioCollector.Update();
        CreateDummySpawnPoint();

        DebugInput();
        DebugChangeScreenResolution();

        if (Camera.main != null && _culling == null)
        {
            //bz camera needs to be initiated already
            _culling = new Culling();
            _fustrum = new Fustrum();
        }

        if (_fustrum != null)
        {
            _fustrum.Update();
        }

        if (hud == null)
        {
            var hudGO = FindObjectOfType <HUDFPS>();
            if (hudGO != null)
            {
                hud = hudGO.GuiText;
                HideShowTextMsg();
            }
        }

        //if (Input.GetKeyUp(KeyCode.B))
        //{
        //    //_staticBatch = new StaticBatch();
        //    //_meshBatch = new MeshBatch();
        //}
    }
Пример #3
0
    public void ShowExplicitThis(string key)
    {
        AudioCollector.PlayOneShot("ClickWoodSubtle", 0);

        _rectTransform.position = Hoverable.MousePositionTowardsScreenCenter();

        _text.text = key;
        showedAt   = Time.time;
    }
Пример #4
0
    public void ShowExplicitThis(Vector3 pos, string key)
    {
        AudioCollector.PlayOneShot("ClickWoodSubtle", 0);

        //_rectTransform.position = pos;

        _text.text = _msg;
        _geometry.SetActive(true);

        diffToMouse = pos - Input.mousePosition;
        showedAt    = Time.time;
    }
Пример #5
0
    public void Show(Vector3 pos, string key)
    {
        AudioCollector.PlayOneShot("ClickWoodSubtle", 0);
        _key = key;
        _msg = Languages.ReturnString(key + ".HoverSmall");

        _rectTransform.position = Hoverable.MousePositionTowardsScreenCenter();

        _text.text = _msg;

        showedAt = Time.time;
    }
Пример #6
0
    internal void Show()
    {
        AudioCollector.PlayOneShotFullAudio("ClickMetal2");
        Program.MouseListener.HidePersonBuildOrderNotiWindows();

        transform.position = _iniPos;

        var which = _helps[_currentIndex];

        _text.text = Languages.ReturnString(which);

        Program.MouseListener.TutoWindow1.HideArrow();
        Program.MouseListener.BulletinWindow.Hide();
    }
Пример #7
0
    public void Notify(string notiKey, string addP)
    {
        _allNotifications.Insert(0, notiKey + "|" + addP);
        Show("");

        //means the sound of the noti is set off
        if (PlayerPrefs.GetInt(notiKey) == -1)
        {
            return;
        }

        //plays the sound of the notification
        AudioCollector.PlayOneShot(notiKey, 15);
    }
Пример #8
0
    /// <summary>
    /// This one is a simple message
    /// </summary>
    /// <param name="pos"></param>
    /// <param name="msg"></param>
    public void ShowMsg(string msg)
    {
        //_rectTransform.SetAsLastSibling();

        AudioCollector.PlayOneShot("ClickWoodSubtle", 0);

        _key = "";
        _msg = Languages.ReturnString(msg);

        _rectTransform.position = Hoverable.MousePositionTowardsScreenCenter();

        _text.text = _msg;
        showedAt   = Time.time;
    }
Пример #9
0
 public static Music Switch(H what, Music current = null)
 {
     if (what == H.Sound)
     {
         _isSoundOn = MecanicSwitcher(_isSoundOn);
         AudioCollector.SoundIsSwitchNow();
     }
     else if (what == H.Music)
     {
         _isMusicOn = MecanicSwitcher(_isMusicOn);
         MusicManager.MusicIsSwitchNow();
     }
     return(current);
 }
Пример #10
0
    public void Show(Vector3 pos, string key)
    {
        AudioCollector.PlayOneShot("ClickWoodSubtle", 0);

        _key = key;
        _msg = Languages.ReturnString(key + ".HoverMed");
        //_rectTransform.position = pos;

        _text.text = _msg;
        _geometry.SetActive(true);

        diffToMouse = pos - Input.mousePosition;
        showedAt    = Time.time;
    }
Пример #11
0
    public void Show(Vector3 lookToPos)
    {
        //sublte sound when shows off
        AudioCollector.PlayOneShot("ClickWood4", 10f);
        _oldRot = transform.rotation;

        transform.LookAt(lookToPos);
        _targetRot = transform.rotation;

        //restores last rota
        transform.rotation = _oldRot;

        Geometry.SetActive(true);
        _isShownNow = true;
    }
Пример #12
0
    /// <summary>
    /// Called from GUI
    /// </summary>
    public void SkipTuto()
    {
        AudioCollector.PlayOneShot("ClickWood1", 0);
        //_currentIndex = -1;
        Hide();

        if (_showAgainTuto == null)
        {
            _showAgainTuto = GameObject.Find("ShowAgainTuto");
        }
        _showAgainTuto.SetActive(true);

        Program.gameScene.QuestManager.TutoCallWhenDone();
        PlayerPrefs.SetString("Tuto", "Skip");
    }
Пример #13
0
    public void A2SecUpdate()
    {
        if (Camera.main == null)
        {
            return;
        }

        var dist = Vector3.Distance(Camera.main.transform.position, _general.transform.position);

        if (dist > 1000)
        {
            return;
        }

        AudioCollector.Reporting(WhatAmIReporting(), dist);
    }
Пример #14
0
    public override void DonePlace()
    {
        //updates the build
        //calling update here to correct bugg that plane was not in the same position
        //as geometry
        UpdateBuild();
        //then is Build is ok...
        if (IsBuildOk)
        {
            FinishPlacingMode(H.Done);
            if (!IsLoadingFromFile)
            {
                AddOnRegistro();
            }
            InitHouseProp();
        }
        else if (!IsEven)
        {
            //todo noti
            GameScene.ScreenPrint("Can't place here: uneven terrain! Struc");
        }
        else if (IsColliding)
        {
            GameScene.ScreenPrint("Can't place here: colli");
        }
        else
        {
            GameScene.ScreenPrint("could be the sea Struct.cs");
        }

        if (HType == H.BullDozer && !IsColliding)
        {
            DestroyCool();

            Program.gameScene.GameController1.Dollars -= 10;
            BulletinWindow.SubBulletinFinance1.FinanceLogger.AddToAcct("Construction", 10);

            AudioCollector.PlayOneShot("BoughtLand", 0);

            //in case ladns on top of other building
            Program.InputMain.RightClickRoutine();
            //in case was notifiying somehting
            Program.gameScene.GameController1.NotificationsManager1.HideMainNotify();
        }
    }
Пример #15
0
    public void Next(string step)
    {
        if (_showAgainTuto == null)
        {
            return;
        }

        if (_currentIndex == -1 || step != _steps[_currentIndex] || _showAgainTuto.activeSelf)
        {
            return;
        }

        HideAllHelpers();
        HideArrow();
        ManagerReport.AddInput("Tuto.Step.Achieved:" + _steps[_currentIndex]);
        _currentIndex++;

        if (_currentIndex >= _steps.Count)
        {
            _currentIndex = -1;
            Hide();

            //temporal
            Dialog.OKDialog(H.TutoOver);

            if (!Program.WasTutoPassed)
            {
                Program.gameScene.GameController1.Dollars += 10000;
                AudioCollector.PlayOneShot("BoughtLand", 0);
                BulletinWindow.SubBulletinFinance1.FinanceLogger.AddToAcct("Quests Completion", 10000);
            }

            ManagerReport.AddInput("Tutorial.Done:");
            Program.gameScene.QuestManager.QuestFinished("Tutorial");

            Program.WasTutoPassed = true;
            PlayerPrefs.SetString("Tuto", "Done");


            return;
        }
        //QuestManager.QuestFinished("Tutorial");
        Show();
    }
Пример #16
0
    void StartDemolishProcess()
    {
        //if is not fully build will do this b4
        if (!IsFullyBuilt())
        {
            AddToConstruction(100000);
            //needed for in case this is saved and load
            PersonPot.Control.Queues.AddToDestroyBuildsQueue(Anchors, MyId);
            HideAll();
        }
        BuildingPot.Control.Registro.RemoveItem(Category, MyId);
        _construcionSign = General.Create(Root.DemolishSign, MiddlePoint(), "Demolition", transform);

        ReturnWhatThisCost();
        AudioCollector.PlayOneShot("BUILDING_DEMOLISH_1", 0);

        //the water doesnt need to be evacuated
        Inventory.RemoveByWeight(P.Water, 10000);
    }
Пример #17
0
    private void AudioAmbientPlay()
    {
        if (!Program.GameFullyLoaded())
        {
            return;
        }

        var playThis = MeshController.CrystalManager1.WhatAudioIPlay(transform.position);
        var pos      = MeshController.CrystalManager1.CurrentRegionPos(transform.position);

        //if game tht has not started
        if (string.IsNullOrEmpty(playThis) || AudioCollector.AudioContainers.Count == 0 ||
            !_isAudioReport
            )
        {
            return;
        }

        AudioCollector.PlayAmbience(playThis, pos);
        //Debug.Log(playThis);
    }
Пример #18
0
    public void QuestFinished(string which)
    {
        ShowQuestBtn();//in case questBtn is null

        which = which + ".Quest";
        _questBtn.HideArrow();

        if (IsAnyActiveQuestMatchThisKey(which))
        {
            var quest  = GetQuestWithKey(which);
            var indexQ = GetIndexOfQuest(quest);

            ShowPrize(quest);

            Program.gameScene.GameController1.Dollars += quest.Prize;
            AudioCollector.PlayOneShot("BoughtLand", 0);
            BulletinWindow.SubBulletinFinance1.FinanceLogger.AddToAcct("Quests Completion", quest.Prize);

            _currentQuests.Remove(indexQ); //remove from _current list
            _doneQuest.Add(indexQ);        //adds to done list
        }
    }
Пример #19
0
 public void NewMusicLevel()
 {
     AudioCollector.SetNewMusicLevelTo(_musicSlider.value);
 }
Пример #20
0
 void ClickAndHideAll()
 {
     AudioCollector.PlayOneShotFullAudio("ClickMetal2");
     HideAll();
 }
Пример #21
0
    /// <summary>
    /// Actions to perform from form
    /// </summary>
    /// <param name="action"></param>
    public void ActionFromForm(string action)
    {
        //play click sound
        //AudioCollector.PlayOneShot("ClickMetal2", 0);

        //btn from main menu
        if (action.Contains("MainMenu."))
        {
            Program.MyScreen1.MouseListenAction(action);
            //play click sound
            AudioCollector.PlayOneShot("ClickMetal2", 0);
        }
        else if (action == "upgBuildMat")
        {
            _buildingWindow.ClickedUpdMatBtn();
        }
        else if (action == "upgBuildCap")
        {
            _buildingWindow.ClickedUpdCapBtn();
        }
        else if (action == "Close_Btn")
        {
            _personWindow.Hide();

            _buildingWindow.Hide();
            UnselectingBuild();
        }
        else if (action == "Demolish_Btn")
        {
            DemolishAction();

            _buildingWindow.Reload();
        }
        else if (action == "Cancel_Demolish_Btn")
        {
            CancelDemolishAction();
            _buildingWindow.Reload();
        }
        else if (action == "BullDozer")
        {
            BuildingPot.InputU.BuildNowNew(H.BullDozer);
            Debug.Log(action);
            //_bullDozerGO = Building.CreateBuild("Prefab/Building/BullDozer", m.HitMouseOnTerrain.point, H.BullDozer);
        }
        else if (action.Contains("Dialog."))
        {
            Dialog.Listen(action);
        }
        else if (action.Contains("GUIBtn."))
        {
            GUIBtnHandlers(action);
        }
        else if (action == H.Next_Stage_Btn.ToString())
        {
            if (BuildingPot.Control.Registro.SelectBuilding.HType.ToString().Contains("Bridge"))
            {
                Bridge b = BuildingPot.Control.Registro.SelectBuilding as Bridge;
                b.ShowNextStageOfParts();
            }
            else
            {
                Structure b = BuildingPot.Control.Registro.SelectBuilding as Structure;
                b.ShowNextStage();
            }
        }
        //Handling GUI : Aug 2015
        else
        {
            HandleGUIClicks(action);
        }
    }
Пример #22
0
    /// <summary>
    /// Builds all the new Buildings .. The buildinga are loaded thue this method
    /// </summary>
    public void BuildNowNew(H buildWhat)
    {
        var state = BuildingPot.UnlockBuilds1.ReturnBuildingState(buildWhat);

        if (state != H.Unlock)
        {
            //todo
            Debug.Log("Sound here off negation of a building");
            return;
        }


        CleanCurrentSpawnBuildIfNewBuildIsADiffType(buildWhat);
        Vector3 iniPos = m.HitMouseOnTerrain.point;

        var onMap = CamControl.CAMRTS.MiniMapRts.IsOnMapConstraints(iniPos);

        iniPos = CamControl.CAMRTS.MiniMapRts.ConstrainLimits(iniPos);


        if (DefineCategory(buildWhat) == Ca.Structure || DefineCategory(buildWhat) == Ca.Shore)
        {
            BuildStructure(buildWhat, iniPos);

            if (buildWhat == H.Dock)
            {
                Program.gameScene.TutoStepCompleted("Dock.Tuto");
            }
        }
        else if (DefineCategory(buildWhat) == Ca.Way)
        {
            BuildWay(buildWhat, iniPos);
            CreateOrKillCursor();
        }
        else if (DefineCategory(buildWhat) == Ca.DraggableSquare)
        {
            BuildDragSquare(buildWhat, iniPos);
            CreateOrKillCursor();
        }

        DoingNow = buildWhat;


        AudioCollector.PlayOneShot("ClickWood7", 0);

        _hoverWindowMed = FindObjectOfType <HoverWindowMed>();

        if (Control.CurrentSpawnBuild.HType == H.BullDozer)
        {
            _hoverWindowMed.ShowSemiTut("BullDozer");
        }
        else if (Control.CurrentSpawnBuild.HType == H.Road && Control.Registro.DragSquares.Count < 4)
        {
            _hoverWindowMed.ShowSemiTut("Road");
        }
        else if (Control.Registro.AllBuilding.Count < 10)
        {
            _hoverWindowMed.ShowSemiTut("Build");
        }

        GameScene.ScreenPrint("Ready to build a " + buildWhat);
        InputMode = Mode.Placing;
    }
Пример #23
0
    /// <summary>
    /// Depending on the current InputMode will direct the code to  BuildingMode(); or
    /// Structure.Place, DrawWay(), DragFarm(
    /// </summary>
    public void BuildingSwitch(H val = H.None)
    {
        //Building mode
        if (InputMode == Mode.Building)
        {
            //with keyboard
            if (val == H.None)
            {
                BuildingMode();
            }
            //with GUI buttons
            else
            {
                BuildNowNew(val);
            }
        }
        //Placing mode
        else if (InputMode == Mode.Placing)
        {
            //Vector3 iniPos = m.HitMouseOnTerrain.point;
            //var onMap = CamControl.CAMRTS.MiniMapRts.IsOnMapConstraints(iniPos);

            //if (!onMap)
            //{
            //    return;
            //}


            //Screen.showCursor = false;
            //Structures
            if (Control.CurrentSpawnBuild.Category == Ca.Structure || Control.CurrentSpawnBuild.Category == Ca.Shore)
            {
                Structure str = Control.CurrentSpawnBuild as Structure;

                //for bulldozer
                if (str != null)
                {
                    str.UpdateClosestVertexAndOld();
                }
            }

            //Ways and Farm
            if (Control.CurrentSpawnBuild.Category == Ca.Way || Control.CurrentSpawnBuild.Category == Ca.DraggableSquare)
            {
                UpdateWayFarmCursor();
                if (Control.CurrentSpawnBuild.Category == Ca.Way)
                {
                    DrawWay();
                }
                else if (DefineCategory(DoingNow) == Ca.DraggableSquare)
                {
                    DragFarm();
                }
            }

            //Structures
            if (Input.GetKeyUp(KeyCode.R) && (DefineCategory(DoingNow) == Ca.Structure || (DefineCategory(DoingNow) == Ca.Shore)))
            {
                ManagerReport.AddInput("RotateBuilding");
                Control.CurrentSpawnBuild.RotationAction();
                AudioCollector.PlayOneShot("ClickMetal1", 0);
            }
            else if (Input.GetMouseButtonUp(0) && !_isDraggingWay && (DefineCategory(DoingNow) == Ca.Structure || (DefineCategory(DoingNow) == Ca.Shore)))
            {
                MouseUp();
            }
        }
    }
Пример #24
0
 public void NewSoundLevel()
 {
     AudioCollector.SetNewSoundLevelTo(_soundSlider.value);
 }