private void Awake()
    {
        UpdateOrigins();
        otherPlayer = Controller.Instance.player1 != this ? Controller.Instance.player1 : Controller.Instance.player2;
        CreateNextBlock();

        Controller.Instance.AddBall(ballSpawnXPos, this);
        LineRenderer lr = GetComponent <LineRenderer>();

        if (lr != null)
        {
            lr.positionCount = 4;
            lr.SetPosition(0, _bounds.bottomLeft);
            lr.SetPosition(1, _bounds.bottomRight);
            lr.SetPosition(2, _bounds.topRight);
            lr.SetPosition(3, _bounds.topLeft);
        }
    }
Esempio n. 2
0
    // <summmary>
    // zet hem terug op zn startpositie als hij het scherm verlaat
    // </summary>
    private void Respawn()
    {
        if (player.dead)
        {
            if (!player.otherPlayer.dead)
            {
                player = player.otherPlayer;
                Vector3 tmpPos = startPosition;
                tmpPos.x = player.otherPlayer.ballSpawnXPos;
                SetStartPosition(tmpPos);
            }

            else
            {
                gameObject.SetActive(false);
            }
        }

        player.AddScoreToOther(50);
        JumpToStartPosition();
        //transform.position = startPosition;
        SendInNewRandomDirection();
    }
Esempio n. 3
0
 private void Start()
 {
     player = GetComponentInParent <TetrisBlock>().tet;
     hp     = Random.Range(1, 3);
 }
Esempio n. 4
0
    internal void AddBall(float xPos, TetrisPlayer player)
    {
        Ball ball = Instantiate(ballObject, new Vector2(xPos, Random.Range(0.5f, 19.5f)), Quaternion.identity).GetComponent <Ball>();

        ball.player = player;
    }