예제 #1
0
 public void OnPointerExit(PointerEventData data)
 {
     if (countdownActionCount == 0 && icon)
     {
         Destroy(icon);
         BulletsController.GetInstance().RemoveBonusAction(bullet);
     }
 }
예제 #2
0
 public void OnPointerEnter(PointerEventData data)
 {
     if (countdownActionCount > 0 &&
         BulletsController.GetInstance().GetBonusAtIndex(0) == bullet)
     {
         countdownActionCount--;
         bullet.countdownText.text = countdownActionCount.ToString() + " в";
     }
 }
예제 #3
0
        void SpawnBonuse()
        {
            float   xTo        = TurretsController.GetInstance().rightTurret.gameObject.transform.position.x;
            float   yTo        = TurretsController.GetInstance().topTurret.gameObject.transform.position.y;
            Vector2 spawnPoint = WaveSpawner.SelectRandomRectangleSpawnPoint(-xTo, xTo, -yTo, yTo);

            GameObject spriteObject = Instantiate(bullet.sprite, spawnPoint,
                                                  Quaternion.identity, BulletsController.GetInstance().bonusesPool);
            Sprite sprite = spriteObject.GetComponent <Sprite>();

            sprite.activateFunc = delegate { Activate(); };
        }
예제 #4
0
        public void Activate()
        {
            if (!icon)
            {
                BulletsController.GetInstance().AddNewBonusAction(bullet);

                icon = Instantiate(bullet.icon, BulletsController.GetInstance().bonusesPanelUI);
            }

            icon.transform.SetAsFirstSibling();
            countdownActionTime  = actionTime - 1;
            bullet.countdownText = icon.GetComponentInChildren <Text>();
        }
예제 #5
0
        void Update()
        {
            if (countdownActionTime > 0)
            {
                countdownActionTime      -= Time.deltaTime;
                bullet.countdownText.text = (Mathf.Round(countdownActionTime) + 1).ToString() + " с";

                if (countdownActionTime <= 0f)
                {
                    Destroy(icon);
                    BulletsController.GetInstance().RemoveBonusAction(bullet);
                }
            }
        }
예제 #6
0
 void Awake()
 {
     rb     = GetComponent <Rigidbody2D>();
     bullet = new Bullet(BulletsController.GetInstance().currentBullet);
 }