Ejemplo n.º 1
0
 public void ResetGame()
 {
     SetScale(ScreenScale.ScaleByPercent(Camera.main, new Vector3(0.20f, 0.20f, 0.20f), true));
     SetPosition(PositionToScreen.Position(Camera.main, new Vector3(0.50f, 0.50f, 0.0f)));
     velocity = Vector2.zero;
     gameObject.SendMessage("Shrinking", false);
 }
Ejemplo n.º 2
0
    public void StartGame()
    {
        gameState = GameState.Started;

        gameOverCanvas.SetActive(false);

        IGame game;

        for (int n = 0; n < iGameObjects.Length; n++)
        {
            foreach (Component comp in iGameObjects[n].GetComponents(typeof(IGame)))
            {
                game = comp as IGame;
                game.StartGame();
            }
        }

        // Set borders:
        Vector3 lScale          = ScreenScale.Scale(Camera.main, leftBorder);
        Vector3 rScale          = ScreenScale.Scale(Camera.main, rightBorder);
        Vector3 tScale          = ScreenScale.Scale(Camera.main, topBorder);
        Vector3 bScale          = ScreenScale.Scale(Camera.main, bottomBorder);
        Vector3 backgroundScale = ScreenScale.Scale(Camera.main, background);

        leftBorder.transform.localScale = new Vector3(bScale.x, lScale.y);
        leftBorder.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 0.0f, 0.0f));

        rightBorder.transform.localScale = new Vector3(tScale.x, rScale.y);
        rightBorder.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(1.0f, 1.0f, 0.0f));

        topBorder.transform.localScale = new Vector3(tScale.x, rScale.y);
        topBorder.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 1.0f, 0.0f));

        bottomBorder.transform.localScale = new Vector3(bScale.x, lScale.y);
        bottomBorder.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 0.0f, 0.0f));

        background.transform.localScale = new Vector3(backgroundScale.x, backgroundScale.y);
        background.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.5f, 0.5f, 0.0f));

        // Set ads:

        // Set Google Play Score:
    }
Ejemplo n.º 3
0
    void Start()
    {
        Vector3 lScale = ScreenScale.Scale(Camera.main, l);
        Vector3 rScale = ScreenScale.Scale(Camera.main, r);
        Vector3 tScale = ScreenScale.Scale(Camera.main, t);
        Vector3 bScale = ScreenScale.Scale(Camera.main, b);

        l.transform.localScale = new Vector3(bScale.x, lScale.y);
        l.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 0.0f, 0.0f));

        r.transform.localScale = new Vector3(tScale.x, rScale.y);
        r.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(1.0f, 1.0f, 0.0f));

        t.transform.localScale = new Vector3(tScale.x, rScale.y);
        t.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 1.0f, 0.0f));

        b.transform.localScale = new Vector3(bScale.x, lScale.y);
        b.transform.position   = PositionToScreen.Position(Camera.main, new Vector3(0.0f, 0.0f, 0.0f));
    }
Ejemplo n.º 4
0
 public void Respawn()
 {
     transform.position = PositionToScreen.Position(Camera.main, new Vector3(0.5f, 0.5f, 0.5f));
     velocity           = Vector2.zero;
     gameObject.SendMessage("Shrinking", true);
 }