private void OnDrawGizmosSelected()
    {
        Gizmos.color = Color.red;

        Gizmos.DrawSphere(BoardLeftBottom, 0.2f);

        HelperFs.GizmosDrawRect(new Rect(BoardLeftBottom, CameraWidth * 2 * Vector2.one));


        Gizmos.color = Color.grey;

        CalculateTileSize();

        float posy = BoardLeftBottom.y + tileSize * 0.5f;

        for (int y = 0; y < boardSize; y++)
        {
            float posx = BoardLeftBottom.x + tileSize * 0.5f;

            for (int x = 0; x < boardSize; x++)
            {
                Gizmos.DrawSphere(new Vector3(posx, posy), 0.2f);

                posx += tileSize + spacing;
            }
            posy += tileSize + spacing;
        }
    }
Exemple #2
0
    private void OnDrawGizmosSelected()
    {
        float yPos = transform.position.y;

        for (int y = 0; y < ySize; y++)
        {
            float xPos = transform.position.x;
            for (int x = 0; x < xSize; x++)
            {
                Gizmos.DrawSphere(new Vector3(xPos, yPos, 0f), 0.1f);
                xPos = xPos + xCellSize;
            }
            yPos = yPos + yCellSize;
        }


        if (!Application.isPlaying)
        {
            CalculateBorderRect();
        }

        HelperFs.GizmosDrawRect(border);

        if (Application.isPlaying)
        {
            Gizmos.color = Color.red;
            Gizmos.DrawSphere(new Vector3(worldXMin, 0, 0f), 0.1f);
            Gizmos.DrawSphere(new Vector3(worldXMax, 0, 0f), 0.1f);
        }
    }
Exemple #3
0
    void SetHiScore(int newHiScore)
    {
        //Change HUD
        hiScore          = newHiScore;
        hiScoreText.text = HelperFs.ScoreFormat(hiScore);

        //Change Player prefs
        PlayerPrefs.SetInt("hiScore", hiScore);
    }
    private void Start()
    {
        CanvasScaler cs = GetComponent <CanvasScaler>();

        cs.referenceResolution = new Vector2(Screen.width, Screen.height);

        //"HI-Score : 5430"
        hiScoreText.text = "HI-Score : " + HelperFs.ScoreFormat(GetHighScore());
    }
Exemple #5
0
    void InitHUD()
    {
        hiScore                = PlayerPrefs.GetInt("hiScore", 0);
        hiScoreText.text       = HelperFs.ScoreFormat(hiScore);
        remainingLifeText.text = remainingLife.ToString();

        fastMovementTimeT = PowerUpsParent.GetChild(0);
        doubleBarrelTimeT = PowerUpsParent.GetChild(1);
        fastShootTimeT    = PowerUpsParent.GetChild(2);
    }
Exemple #6
0
    internal void AddScore(int add)
    {
        score += add;
        if (score > hiScore)
        {
            SetHiScore(score);
        }

        //Change HUD
        scoreText.text = HelperFs.ScoreFormat(score);
    }
Exemple #7
0
    void SpawnUfo()
    {
        float dir = UnityEngine.Random.value;

        if (dir > 0.5f)
        {
            GameObject  ufo = Instantiate(ufoPrefab, ufoSpawnPoint.position - Vector3.right * 8f, Quaternion.identity);
            Rigidbody2D rb  = ufo.AddComponent <Rigidbody2D>();
            rb.gravityScale = 0f;
            rb.velocity     = Vector2.right * ufoSpeed;
            Destroy(ufo, ufoDestroyTime);
            StartCoroutine(HelperFs.DoAfter(() => { AudioManager.Instance.ufoSpawn.Stop(); }, ufoDestroyTime));
        }
        else
        {
            GameObject  ufo = Instantiate(ufoPrefab, ufoSpawnPoint.position + Vector3.right * 8f, Quaternion.identity);
            Rigidbody2D rb  = ufo.AddComponent <Rigidbody2D>();
            rb.gravityScale = 0f;
            rb.velocity     = Vector2.right * -ufoSpeed;
            Destroy(ufo, ufoDestroyTime);
            StartCoroutine(HelperFs.DoAfter(() => { AudioManager.Instance.ufoSpawn.Stop(); }, ufoDestroyTime));
        }
    }