예제 #1
0
    private void Start()
    {
        blinkTime = 2;

        width            = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)).x - moveEdgeMargin;
        height           = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)).y - moveEdgeMargin;
        z                = transform.position.z;
        overlapCounter   = 0;
        afterBlink       = false;
        movementJoystick = UltimateJoystick.GetUltimateJoystick("Movement");
        shootJoystick    = UltimateJoystick.GetUltimateJoystick("Shoot");
        healthObjects    = new ArrayList();
        for (int i = 0; i < initialHealth; i++)
        {
            GameObject obj = Instantiate(healthSprite);
            healthObjects.Add(obj);
            obj.transform.position = new Vector3(obj.transform.position.x + i * 0.8f, obj.transform.position.y, -1);
        }
    }
예제 #2
0
        public void ShowDeathScreen()
        {
            // Enable the game over screen game object.
            gameOverScreen.gameObject.SetActive(true);

            GameObject expl = ( GameObject )Instantiate(playerExplosionPrefab, FindObjectOfType <PlayerController>().transform.position, Quaternion.identity);

            Destroy(expl, 2);

            // Start the ShakeCamera coroutine for a dynamic effect.
            StartCoroutine("ShakeCamera");

            // Start the Fade coroutine so that the death screen will fade in.
            StartCoroutine("FadeDeathScreen");

            // Set spawning to false so that no more asteroids get spawned.
            spawning = false;

            UltimateJoystick.GetUltimateJoystick("Movement").UpdatePositioning();
        }