예제 #1
0
    public void OnTileClicked(TileScript tileClicked)
    {
        int newColor = tileClicked.GetNextColor();
        switch (tileClicked.column) {
        case 1:

            foreach (TileScript t in tilesInLeftColumn) {
                t.ChangeFullColor(newColor);
            }
            foreach (Vehicle v in gs.vehicleBag.FindAll(vec => (vec.channel == 1) && (vec.color == newColor))) {
                gs.vehicleBag.Remove(v);
                Destroy (v.gameObject);
            }
            break;
        case 2:
            foreach (TileScript t in tilesInCenterColumn) {
                t.ChangeFullColor(newColor);
            }
            foreach (Vehicle v in gs.vehicleBag.FindAll(vec => (vec.channel == 2) && (vec.color == newColor))) {
                Debug.Log ("sarasasss");
                gs.vehicleBag.Remove(v);
                Destroy (v.gameObject);}
            break;
        case 3:
            foreach (TileScript t in tilesInRightColumn) {
                t.ChangeFullColor(newColor);
            }
            foreach (Vehicle v in gs.vehicleBag.FindAll(vec => (vec.channel == 3) && (vec.color == newColor))) {
                Debug.Log ("sarasasss");
                gs.vehicleBag.Remove(v);
                Destroy (v.gameObject);
            }
            break;
        }
    }