Пример #1
0
    // Update is called once per frame
    public override void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            BallStart();
        }

        if (transform.position.x > 8)
        {
            PlayerPoints++;
            PlayerSide.text = "Player  " + PlayerPoints.ToString();
            BallFinish();
        }
        else if (transform.position.x < -8)
        {
            EnemyPoints++;
            EnemySide.text = EnemyPoints.ToString() + "  Computer";
            BallFinish();
        }

        if (PlayerPoints == 3)
        {
            SceneManager.LoadScene("Winner");
        }
        else if (EnemyPoints == 3)
        {
            SceneManager.LoadScene("Looser");
        }
    }
Пример #2
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         EnemyPoints.addOnePoint();
         Destroy(gameObject);
     }
     if (collision.gameObject.tag == "floor")
     {
         Destroy(gameObject);
     }
 }
Пример #3
0
 public Enemy(string pFileName, int pColumns, int pRows, Level pLevel, EnemyPoints pPoints, EnemyHealth pHealth, EnemyDirection pEnemyDirection = EnemyDirection.left, bool pMirrow = true)
     : base(pFileName, pColumns, pRows)
 {
     _level = pLevel;
     _state = EnemyState.idle;
     _points = pPoints;
     _healthmax = pHealth;
     _health = (float)_healthmax;
     _enemyDirection = pEnemyDirection;
     Mirror(pMirrow, false);
     _hitTimer = 0f;
     _idleTimer = 0f;
     _deathHitAnimationTimer = 0;
 }