private void HealthSystem_OnDead(object sender, EventArgs e)
        {
            //spriteRenderer.sprite = GameAssets.i.s_ShieldTransformerDestroyed;
            //spriteRenderer.material = GameAssets.i.m_SpritesDefault;
            healthBar.Hide();

            OnDestroyed?.Invoke(this, EventArgs.Empty);
        }
 public void RefreshHealthBar()
 {
     healthWorldBar.SetSize(healthSystem.GetHealthPercent());
     if (healthSystem.GetHealthPercent() >= 1f)
     {
         // Full health
         healthWorldBar.Hide();
     }
     else
     {
         healthWorldBar.Show();
     }
 }
Example #3
0
        private void OnTriggerEnter2D(Collider2D collider)
        {
            if (collider.GetComponent <PickupHealth>() != null)
            {
                // Health item!
                materialTintColor.SetTintColor(Color.green);
                healthSystem.Heal(healthSystem.GetHealthMax());
                Destroy(collider.gameObject);
            }

            if (collider.GetComponent <PickupShotgun>() != null)
            {
                // Shotgun
                materialTintColor.SetTintColor(Color.blue);
                SetCanUseShotgun();
                Destroy(collider.gameObject);
                OnPickedUpWeapon?.Invoke(Weapon.WeaponType.Shotgun, EventArgs.Empty);
            }

            if (collider.GetComponent <PickupRifle>() != null)
            {
                // Shotgun
                materialTintColor.SetTintColor(Color.blue);
                SetCanUseRifle();
                Destroy(collider.gameObject);
                OnPickedUpWeapon?.Invoke(Weapon.WeaponType.Rifle, EventArgs.Empty);
            }

            if (collider.GetComponent <Star>() != null)
            {
                // Star!
                // Game Win!
                collider.gameObject.SetActive(false);
                playerMain.PlayerSwapAimNormal.PlayWinAnimation();
                playerMain.PlayerMovementHandler.Disable();
                //transform.Find("Body").GetComponent<MeshRenderer>().material = GameAssets.i.m_PlayerWinOutline;
                healthBar.Hide();
                CameraFollow.Instance.SetCameraFollowPosition(GetPosition());
                CameraFollow.Instance.SetCameraZoom(35f);
                CinematicBars.Show_Static(150f, .6f);

                transform.Find("AimLight").gameObject.SetActive(false);
            }
        }
Example #4
0
    private void IncreaseConstructionTick()
    {
        if (IsConstructing())
        {
            constructionTick++;
            switch (constructionTick)
            {
            case 3:  spriteRenderer.sprite = GameAssets.i.towerConstruction_2;      break;

            case 6:  spriteRenderer.sprite = GameAssets.i.towerConstruction_3;      break;

            case 10: spriteRenderer.sprite = GameAssets.i.towerConstruction_Built;  break;
            }
            float constructionNormalized = constructionTick * 1f / constructionTickMax;
            constructionBar.SetSize(constructionNormalized);

            if (constructionTick >= constructionTickMax)
            {
                // Tower is fully constructed
                constructionBar.Hide();
                onTowerConstructedAction();
            }
        }
    }
 private void HealthSystem_OnDead(object sender, EventArgs e)
 {
     healthWorldBar.Hide();
 }