Exemplo n.º 1
0
    void Update()
    {
        float camPos = Camera.main.transform.position.x;
        // blokkerer mario fra å gå ut av screenen
        Rigidbody2D rb = currentPlayer.GetComponent <Rigidbody2D> ();

        rb.position = new Vector2(Mathf.Clamp(rb.position.x, camPos - mariosBackwardBoundsLimit, camPos + 10), rb.transform.position.y);

        if (currentPlayer == lilleMario)
        {
            playerState = lilleMarioScript.getState();
            if (playerState == 2)
            {
                PlayerChangeOccured();
                lilleMarioScript.setDefaultState();
            }
        }
        else if (currentPlayer == storeMario)
        {
            playerState = storeMarioScript.getState();
            if (playerState == 1)
            {
                PlayerChangeOccured();
                storeMarioScript.setDefaultState();
            }
        }
    }
Exemplo n.º 2
0
 void Update()
 {
     if (currentPlayer == lilleMario)
     {
         playerState = lilleMarioScript.getState();
         if (playerState == 2)
         {
             PlayerChangeOccured();
             lilleMarioScript.setDefaultState();
         }
     }
     else if (currentPlayer == storeMario)
     {
         playerState = storeMarioScript.getState();
         if (playerState == 1)
         {
             PlayerChangeOccured();
             storeMarioScript.setDefaultState();
         }
     }
 }