Пример #1
0
 void Start()
 {
     AudioController.PlayBGM("start");
 }
Пример #2
0
 void Start()
 {
     AudioController.PlayBGM(bgm);
     Destroy(this);
 }
Пример #3
0
 public void OnOptionsClicked()
 {
     AudioController.PlaySE("pause");
     opc.FadeIn();
 }
Пример #4
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();
                }
            }
        }
Пример #5
0
 public AudioController()
 {
     instance = this;
 }