Exemplo n.º 1
0
    public GameWorld(int width, int height, ContentManager Content)
    {
        screenWidth = width;
        screenHeight = height;
        random = new Random();
        gameState = GameState.Menu;
        inputHelper = new InputHelper();
        block = Content.Load<Texture2D>("block");
        reset = Content.Load<Texture2D>("reset");
        font = Content.Load<SpriteFont>("SpelFont");
        font2 = Content.Load<SpriteFont>("SpriteFont1");
        font3 = Content.Load<SpriteFont>("SpriteFont2");
        playButton = Content.Load<Texture2D>("Play");
        optionsButton = Content.Load<Texture2D>("Options");
        backButton = Content.Load<Texture2D>("Back");
        polytris = Content.Load<Texture2D>("Polytris");
        grid = new TetrisGrid(block);
        level = 1;
        levelspeed = 1;
        score = 0;
        i = (int)random.Next(7) + 1;
        i2 = (int)random.Next(7) + 1;
        blockcounter = 1;

        blocks = new BlockList(block, Content);          //Voegen de verschillende blockobjecten toe aan de lijst
        block1 = new Block1(block, Content);
        blocks.Add(block1, 1);
        block2 = new Block2(block, Content);
        blocks.Add(block2, 2);
        block3 = new Block3(block, Content);
        blocks.Add(block3, 3);
        block4 = new Block4(block, Content);
        blocks.Add(block4, 4);
        block5 = new Block5(block, Content);
        blocks.Add(block5, 5);
        block6 = new Block6(block, Content);
        blocks.Add(block6, 6);
        block7 = new Block7(block, Content);
        blocks.Add(block7, 7);

        //Voegen de verschillende blockobjecten toe aan een tweede lijst voor het tekenen van het volgende blokje
        block1res = new Block1(block, Content);
        blocks.AddToReserve(block1res, 1);
        block2res = new Block2(block, Content);
        blocks.AddToReserve(block2res, 2);
        block3res = new Block3(block, Content);
        blocks.AddToReserve(block3res, 3);
        block4res = new Block4(block, Content);
        blocks.AddToReserve(block4res, 4);
        block5res = new Block5(block, Content);
        blocks.AddToReserve(block5res, 5);
        block6res = new Block6(block, Content);
        blocks.AddToReserve(block6res, 6);
        block7res = new Block7(block, Content);
        blocks.AddToReserve(block7res, 7);

        options = new Options(block, reset, backButton, width, height, font, blocks);
        menu = new Menu(playButton, optionsButton, polytris, width, height);
        gameOver = new GameOver(backButton, width, height);
    }
Exemplo n.º 2
0
 private void DataFromFile_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
 {
     if (_blocktype)
     {
         var    item    = DataFromFile.SelectedItem;
         Block3 newitem = (Block3)item;
         int    index   = _result1.FindIndex(a => a.Freq == newitem.Freq && a.Temp == newitem.Temp);
         if (_indexList.IndexOf(index) != -1)
         {
         }
         bool contain = _indexList.IndexOf(index) != -1;
         if (contain)
         {
             return;
         }
         _indexList.Add(index);
     }
     else
     {
         var    item    = DataFromFile.SelectedItem;
         Block4 newitem = (Block4)item;
         int    index   = _result2.FindIndex(a => a.Freq == newitem.Freq && a.Temp == newitem.Temp);
         bool   contain = _indexList.IndexOf(index) != -1;
         if (contain)
         {
             return;
         }
         _indexList.Add(index);
     }
 }
Exemplo n.º 3
0
        void showBlock(int level)
        {
            switch (level)
            {
            case 1:
                Block1.Show();
                Block1.Location = block.Location;
                break;

            case 2:
                Block2.Show();
                Block2.Location = block.Location;
                if (Block2.Left != Block1.Left)
                {
                    block.Hide();
                    Timer_Game3.Start();
                    fail();
                }
                break;

            case 3:
                Block3.Show();
                Block3.Location = block.Location;
                if (Block3.Left != Block2.Left)
                {
                    block.Hide();
                    Timer_Game3.Start();
                    fail();
                }
                break;
            }
        }
Exemplo n.º 4
0
 public CharacterInfo()
 {
     Block1  = new Block1();
     Block2  = new Block2();
     Block3  = new Block3();
     XAdjust = 0;
     YAdjust = 0;
     Trailer = 0xFFFF;
 }
Exemplo n.º 5
0
 void HideBlock()
 {
     Block1.Hide();
     Block2.Hide();
     Block3.Hide();
     Block4.Hide();
     Block5.Hide();
     Block6.Hide();
     Block7.Hide();
     Block8.Hide();
     Block9.Hide();
     Block10.Hide();
 }
Exemplo n.º 6
0
        public string Open(int blocktype) // Не лезь, она тебя сожрет!
        {
            OpenFileDialog openFileDialog = new OpenFileDialog {
                Filter = "Text files (*.txt)|*.txt"
            };

            if (openFileDialog.ShowDialog() == true)
            {
                Path       = openFileDialog.FileName;
                _blocktype = blocktype;
            }
            else
            {
                Path = String.Empty;
                return(Path);
            }
            ReadFile();
            if (blocktype == 7 || blocktype == 4 || blocktype == 9)
            {
                if (Block.GetLength(0) == 1025)
                {
                    for (int x = 0; x < Block.GetLength(0); x++)
                    {
                        if (blocktype == 7)
                        {
                            Block3 checkBlock = new Block3(Block[x, 0], Block[x, 1], Block[x, 2], Block[x, 3],
                                                           Block[x, 4], Block[x, 5], Block[x, 6]);
                            checkBlock.Freq = Block[x, 0];
                        }
                        else if (blocktype == 4)
                        {
                            Block4 checkBlock = new Block4(Block[x, 0], Block[x, 1], Block[x, 2], Block[x, 3]);
                            checkBlock.Freq = Block[x, 0];
                        }
                        else if (blocktype == 9)
                        {
                            Block3 checkBlock3 = new Block3(Block[x, 0], Block[x, 1], Block[x, 2], Block[x, 3],
                                                            Block[x, 4], Block[x, 5], Block[x, 6]);
                            checkBlock3.Freq = Block[x, 0];
                            Block4 checkBlock4 = new Block4(Block[x, 0], Block[x, 1], Block[x, 7], Block[x, 8]);
                            checkBlock4.Freq = Block[x, 0];
                        }
                    }
                }
                else
                {
                    throw new Exception();
                }
            }
            return(Path);
        }
Exemplo n.º 7
0
 public int[,] createBlock()
 {
     if (r.Next(7) == 0)
     {
         Block1 newArray = new Block1();
         currentBlock = newArray.getArray();
         currentColor = Color.Cyan;
     }
     else if (r.Next(7) == 1)
     {
         Block2 newArray = new Block2();
         currentBlock = newArray.getArray();
         currentColor = Color.CornflowerBlue;
     }
     else if (r.Next(7) == 2)
     {
         Block3 newArray = new Block3();
         currentBlock = newArray.getArray();
         currentColor = Color.Orange;
     }
     else if (r.Next(7) == 3)
     {
         Block4 newArray = new Block4();
         currentBlock = newArray.getArray();
         currentColor = Color.Yellow;
     }
     else if (r.Next(7) == 4)
     {
         Block5 newArray = new Block5();
         currentBlock = newArray.getArray();
         currentColor = Color.LimeGreen;
     }
     else if (r.Next(7) == 5)
     {
         Block6 newArray = new Block6();
         currentBlock = newArray.getArray();
         currentColor = Color.Purple;
     }
     else
     {
         Block7 newArray = new Block7();
         currentBlock = newArray.getArray();
         currentColor = Color.Red;
     }
     return(currentBlock);
 }
Exemplo n.º 8
0
        private void DataFromFile_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            //var cellInfo = DataFromFile.SelectedCells[0];
            //var content = cellInfo.Column.GetCellContent(cellInfo.Item);

            if (DataFromFile.HasItems && DataFromFile.SelectedItem != null)
            {
                if (_blocktype)
                {
                    Block3 data = DataFromFile.SelectedItem as Block3;
                    MainWindow.ShowResuiltBlock1InUi(data);
                }
                else
                {
                    Block4 data = DataFromFile.SelectedItem as Block4;
                    MainWindow.ShowResuiltBlock2InUi(data);
                }
            }
        }
Exemplo n.º 9
0
        public static async Task Validate(Transaction transaction)
        {
            var transactionStrings = JsonConvert.SerializeObject(transaction, Formatting.Indented);

            Console.WriteLine($"New Transaction : {transactionStrings} \n");

            float moneyLeft = 999999999.00f;
            User  fromUser  = new User();

            if (!IsDonatable)
            {
                fromUser  = _dbContext.Users.FirstOrDefault(x => x.Username == transaction.FromAddress);
                moneyLeft = fromUser.RemainingMoney;
            }

            if (moneyLeft < transaction.Amount)
            {
                Console.WriteLine("Money Not Enough!");
            }
            else
            {
                if (!IsDonatable)
                {
                    Console.WriteLine("User's Money : " + JsonConvert.SerializeObject(fromUser));
                    fromUser.RemainingMoney -= transaction.Amount;
                }

                transaction.HashedTransactionId = _hash.HashTransaction(transaction);
                var serializedTransaction = JsonConvert.SerializeObject(transaction);
                Client.Broadcast($"Verify : {serializedTransaction}");

                while (ConfirmedNumber < RequiredNumber() && ConfirmedNumber + RejectedNumber < NumNode)
                {
                    await Task.Delay(1000);
                }

                if (ConfirmedNumber < RequiredNumber())
                {
                    Console.WriteLine("Rejected Transaction.....");
                    ConfirmedNumber = 1;
                    RejectedNumber  = 0;
                }
                else
                {
                    var blockCharName = _dbContext.Foundations.OrderBy(x => x.NameEn).LastOrDefault()?.NameEn;

                    if (transaction.ToAddress == blockCharName)
                    {
                        var foundations         = _dbContext.Foundations.FirstOrDefault(x => x.NameEn == transaction.ToAddress);
                        var donatedTransactions = _dbContext.Transactions
                                                  .Where(x => x.IntendedFoundation == blockCharName)
                                                  .ToList();

                        foundations.TotalDonate  += foundations.TotalUnDonate;
                        foundations.TotalUnDonate = 0;

                        donatedTransactions.ForEach(x => x.IsDonated = true);
                        transaction.IsDonated = true;
                    }
                    else
                    {
                        var foundations = _dbContext.Foundations.FirstOrDefault(x => x.NameEn == transaction.IntendedFoundation);
                        foundations.TotalUnDonate += transaction.Amount;
                        transaction.FromAddress    = _hash.CalculateHash(transaction.FromAddress);
                    }

                    // foundations.TotalDonate += transaction.Amount;
                    _dbContext.Transactions.Add(transaction);
                    _dbContext.SaveChanges();

                    ConfirmedNumber = 1;
                    RejectedNumber  = 0;
                    Console.WriteLine("Added Transaction.....");
                    await Task.Delay(5000);

                    BlockGeneric block;
                    BlockGeneric prevBlock;
                    if (Program.Port == 2222)
                    {
                        block     = new Block1();
                        prevBlock = _dbContext.Blockchains1
                                    .OrderBy(x => x.UnixTimeStamp)
                                    .LastOrDefault();
                    }
                    else if (Program.Port == 2223)
                    {
                        block     = new Block2();
                        prevBlock = _dbContext.Blockchains2
                                    .OrderBy(x => x.UnixTimeStamp)
                                    .LastOrDefault();
                    }
                    else
                    {
                        block     = new Block3();
                        prevBlock = _dbContext.Blockchains3
                                    .OrderBy(x => x.UnixTimeStamp)
                                    .LastOrDefault();
                    }

                    var transactions = _dbContext.Transactions
                                       .Where(x => !x.IsCommitted)
                                       .OrderBy(x => x.UnixTimeStamp)
                                       .Take(block.MaxBlockSize)
                                       .ToList();

                    var hashedTransactions = String.Join('-', transactions.Select(x => x.HashedTransactionId));

                    block.HashedTransactionIds = hashedTransactions;
                    block.Height           = (prevBlock?.Height + 1) ?? 0;
                    block.PreviousHash     = prevBlock?.Hash;
                    block.TransactionJsons = transactions != null?JsonConvert.SerializeObject(transactions) : null;

                    block.UnixTimeStamp = DateTime.Now.ToUnixTimeStamp();
                    block.Hash          = _hash.HashBlock(block);
                    block.VerifiedBy    = _hash.CalculateHash(Program.Port.ToString());
                    block.BlockSize     = transactions.Count;

                    transactions.ForEach(x => x.BlockHeight = block.Height);

                    var serializedBlock = JsonConvert.SerializeObject(block, Formatting.Indented);
                    Console.WriteLine($"Transaction inside \n {JsonConvert.SerializeObject(transactions, Formatting.Indented)}");
                    Console.WriteLine($"BlockSize : {block.BlockSize}");
                    Console.WriteLine($"Block : {serializedBlock}\n");
                    Client.Broadcast($"New Block : {serializedBlock}");

                    while (ConfirmedNumber < RequiredNumber() && ConfirmedNumber + RejectedNumber < NumNode)
                    {
                        await Task.Delay(30);
                    }

                    if (ConfirmedNumber < RequiredNumber())
                    {
                        Console.WriteLine("Rejected Block.....");
                    }
                    else
                    {
                        Console.WriteLine("Added Block.....");
                        transactions.ForEach(x => x.IsCommitted = true);

                        if (Program.Port == 2222)
                        {
                            _dbContext.Blockchains1.Add((Block1)block);
                        }

                        else if (Program.Port == 2223)
                        {
                            _dbContext.Blockchains2.Add((Block2)block);
                        }

                        else
                        {
                            _dbContext.Blockchains3.Add((Block3)block);
                        }

                        await _dbContext.SaveChangesAsync();

                        Client.Broadcast($"Add Block to Chain : {JsonConvert.SerializeObject(block)}");
                        PreDonateToFoundationIfAble(transaction);
                    }
                    ConfirmedNumber = 1;
                    RejectedNumber  = 0;
                }
            }
        }
Exemplo n.º 10
0
    void rayCasting(Ray ray)
    {
        RaycastHit hitObj;

        if (Physics.Raycast(ray, out hitObj, Mathf.Infinity))
        {
            if (hitObj.transform.tag.Equals("tripod"))
            {
                TripodScript tripodScript = hitObj.transform.GetComponent <TripodScript>();
                if (null != tripodScript)
                {
                    tripodScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("planks_1"))
            {
                PlankScript plankScript = hitObj.transform.GetComponent <PlankScript>();
                if (null != plankScript)
                {
                    plankScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("car2"))
            {
                Car2Script car2Script = hitObj.transform.GetComponent <Car2Script>();
                if (null != car2Script)
                {
                    car2Script.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("car1"))
            {
                Car1Script capsuleScript = hitObj.transform.GetComponent <Car1Script>();
                if (null != capsuleScript)
                {
                    capsuleScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("Terrain"))
            {
                TerrainScript treeScript = hitObj.transform.GetComponent <TerrainScript>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("detailstone1"))
            {
                Detailstone1Script treeScript = hitObj.transform.GetComponent <Detailstone1Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("detailstone2"))
            {
                Detailstone2Script treeScript = hitObj.transform.GetComponent <Detailstone2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rocks1_1"))
            {
                Rocks1_1Script treeScript = hitObj.transform.GetComponent <Rocks1_1Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rocks2"))
            {
                Rocks2Script treeScript = hitObj.transform.GetComponent <Rocks2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rocks1_2"))
            {
                Rocks1_2Script treeScript = hitObj.transform.GetComponent <Rocks1_2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock1"))
            {
                Rock1Script treeScript = hitObj.transform.GetComponent <Rock1Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock1_1"))
            {
                Rock1_1Script treeScript = hitObj.transform.GetComponent <Rock1_1Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock1_2"))
            {
                Rock1_2Script treeScript = hitObj.transform.GetComponent <Rock1_2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock1_3"))
            {
                Rock1_3Script treeScript = hitObj.transform.GetComponent <Rock1_3Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock1_4"))
            {
                Rock1_4Script treeScript = hitObj.transform.GetComponent <Rock1_4Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock2"))
            {
                Rock2Script treeScript = hitObj.transform.GetComponent <Rock2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock2_1"))
            {
                Rock2_1Script treeScript = hitObj.transform.GetComponent <Rock2_1Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock3"))
            {
                Rock3Script treeScript = hitObj.transform.GetComponent <Rock3Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock3_1"))
            {
                Rock3_1Script treeScript = hitObj.transform.GetComponent <Rock3_1Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rockarc1"))
            {
                Rockarc1Script treeScript = hitObj.transform.GetComponent <Rockarc1Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock2_2"))
            {
                Rock2_2Script treeScript = hitObj.transform.GetComponent <Rock2_2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock1_5"))
            {
                Rock1_5Script treeScript = hitObj.transform.GetComponent <Rock1_5Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock4"))
            {
                Rock4Script treeScript = hitObj.transform.GetComponent <Rock4Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock1_6"))
            {
                Rock1_6Script treeScript = hitObj.transform.GetComponent <Rock1_6Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rocks 1"))
            {
                Rocks_1Script treeScript = hitObj.transform.GetComponent <Rocks_1Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock1_7"))
            {
                Rock1_7Script treeScript = hitObj.transform.GetComponent <Rock1_7Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock1_8"))
            {
                Rock1_8Script treeScript = hitObj.transform.GetComponent <Rock1_8Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock2_3"))
            {
                Rock2_3Script treeScript = hitObj.transform.GetComponent <Rock2_3Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock5"))
            {
                Rock5Script treeScript = hitObj.transform.GetComponent <Rock5Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("rock6"))
            {
                Rock6Script treeScript = hitObj.transform.GetComponent <Rock6Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b1_bench_1_2"))
            {
                Bench_1_2Script treeScript = hitObj.transform.GetComponent <Bench_1_2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b1_bench_2"))
            {
                Bench_2Script treeScript = hitObj.transform.GetComponent <Bench_2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b1_bench_2_2"))
            {
                Bench_2_2Script treeScript = hitObj.transform.GetComponent <Bench_2_2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b1_building1_1"))
            {
                Building1_1Script treeScript = hitObj.transform.GetComponent <Building1_1Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b1_building1_2"))
            {
                Building1_2Script treeScript = hitObj.transform.GetComponent <Building1_2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b1_building2_2_2"))
            {
                Building2_2_2Script treeScript = hitObj.transform.GetComponent <Building2_2_2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b1_building2_2_3"))
            {
                Building2_2_3Script treeScript = hitObj.transform.GetComponent <Building2_2_3Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b1_building4_2"))
            {
                Building4_2Script treeScript = hitObj.transform.GetComponent <Building4_2Script>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b1_building5_1"))
            {
                Building5_1 treeScript = hitObj.transform.GetComponent <Building5_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b1_pavement_2"))
            {
                Pavement_2 treeScript = hitObj.transform.GetComponent <Pavement_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("pavementbricks"))
            {
                Pavementbricks treeScript = hitObj.transform.GetComponent <Pavementbricks>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("pavementbricks_1"))
            {
                Pavementbricks_1 treeScript = hitObj.transform.GetComponent <Pavementbricks_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("planks"))
            {
                Planks treeScript = hitObj.transform.GetComponent <Planks>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("planks_1"))
            {
                Planks_1 treeScript = hitObj.transform.GetComponent <Planks_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("planks_2"))
            {
                Planks_2 treeScript = hitObj.transform.GetComponent <Planks_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("sideblock1"))
            {
                Sideblock1 treeScript = hitObj.transform.GetComponent <Sideblock1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("sideblock1_1_2"))
            {
                Sideblock1_1_2 treeScript = hitObj.transform.GetComponent <Sideblock1_1_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("sideblock1_2"))
            {
                Sideblock1_2 treeScript = hitObj.transform.GetComponent <Sideblock1_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("wire_1"))
            {
                Wire_1 treeScript = hitObj.transform.GetComponent <Wire_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("wire_4"))
            {
                Wire_4 treeScript = hitObj.transform.GetComponent <Wire_4>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("wire_5"))
            {
                Wire_5 treeScript = hitObj.transform.GetComponent <Wire_5>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("wire_6"))
            {
                Wire_6 treeScript = hitObj.transform.GetComponent <Wire_6>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("wire_7"))
            {
                Wire_7 treeScript = hitObj.transform.GetComponent <Wire_7>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("wire_8"))
            {
                Wire_8 treeScript = hitObj.transform.GetComponent <Wire_8>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("wire_9"))
            {
                Wire_9 treeScript = hitObj.transform.GetComponent <Wire_9>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("bench"))
            {
                Bench treeScript = hitObj.transform.GetComponent <Bench>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("bench_1"))
            {
                Bench_1 treeScript = hitObj.transform.GetComponent <Bench_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b2building2_2"))
            {
                Building2_2 treeScript = hitObj.transform.GetComponent <Building2_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b2building4"))
            {
                Building4 treeScript = hitObj.transform.GetComponent <Building4>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b2building5"))
            {
                Building5 treeScript = hitObj.transform.GetComponent <Building5>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b2pavement"))
            {
                Pavement treeScript = hitObj.transform.GetComponent <Pavement>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b2sideblock1_1"))
            {
                Sideblock1_1 treeScript = hitObj.transform.GetComponent <Sideblock1_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("wire"))
            {
                Wire treeScript = hitObj.transform.GetComponent <Wire>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("wire_2"))
            {
                Wire_2 treeScript = hitObj.transform.GetComponent <Wire_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("wire_3"))
            {
                Wire_3 treeScript = hitObj.transform.GetComponent <Wire_3>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("block3"))
            {
                Block3 treeScript = hitObj.transform.GetComponent <Block3>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("floor"))
            {
                Floor treeScript = hitObj.transform.GetComponent <Floor>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("pavementbricks_1_2"))
            {
                Pavementbricks_1_2 treeScript = hitObj.transform.GetComponent <Pavementbricks_1_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight"))
            {
                Streetlight treeScript = hitObj.transform.GetComponent <Streetlight>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight_1"))
            {
                Streetlight_1 treeScript = hitObj.transform.GetComponent <Streetlight_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight_2"))
            {
                Streetlight_2 treeScript = hitObj.transform.GetComponent <Streetlight_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b4bench"))
            {
                B4Bench treeScript = hitObj.transform.GetComponent <B4Bench>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b4bench_1"))
            {
                B4Bench_1 treeScript = hitObj.transform.GetComponent <B4Bench_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b4building2_2"))
            {
                B4Building2_2 treeScript = hitObj.transform.GetComponent <B4Building2_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b4building4"))
            {
                B4Building4 treeScript = hitObj.transform.GetComponent <B4Building4>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b4building5"))
            {
                B4Building5 treeScript = hitObj.transform.GetComponent <B4Building5>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b4pavement"))
            {
                B4Pavement treeScript = hitObj.transform.GetComponent <B4Pavement>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b4sideblock1_1"))
            {
                b4sideblock1_1 treeScript = hitObj.transform.GetComponent <b4sideblock1_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b4wire"))
            {
                b4wire treeScript = hitObj.transform.GetComponent <b4wire>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b4wire_2"))
            {
                b4wire_2 treeScript = hitObj.transform.GetComponent <b4wire_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("b4wire_3"))
            {
                b4wire_3 treeScript = hitObj.transform.GetComponent <b4wire_3>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("crate"))
            {
                Crate treeScript = hitObj.transform.GetComponent <Crate>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("crate_1"))
            {
                Crate_1 treeScript = hitObj.transform.GetComponent <Crate_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("trash"))
            {
                Trach treeScript = hitObj.transform.GetComponent <Trach>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight(out)"))
            {
                streetlightout treeScript = hitObj.transform.GetComponent <streetlightout>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight1(out)"))
            {
                streetlight1out treeScript = hitObj.transform.GetComponent <streetlight1out>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight2(out)"))
            {
                streetlightout2 treeScript = hitObj.transform.GetComponent <streetlightout2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight3(out)"))
            {
                streetlightout3 treeScript = hitObj.transform.GetComponent <streetlightout3>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight_4(out)"))
            {
                streetlightout_4 treeScript = hitObj.transform.GetComponent <streetlightout_4>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight_3(out)"))
            {
                streetlightout_3 treeScript = hitObj.transform.GetComponent <streetlightout_3>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight_2(out)"))
            {
                streetlightout_2 treeScript = hitObj.transform.GetComponent <streetlightout_2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight_1(out)"))
            {
                streetlightout_1 treeScript = hitObj.transform.GetComponent <streetlightout_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("streetlight_(out)"))
            {
                streetlightout_ treeScript = hitObj.transform.GetComponent <streetlightout_>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("trashcan2"))
            {
                Trashcan2 treeScript = hitObj.transform.GetComponent <Trashcan2>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("trashcan1"))
            {
                Trashcan_1 treeScript = hitObj.transform.GetComponent <Trashcan_1>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("trashcan"))
            {
                Trashcan treeScript = hitObj.transform.GetComponent <Trashcan>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("plane"))
            {
                Trashcan treeScript = hitObj.transform.GetComponent <Trashcan>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("shooter"))
            {
                Trashcan treeScript = hitObj.transform.GetComponent <Trashcan>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("runner"))
            {
                Trashcan treeScript = hitObj.transform.GetComponent <Trashcan>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
            else if (hitObj.transform.tag.Equals("back"))
            {
                Trashcan treeScript = hitObj.transform.GetComponent <Trashcan>();
                if (null != treeScript)
                {
                    treeScript.Hit();
                }
            }
        }
    }