示例#1
0
        public void Enhance()
        {
            var cost = CurrentLevel == 1 ? CellManager.GetEnhanceCost1(CellId) : CellManager.GetEnhanceCost2(CellId);

            LevelManager.AminoAcidAmount -= cost;
            CurrentLevel++;
            if (CurrentLevel == 2)
            {
                transform.GetChild(0).gameObject.SetActive(true);
                transform.GetChild(1).gameObject.SetActive(false);
            }
            else
            {
                transform.GetChild(0).gameObject.SetActive(false);
                transform.GetChild(1).gameObject.SetActive(true);
            }
            GetComponent <CellFireController>().WeaponId = CurrentLevel == 2 ? CellManager.GetVeteranWeaponId(CellId) : CellManager.GetEliteWeaponId(CellId);
            var cb = GetComponent <CellBuild>();

            if (cb != null)
            {
                cb.Refresh();
            }
            else
            {
                gameObject.AddComponent <CellBuild>();
            }
            AudioController.PlaySE("enhance");
        }
示例#2
0
        private IEnumerator Fail()
        {
            AudioController.PlaySE("fail");
            yield return(new WaitForSecondsRealtime(3));

            gameOverLock = false;
        }
示例#3
0
        public void Sale()
        {
            var total_cost = 0;
            var cost1      = CellManager.GetCost(CellId);
            var cost2      = CellManager.GetEnhanceCost1(CellId);
            var cost3      = CellManager.GetEnhanceCost2(CellId);

            switch (CurrentLevel)
            {
            case 1:
                total_cost = cost1;
                break;

            case 2:
                total_cost = cost1 + cost2;
                break;

            case 3:
                total_cost = cost1 + cost2 + cost3;
                break;
            }
            LevelManager.AminoAcidAmount += (int)(total_cost * 0.5f);
            cc.DestroyCell(this);
            AudioController.PlaySE("sale");
        }
示例#4
0
        private IEnumerator Win()
        {
            AudioController.PlaySE("win2");
            yield return(new WaitForSecondsRealtime(3));

            winLock = false;
        }
 public void FadeOut()
 {
     if (PlayerManager.Cells.Length > 5 && LevelManager.ChosenCells.Count < 5)
     {
         AudioController.PlaySE("buzzer");
         return;
     }
     GameObject.Find("Director").GetComponent <Director>().StartGame();
     gameObject.SetActive(true);
     gameObject.AddComponent <PanelDisable>();
 }
示例#6
0
        public void ChoosePanelClick()
        {
            var succeed = LevelManager.Choose(CellId);

            if (succeed)
            {
                var selected = transform.GetChild("Selected").gameObject.activeSelf;
                transform.GetChild("Selected").gameObject.SetActive(!selected);
            }
            else
            {
                AudioController.PlaySE("buzzer");
            }
        }
示例#7
0
 public void Win()
 {
     GameObject.Find("Canvas/GamePanel").SetActive(false);
     if (PlayerManager.CurrentLevel <= LevelManager.Order && !LevelManager.IsFinalLevel)
     {
         PlayerManager.NewLevel();
     }
     if (LevelManager.IsFinalLevel)
     {
         Camera.main.gameObject.AddComponent <LensOut>().Post = ()
                                                                => SceneManager.LoadScene("WinScene", LoadSceneMode.Single);
     }
     else
     {
         AudioController.BGM.Stop();
         AudioController.PlaySE(LevelManager.WinSE);
         winPanel.GetComponent <WinPanelController>().FadeIn();
     }
 }
示例#8
0
        private void Update()
        {
            if (BuildManager.State == BuildState.Building)
            {
                var mouse_pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                mouse_pos.z = 0;
                var cell_pos = path.WorldToCell(mouse_pos);
                if (cell_pos != curPos)
                {
                    var temp = path.GetTile <Tile>(cell_pos);
                    layer = Layer.Path;
                    if (temp == null)
                    {
                        temp  = ground.GetTile <Tile>(cell_pos);
                        layer = Layer.Ground;
                    }
                    if (temp == null)
                    {
                        layer = Layer.Top;
                    }

                    if (currentTile != null)
                    {
                        currentTile.color = Color.white;
                        path.RefreshTile(curPos);
                        ground.RefreshTile(curPos);
                    }

                    currentTile = temp;
                    curPos      = cell_pos;

                    if (currentTile != null)
                    {
                        var sub = mouse_pos - lc.LungsPos;
                        if (cc.Cells.ContainsKey(curPos) || Mathf.Abs(sub.x) < 3 && Mathf.Abs(sub.y) < 1)
                        {
                            currentTile.color = Color.red;
                        }
                        else if (CellManager.IsBarrier(BuildManager.BuildingCellId))
                        {
                            if (layer == Layer.Path)
                            {
                                currentTile.color = Color.green;
                            }
                            else if (layer == Layer.Ground)
                            {
                                currentTile.color = Color.red;
                            }
                        }
                        else
                        {
                            if (layer == Layer.Path)
                            {
                                currentTile.color = Color.red;
                            }
                            else if (layer == Layer.Ground)
                            {
                                currentTile.color = Color.green;
                            }
                        }
                        path.RefreshTile(curPos);
                        ground.RefreshTile(curPos);
                    }
                }

                if (Input.GetMouseButtonDown(0))
                {
                    if (currentTile == null)
                    {
                        return;
                    }
                    else if (currentTile.color == Color.green)
                    {
                        AudioController.PlaySE("build");
                        cc.CreateCell(BuildManager.BuildingCellId, curPos);
                    }
                    else if (currentTile.color == Color.red)
                    {
                        AudioController.PlaySE("buzzer");
                    }
                }
                if (Input.GetMouseButtonDown(1))
                {
                    BuildManager.DeselectCell();
                }
            }
        }
示例#9
0
 public void OnOptionsClicked()
 {
     AudioController.PlaySE("pause");
     opc.FadeIn();
 }