Exemplo n.º 1
0
        void OnTriggerEnter2D(Collider2D other)
        {
            var asteroid = other.GetComponent <AsteroidMovement>();

            if (asteroid != null)
            {
                PlayerData.ModifyScore(asteroid.ScorePoints);
                asteroid.GetComponent <DestroySelf>().SelfDestroy();
                ScreenShake.DoIt(.2f, .05f);
                Destroy(this.gameObject);
            }
        }
Exemplo n.º 2
0
        public static void ModifyLives(int value, bool resetPlayerPos = true)
        {
            if (isInvencible)
            {
                return;
            }

            if (value < 0)
            {
                isInvencible = true;
                ins.playerInvencibility.enabled = true;
                ins.audioSource.Play();
                ScreenShake.DoIt(.5f, .2f);
            }

            lives           += value;
            ins.UILives.text = lives.ToString();

            if (resetPlayerPos)
            {
                ins.playerTrans.position = Vector3.zero;
            }
        }
Exemplo n.º 3
0
 void Start()
 {
     cam = GetComponent <Camera>();
     ins = this;
 }