// рисует танк public static void paint(OurTank tank) { if (tank.getDirection == Direction.up) { graphics.DrawImage(OUR_TANK_UP[tank.getWheelState], tank.getLocation); } if (tank.getDirection == Direction.down) { graphics.DrawImage(OUR_TANK_DOWN[tank.getWheelState], tank.getLocation); } if (tank.getDirection == Direction.left) { graphics.DrawImage(OUR_TANK_LEFT[tank.getWheelState], tank.getLocation); } if (tank.getDirection == Direction.right) { graphics.DrawImage(OUR_TANK_RIGHT[tank.getWheelState], tank.getLocation); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.name == "player1" || collision.name == "player2") { OurTank myTank = collision.GetComponent <OurTank>(); if (type == Type.bomb) { EnemyTank[] tanks = FindObjectsOfType <EnemyTank>(); foreach (EnemyTank tank in tanks) { if (!tank.m_Dead) { tank.Health = 0; tank.Die(myTank.m_PlayerNumber); } } } else if (type == Type.life) { GameManager.GetInstance().playerLife[myTank.m_PlayerNumber - 1]++; } else if (type == Type.helmet) { myTank.OnInvinciblePrize(); } else if (type == Type.star) { myTank.level++; } else if (type == Type.timer) { BattleManager.GetInstance().bulletTime = 8f; } else if (type == Type.shovel) { BattleManager.GetInstance().GetComponent <MapLoader>().OnPrizeShovel(); } ObjectPool.GetInstance().RecycleObj(gameObject); } }